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/verify-patch-provenance.py

Python · 4,567 bytes
#!/usr/bin/env python3
"""Rebuild the two shipped patches from Adobe's original ZIP archives."""

from __future__ import annotations

import argparse
import hashlib
import re
import sys
import zipfile
from pathlib import Path


VULN_ARCHIVE_SHA256 = "5f98d409e627c0ac77fb9cbff4bf139c17ad69550dc06411a4b4d0aeadd669e1"
VULN_MEMBER = "VULN_39341_composer_patches/VULN-39341_249.patch"
VULN_MEMBER_SHA256 = "8df23110e1909e2d5f0c2f0ecbe7f803670dfb0c9c3d15a527371c04b7825bf7"
VULN_MAPPED_SHA256 = "d255853dd45cadef9a8d5116617fd4531657c25e11d4895b0691b7ea54e1e27f"

OCTOBER_ARCHIVE_SHA256 = "1d995f5998a65dc46c76c31bb4cff799ebaf26121ca933ec18a708393b2f1d30"
OCTOBER_MEMBER = "2.4.9_oct_2026/249-2026-10-001-CE.patch"
OCTOBER_MEMBER_SHA256 = "9cecb600c0fbb71ac3e52e10926ef4f0f5b8cd770d0c502cd8dce4f5642eff81"
OCTOBER_MAPPED_SHA256 = "d5eee900bef4b9fc072c6c18fbff2f2c2d5b8128e7fe0b973da85a0742171575"

PATH_REPLACEMENTS = (
    (b"vendor/magento/module-backend/", b"app/code/Magento/Backend/"),
    (b"vendor/magento/module-email/", b"app/code/Magento/Email/"),
    (b"vendor/magento/module-newsletter/", b"app/code/Magento/Newsletter/"),
    (b"vendor/magento/framework/", b"lib/internal/Magento/Framework/"),
)

BLOCKSTRAP_FILES = (
    b"vendor/magento/module-email/Model/Template/Filter.php",
    b"vendor/magento/framework/Filter/Template.php",
    b"vendor/magento/framework/Filter/Template/DeferredDirectiveRegistry.php",
    b"vendor/magento/framework/Filter/Template/SignatureProvider.php",
)


def digest(data: bytes) -> str:
    return hashlib.sha256(data).hexdigest()


def require_digest(label: str, data: bytes, expected: str) -> None:
    actual = digest(data)
    if actual != expected:
        raise ValueError(f"{label}: expected {expected}, found {actual}")


def read_member(archive_path: Path, archive_sha: str, member: str, member_sha: str) -> bytes:
    archive = archive_path.read_bytes()
    require_digest(str(archive_path), archive, archive_sha)
    with zipfile.ZipFile(archive_path) as bundle:
        data = bundle.read(member)
    require_digest(member, data, member_sha)
    return data


def map_paths(data: bytes) -> bytes:
    for source, target in PATH_REPLACEMENTS:
        data = data.replace(source, target)
    return data


def select_blockstrap_diffs(data: bytes) -> bytes:
    selected: list[bytes] = []
    for section in re.split(br"(?=^diff --git )", data, flags=re.MULTILINE):
        if not section.startswith(b"diff --git "):
            continue
        header = section.splitlines()[0]
        if any(path in header for path in BLOCKSTRAP_FILES):
            selected.append(section)
    if len(selected) != len(BLOCKSTRAP_FILES):
        raise ValueError(f"expected four BlockStrap diffs, found {len(selected)}")
    return b"".join(selected)


def require_exact(label: str, generated: bytes, shipped_path: Path, expected_sha: str) -> None:
    require_digest(f"generated {label}", generated, expected_sha)
    shipped = shipped_path.read_bytes()
    require_digest(str(shipped_path), shipped, expected_sha)
    if generated != shipped:
        raise ValueError(f"{label}: generated bytes differ from the shipped patch")


def main() -> int:
    parser = argparse.ArgumentParser()
    parser.add_argument("--vuln-archive", required=True, type=Path)
    parser.add_argument("--october-archive", required=True, type=Path)
    args = parser.parse_args()

    repo_root = Path(__file__).resolve().parent.parent
    try:
        vuln_source = read_member(
            args.vuln_archive, VULN_ARCHIVE_SHA256, VULN_MEMBER, VULN_MEMBER_SHA256
        )
        require_exact(
            "VULN-39341 patch",
            map_paths(vuln_source),
            repo_root / "patches/VULN-39341_249-monorepo.patch",
            VULN_MAPPED_SHA256,
        )

        october_source = read_member(
            args.october_archive,
            OCTOBER_ARCHIVE_SHA256,
            OCTOBER_MEMBER,
            OCTOBER_MEMBER_SHA256,
        )
        require_exact(
            "APSB26-153 BlockStrap patch",
            map_paths(select_blockstrap_diffs(october_source)),
            repo_root / "patches/APSB26-153_BlockStrap_249-monorepo.patch",
            OCTOBER_MAPPED_SHA256,
        )
    except (FileNotFoundError, KeyError, OSError, ValueError, zipfile.BadZipFile) as error:
        print(f"Patch provenance verification failed: {error}", file=sys.stderr)
        return 1

    print("Patch provenance verified: both shipped patches reproduce byte-for-byte.")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())