Exploit database

GH-945bd5267b0d1b94c3f74faf5cda7e5a

blkph0x/cve-2026-83844_poc

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-83844

5 sources

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

Repository files579
blkph0x/cve-2026-83844_pocRevision 193ed44859da
Next files →

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

lab/trace/compare_focus.py

Python · 13,331 bytes
#!/usr/bin/env python3
"""Validate and summarize paired, guest-only Paint debugger observations.

The output deliberately excludes guest paths, process IDs, screenshots, and
register values. It reports reach and lifecycle evidence, not CVE attribution.
"""

from __future__ import annotations

import argparse
import hashlib
import json
import re
from pathlib import Path


VERSIONS = {"old": "11.2605.81.0", "new": "11.2609.401.0"}
EXE_SHA256 = {
    "old": "d94d89377a2a78a73b95cff70fc7706df9ae2ae53175bd6d26abb8301e36ecd9",
    "new": "1b35e6c1161dcc057079841fd47c9af93a2c31e002d70cfc159cea6db1134ed4",
}
EXPECTED_CASES = (
    "00_valid_png",
    "01_png_missing_idat",
    "40_official_c2pa_jpeg",
    "42_official_c2pa_box_short",
)
MARKER = re.compile(r"^[a-z0-9_]+$")
CORPUS_ROOT = Path(__file__).resolve().parents[1] / "corpus"
PINNED_MANIFESTS = {
    "frozen": (
        CORPUS_ROOT / "generated" / "manifest.json",
        "f19fa833207911f00dc90263e1c9b8d231305138c3b9f075dea8dd9862a6d200",
        "paint-ab-corpus-v1",
    ),
    "followup": (
        CORPUS_ROOT / "followup" / "generated" / "manifest.json",
        "bdaa7de5a5c769c16e93829c703daf35c4e46b31be9cc0fd8d33edb4b82c6685",
        "paint-action-fixtures-v1",
    ),
}


def read_json(path: Path) -> dict:
    return json.loads(path.read_text(encoding="utf-8-sig"))


def sha256(path: Path) -> str:
    digest = hashlib.sha256()
    with path.open("rb") as stream:
        for chunk in iter(lambda: stream.read(1024 * 1024), b""):
            digest.update(chunk)
    return digest.hexdigest()


def validate_fixture_pin(result: dict, case_id: str, *, legacy_frozen: bool = False) -> int:
    """Tie a guest observation to a committed, SHA-pinned local fixture."""
    source = result.get("fixture_source")
    if legacy_frozen and source is None:
        # The first focused batch predates the source/manifest fields. Its
        # fixture filename and SHA are still checked against the frozen pin.
        source = "frozen"
    if source not in PINNED_MANIFESTS:
        raise ValueError(f"unknown fixture source for {case_id}")
    manifest_path, pinned_sha, schema = PINNED_MANIFESTS[source]
    if sha256(manifest_path) != pinned_sha:
        raise ValueError(f"committed {source} fixture manifest changed")
    manifest = read_json(manifest_path)
    if manifest.get("schema") != schema:
        raise ValueError(f"wrong {source} fixture manifest schema")
    matches = [item for item in manifest.get("cases", []) if item.get("id") == case_id]
    if len(matches) != 1:
        raise ValueError(f"fixture missing or duplicated in pinned manifest: {case_id}")
    item = matches[0]
    filename = item.get("file")
    if not isinstance(filename, str) or not re.fullmatch(r"[A-Za-z0-9_-]+\.(?:png|bmp|jpg)", filename):
        raise ValueError(f"unsafe pinned fixture filename: {case_id}")
    fixture = result.get("fixture") or {}
    if fixture.get("file") != filename or fixture.get("sha256") != item.get("sha256"):
        raise ValueError(f"guest fixture differs from pinned {source} fixture: {case_id}")
    fixture_path = manifest_path.parent / filename
    if sha256(fixture_path) != item["sha256"] or fixture_path.stat().st_size != item["size"]:
        raise ValueError(f"local {source} fixture differs from pinned manifest: {case_id}")
    reported_manifest = result.get("fixture_manifest_sha256")
    if reported_manifest is None and legacy_frozen:
        return item["size"]
    if reported_manifest != pinned_sha:
        raise ValueError(f"guest manifest differs from pinned {source} manifest: {case_id}")
    return item["size"]


def validate_bootstrap(root: Path, batch: dict, profile: str) -> None:
    bootstrap = batch.get("bootstrap") or {}
    if bootstrap.get("stage") != "complete" or bootstrap.get("installed_version") != VERSIONS[profile]:
        raise ValueError(f"{profile} bootstrap did not verify expected Paint")
    path = root / "bootstrap-result.json"
    if not path.is_file() or bootstrap.get("result_sha256") != sha256(path):
        raise ValueError(f"{profile} bootstrap result hash mismatch")
    exit_code = bootstrap.get("script_exit_code")
    if ("script_exit_code" not in bootstrap or exit_code not in (None, 0)
            or bootstrap.get("child_exited_verified") is False
            or (exit_code is None and bootstrap.get("child_exited_verified") is not True)):
        raise ValueError(f"{profile} bootstrap exit could not be verified")


def load_batch(root: Path, profile: str) -> tuple[dict, dict[str, dict]]:
    summaries = list(root.glob(f"focus-batch-{profile}-*.json"))
    if len(summaries) != 1:
        raise ValueError(f"expected one {profile} focus batch, found {len(summaries)}")
    batch = read_json(summaries[0])
    if batch.get("schema") != "paint-ab-focus-batch-v1" or batch.get("build") != profile:
        raise ValueError(f"wrong {profile} focus batch schema/build")
    validate_bootstrap(root, batch, profile)
    rows = batch.get("cases") or []
    if len(rows) != len(EXPECTED_CASES) or {r.get("case_id") for r in rows} != set(EXPECTED_CASES):
        raise ValueError(f"{profile} batch case set differs from focused protocol")

    cases: dict[str, dict] = {}
    for case_id in EXPECTED_CASES:
        files = list((root / "focus" / profile / case_id).glob("*/result.json"))
        if len(files) != 1:
            raise ValueError(f"{profile}/{case_id} has {len(files)} result files")
        result_path = files[0]
        result = read_json(result_path)
        if result.get("schema") != "paint-ab-focused-cdb-v1":
            raise ValueError(f"wrong result schema for {profile}/{case_id}")
        if result.get("build") != profile or result.get("case_id") != case_id:
            raise ValueError(f"wrong profile/case in {result_path}")
        if result.get("installed_package", {}).get("version") != VERSIONS[profile]:
            raise ValueError(f"installed version mismatch in {profile}/{case_id}")
        if result.get("installed_exe_sha256") != EXE_SHA256[profile]:
            raise ValueError(f"signed EXE hash mismatch in {profile}/{case_id}")
        validate_fixture_pin(result, case_id, legacy_frozen=True)
        if not result.get("debugger_ready") or not result.get("debugger_ready_utc"):
            raise ValueError(f"debugger was not ready in {profile}/{case_id}")
        if not result.get("file_open_requested_utc"):
            raise ValueError(f"no file-open request in {profile}/{case_id}")
        if result.get("file_open_method") != "existing_window_ctrl_o":
            raise ValueError(f"unexpected file-open route in {profile}/{case_id}")
        if result.get("file_open_launch_pid") != result.get("blank_pid"):
            raise ValueError(f"file-open route changed Paint PID in {profile}/{case_id}")
        if not result.get("trace_script_sha256") or not result.get("trace_manifest_sha256"):
            raise ValueError(f"unidentified CDB script in {profile}/{case_id}")
        if result.get("status") not in {"complete", "inconclusive"}:
            raise ValueError(f"failed or unfinished focus case {profile}/{case_id}")
        if result.get("error") or result.get("file_open_error"):
            raise ValueError(f"execution error in {profile}/{case_id}")
        for field in ("markers_before_open", "markers_after_open"):
            if any(not isinstance(x, str) or not MARKER.fullmatch(x) for x in result.get(field, [])):
                raise ValueError(f"invalid {field} in {profile}/{case_id}")
        if any(not x.get("matches_signed_package") for x in result.get("loaded_module_checks", [])):
            raise ValueError(f"loaded module mismatch in {profile}/{case_id}")
        if result.get("loaded_module_error"):
            raise ValueError(f"loaded module verification error in {profile}/{case_id}")
        cleanup = result.get("cleanup") or {}
        if cleanup.get("remaining_pids"):
            raise ValueError(f"Paint remained running after {profile}/{case_id}")
        if cleanup.get("forced_pids"):
            raise ValueError(f"Paint required forced close after {profile}/{case_id}")
        if result.get("blank_pid") not in (cleanup.get("close_requested_pids") or []):
            raise ValueError(f"normal Paint close was not requested in {profile}/{case_id}")
        batch_row = next(r for r in rows if r["case_id"] == case_id)
        exit_code = batch_row.get("process_exit_code")
        if ("process_exit_code" not in batch_row or batch_row.get("timed_out")
                or batch_row.get("child_exited_verified") is False
                or exit_code not in (None, 0)
                or (exit_code is None and (result.get("status") != "complete"
                                           or batch_row.get("child_exited_verified") is not True))):
            raise ValueError(f"focused child timed out/failed in {profile}/{case_id}")
        if batch_row.get("result_sha256") != sha256(result_path):
            raise ValueError(f"batch result hash mismatch in {profile}/{case_id}")
        if batch_row.get("status") != result.get("status"):
            raise ValueError(f"batch/result status mismatch in {profile}/{case_id}")
        cases[case_id] = result
    for field in ("trace_script_sha256", "trace_manifest_sha256", "file_open_method"):
        if len({item[field] for item in cases.values()}) != 1:
            raise ValueError(f"{profile} cases used different {field} values")
    return batch, cases


def title_class(result: dict, case_id: str) -> str:
    observed = result.get("observed_paint_processes") or []
    pid = result.get("blank_pid")
    matches = [item for item in observed if item.get("pid") == pid]
    if len(matches) != 1:
        return "same PID not observed"
    title = matches[0].get("title")
    if title == f"{case_id} - Paint":
        return "fixture title"
    if title == "Untitled - Paint":
        return "Untitled"
    return "other title (review locally)"


def marks(result: dict, field: str) -> str:
    values = result.get(field) or []
    return " → ".join(f"`{value}`" for value in values) if values else "none recorded"


def render(old_batch: dict, new_batch: dict,
           old: dict[str, dict], new: dict[str, dict]) -> str:
    lines = [
        "# Paint focused path and closure observations",
        "",
        "These are paired guest debugger runs on the signed old and new Paint packages.",
        "Each run started a blank verified Paint process, attached CDB, opened the",
        "same fixture through Paint's Ctrl+O dialog, recorded one-shot checkpoints,",
        "and requested normal Paint closure. Results here are reach/lifecycle",
        "observations; a hit is not evidence of the CVE fix.",
        "",
        f"Old batch `{old_batch['run_id']}`: `{old_batch['status']}`; "
        f"new batch `{new_batch['run_id']}`: `{new_batch['status']}`.",
        "",
        "| Case | SHA-256 | Old status / title / close | New status / title / close |",
        "| --- | --- | --- | --- |",
    ]
    for case_id in EXPECTED_CASES:
        a, b = old[case_id], new[case_id]
        if a["fixture"]["sha256"] != b["fixture"]["sha256"]:
            raise ValueError(f"A/B fixture differs for {case_id}")
        def cell(item: dict) -> str:
            return f"{item['status']}; {title_class(item, case_id)}; normal close, no remaining PID"
        lines.append(
            f"| `{case_id}` | `{a['fixture']['sha256']}` | {cell(a)} | {cell(b)} |"
        )
    lines.extend(["", "## Checkpoint order", ""])
    for case_id in EXPECTED_CASES:
        lines.extend([
            f"### `{case_id}`",
            "",
            f"- Old before open: {marks(old[case_id], 'markers_before_open')}.",
            f"- Old after open: {marks(old[case_id], 'markers_after_open')}.",
            f"- New before open: {marks(new[case_id], 'markers_before_open')}.",
            f"- New after open: {marks(new[case_id], 'markers_after_open')}.",
            "",
        ])
    lines.extend([
        "## Limits",
        "",
        "One-shot checkpoints do not count repeated calls. CDB attached after the",
        "blank process launched, so a startup-only function may have run before",
        "attachment. A missing marker is recorded as non-reach in this trial only.",
        "The companion raw logs and screenshots remain local; this export omits",
        "guest paths, PIDs, registers, and file contents. For an exact branch or",
        "return-value claim, inspect the corresponding CDB disassembly/registers",
        "and correlate the checkpoint with the same-process module identity.",
        "",
    ])
    return "\n".join(lines)


def main() -> None:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--old", type=Path, required=True)
    parser.add_argument("--new", type=Path, required=True)
    parser.add_argument("--output", type=Path, required=True)
    args = parser.parse_args()
    old_batch, old = load_batch(args.old.resolve(), "old")
    new_batch, new = load_batch(args.new.resolve(), "new")
    args.output.parent.mkdir(parents=True, exist_ok=True)
    args.output.write_text(render(old_batch, new_batch, old, new), encoding="utf-8")
    print(f"Compared {len(EXPECTED_CASES)} focused cases in {args.output}")


if __name__ == "__main__":
    main()