Exploit database

GH-5ce8023524718e1464ef96a65bc3d464

dinosn/cve-2026-103849-blockstrap-lab

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-103849

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files9
dinosn/cve-2026-103849-blockstrap-labRevision e9ce56baa725

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

scripts/set-state.sh

Shell · 3,674 bytes
#!/usr/bin/env bash
set -euo pipefail

desired_state="${1:-}"
magento_root="${MAGENTO_ROOT:-/var/www/html}"
lab_root="${LAB_ROOT:-/lab}"
stylesmuggler_patch="$lab_root/patches/VULN-39341_249-monorepo.patch"
blockstrap_patch="$lab_root/patches/APSB26-153_BlockStrap_249-monorepo.patch"
expected_stylesmuggler_sha256=d255853dd45cadef9a8d5116617fd4531657c25e11d4895b0691b7ea54e1e27f
expected_blockstrap_sha256=d5eee900bef4b9fc072c6c18fbff2f2c2d5b8128e7fe0b973da85a0742171575

if [[ "$desired_state" != "vulnerable" && "$desired_state" != "patched" ]]; then
  printf 'Usage: %s vulnerable|patched\n' "$0" >&2
  exit 64
fi

verify_hash() {
  local file="$1"
  local expected="$2"
  local actual
  actual="$(sha256sum "$file" | awk '{print $1}')"
  if [[ "$actual" != "$expected" ]]; then
    printf 'Patch checksum mismatch for %s: expected %s, found %s\n' \
      "$file" "$expected" "$actual" >&2
    exit 65
  fi
}

patch_state() {
  local file="$1"
  if git apply --check "$file" >/dev/null 2>&1; then
    printf 'absent'
  elif git apply --reverse --check "$file" >/dev/null 2>&1; then
    printf 'applied'
  else
    printf 'unknown'
  fi
}

require_known_state() {
  local label="$1"
  local state="$2"
  if [[ "$state" == "unknown" ]]; then
    printf 'Refusing to alter source: %s patch is in an unknown or partial state.\n' "$label" >&2
    exit 65
  fi
}

verify_hash "$stylesmuggler_patch" "$expected_stylesmuggler_sha256"
verify_hash "$blockstrap_patch" "$expected_blockstrap_sha256"

cd "$magento_root"
stylesmuggler_state="$(patch_state "$stylesmuggler_patch")"
blockstrap_state="$(patch_state "$blockstrap_patch")"
require_known_state VULN-39341 "$stylesmuggler_state"
require_known_state APSB26-153 "$blockstrap_state"

if [[ "$desired_state" == "vulnerable" ]]; then
  if [[ "$blockstrap_state" == "applied" ]]; then
    git apply --reverse "$blockstrap_patch"
    blockstrap_state=absent
  fi
  if [[ "$stylesmuggler_state" == "absent" ]]; then
    git apply "$stylesmuggler_patch"
    stylesmuggler_state=applied
  fi
else
  if [[ "$stylesmuggler_state" == "absent" ]]; then
    git apply "$stylesmuggler_patch"
    stylesmuggler_state=applied
  fi
  if [[ "$blockstrap_state" == "absent" ]]; then
    git apply "$blockstrap_patch"
    blockstrap_state=applied
  fi
fi

php_files=(
  app/code/Magento/Email/Model/Template/Filter.php
  lib/internal/Magento/Framework/Filter/Template.php
  lib/internal/Magento/Framework/Filter/Template/SignatureProvider.php
  lib/internal/Magento/Framework/View/Element/BlockFactory.php
)
if [[ -f lib/internal/Magento/Framework/Filter/Template/DeferredDirectiveRegistry.php ]]; then
  php_files+=(lib/internal/Magento/Framework/Filter/Template/DeferredDirectiveRegistry.php)
fi
for php_file in "${php_files[@]}"; do
  php -l "$php_file" >/dev/null
done

git diff --check
if [[ -f app/etc/env.php ]]; then
  php bin/magento cache:flush >/dev/null 2>&1 || true
fi

final_stylesmuggler_state="$(patch_state "$stylesmuggler_patch")"
final_blockstrap_state="$(patch_state "$blockstrap_patch")"
if [[ "$final_stylesmuggler_state" != "applied" ]]; then
  printf 'VULN-39341 is not applied after the transition.\n' >&2
  exit 1
fi
if [[ "$desired_state" == "vulnerable" && "$final_blockstrap_state" != "absent" ]]; then
  printf 'APSB26-153 BlockStrap fix is not absent in vulnerable state.\n' >&2
  exit 1
fi
if [[ "$desired_state" == "patched" && "$final_blockstrap_state" != "applied" ]]; then
  printf 'APSB26-153 BlockStrap fix is not applied in patched state.\n' >&2
  exit 1
fi

printf 'Magento source state: %s (VULN-39341=%s, BlockStrap-fix=%s)\n' \
  "$desired_state" "$final_stylesmuggler_state" "$final_blockstrap_state"