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/export_provenance_stress_evidence.py

Python · 24,675 bytes
#!/usr/bin/env python3
"""Export bounded, address-free old/new JUMBF stress branch evidence.

Reads ignored focused guest records. It does not launch Paint, print process
IDs, or copy raw pointer/memory bytes into the output. An old-only output is
explicitly preliminary; a paired comparison requires both complete guests.
"""

from __future__ import annotations

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

from compare_focus import EXE_SHA256, VERSIONS, sha256, validate_bootstrap
from export_provenance_deep_evidence import (
    PINNED, ROOT, SHA_RE, TRIAL_RE, byte_rows, load_json, marker_blocks,
    qwords, register, require,
)


CONTROL = "40_official_c2pa_jpeg"
KNOWN_TYPES = {"jumb", "jumd", "cbor", "json", "bfdb", "bidb"}
MAX_LOG_BYTES = 20_000_000
MAX_MARKERS = 2_500
MAX_HEADER_HITS = 512
MAX_GUARD_HITS = 512
LARGE_DECLARED = {0xFFFFFFFF, 1 << 32, (1 << 64) - 1}


def signed32(value: int | None) -> int | None:
    if value is None:
        return None
    value &= 0xFFFFFFFF
    return value - 0x100000000 if value & 0x80000000 else value


def safe_span(value: int | None, file_size: int) -> int | str | None:
    if value is None:
        return None
    if value <= file_size + 128 or value in LARGE_DECLARED:
        return value
    # A malformed CDB capture might otherwise print a process address as a
    # supposed span. Its exact bits are never needed for this public summary.
    return "above_input_bound"


def stress_pins() -> tuple[dict[str, dict[str, Any]], str, str]:
    stress_path = ROOT / "lab/corpus/provenance_stress/generated/manifest.json"
    frozen_path = ROOT / "lab/corpus/generated/manifest.json"
    stress = load_json(stress_path)
    frozen = load_json(frozen_path)
    require(stress.get("schema") == "paint-ab-jumbf-stress-fixtures-v1", "Stress manifest schema changed")
    require(frozen.get("schema") == "paint-ab-corpus-v1", "Frozen manifest schema changed")
    control = [case for case in frozen["cases"] if case.get("id") == CONTROL]
    require(len(control) == 1, "Pinned source control missing or duplicated")
    require(control[0]["sha256"] == stress.get("source_sha256"), "Stress source differs from frozen control")
    pins = {CONTROL: control[0]}
    for case in stress["cases"]:
        case_id = case.get("id")
        require(isinstance(case_id, str) and re.fullmatch(r"stress_[a-z0-9_]+", case_id) is not None,
                "Unsafe stress case ID")
        require(case_id not in pins, "Duplicate stress case")
        pins[case_id] = case
    for case_id, case in pins.items():
        location = (frozen_path.parent if case_id == CONTROL else stress_path.parent) / case["file"]
        require(location.is_file() and sha256(location) == case["sha256"] and
                location.stat().st_size == case["size" if case_id == CONTROL else "bytes"],
                f"Pinned fixture file differs: {case_id}")
    return pins, sha256(stress_path), sha256(frozen_path)


def header_sequence(blocks: list[tuple[str, str]]) -> list[dict[str, Any]]:
    sequence = []
    for label, body in blocks:
        if label != "provdeep_header_repeat":
            continue
        rows = byte_rows(body)
        if not rows or len(rows[-1]) < 8:
            sequence.append({"lbox": None, "type": "unreadable"})
            continue
        source = rows[-1]
        tag = source[4:8].decode("ascii", errors="replace")
        if tag not in KNOWN_TYPES:
            sequence.append({"lbox": None, "type": "other"})
        else:
            sequence.append({"lbox": int.from_bytes(source[:4], "big"), "type": tag})
    require(len(sequence) <= MAX_HEADER_HITS, "Too many repeated old header hits")
    return sequence


def guard_sequence(blocks: list[tuple[str, str]], file_size: int) -> list[dict[str, Any]]:
    sequence = []
    for label, body in blocks:
        if label != "provdeep_payload_guard":
            continue
        words = qwords(body)
        values = (
            register(body, "r8"),
            words[-2] if len(words) >= 2 else None,
            words[-1] if len(words) >= 2 else None,
        )
        sequence.append({
            "payload_bytes": safe_span(values[0], file_size),
            "remaining_bytes": safe_span(values[1], file_size),
            "declared_box_bytes": safe_span(values[2], file_size),
        })
    require(len(sequence) <= MAX_GUARD_HITS, "Too many repeated old payload guards")
    return sequence


def old_branch(blocks: list[tuple[str, str]], file_size: int) -> dict[str, Any]:
    by_label: dict[str, list[str]] = {}
    for label, body in blocks:
        by_label.setdefault(label, []).append(body)
    first = lambda label: by_label.get(label, [""])[0]
    sdk_status = signed32(register(first("provenance_sdk_init_result"), "rax", 32))
    edges = {
        "zero": bool(by_label.get("provenance_sdk_init_zero_route")),
        "nonzero": bool(by_label.get("provenance_sdk_init_nonzero_route")),
    }
    require(sdk_status is not None and sum(edges.values()) == 1 and
            edges["zero"] == (sdk_status == 0), "Old SDK status/edge not reconciled")
    guards = guard_sequence(blocks, file_size)
    accepts = len(by_label.get("provdeep_payload_accept", []))
    rejects = len(by_label.get("provdeep_payload_reject", []))
    require(len(guards) == accepts + rejects,
            "Old repeated payload guard outcomes do not reconcile")
    return {
        "sdk_status": sdk_status,
        "sdk_edge": next(edge for edge, reached in edges.items() if reached),
        "retrieval_status": signed32(register(first("provdeep_retrieval_return"), "eax", 32)),
        "header_sequence": header_sequence(blocks),
        "payload_guard_sequence": guards,
        "payload_accept_hits": accepts,
        "payload_reject_hits": rejects,
        "xlbox_read_hits": len(by_label.get("provdeep_xlbox_read", [])),
    }


def new_branch(blocks: list[tuple[str, str]], file_size: int) -> dict[str, Any]:
    by_label: dict[str, list[str]] = {}
    for label, body in blocks:
        by_label.setdefault(label, []).append(body)
    first = lambda label: by_label.get(label, [""])[0]
    status = signed32(register(first("provenance_bridge_result"), "rax", 32))
    require(status is not None, "New bridge status not sampled")
    edges = {
        "status_one": bool(by_label.get("provenance_bridge_status_one_route")),
        "parse": bool(by_label.get("provenance_bridge_parse_route")),
        "other_positive": bool(by_label.get("provenance_bridge_other_status_route")),
        "negative_error": bool(by_label.get("provenance_bridge_negative_status_route")),
    }
    expected = "parse" if status == 0 else "status_one" if status == 1 else \
        "negative_error" if status < 0 else "other_positive"
    require(sum(edges.values()) == 1 and edges[expected], "New bridge status/edge not reconciled")
    raw = register(first("provdeep_raw_return"), "rax") if expected == "parse" else None
    return {
        "bridge_status": status,
        "bridge_edge": expected,
        "c2pa_reader_export_hit": bool(by_label.get("provdeep_c2pa_reader")),
        "c2pa_raw_export_hit": bool(by_label.get("provdeep_c2pa_raw")),
        "raw_return_bytes": safe_span(raw, file_size),
        "helper_box_entry_hit": bool(by_label.get("provenance_box_bounds")),
        "helper_box_overrun_check_hit": bool(by_label.get("provdeep_box_size_overrun")),
    }


def first_difference(control: list[Any], candidate: list[Any]) -> dict[str, Any] | None:
    for index in range(max(len(control), len(candidate))):
        base = control[index] if index < len(control) else None
        current = candidate[index] if index < len(candidate) else None
        if base != current:
            return {"ordinal": index + 1, "control": base, "candidate": current}
    return None


def load_trial(label: str, build: str, pins: dict[str, dict[str, Any]],
               stress_manifest_sha: str, frozen_manifest_sha: str) -> dict[str, Any]:
    require(TRIAL_RE.fullmatch(label) is not None, "Unsafe trial label")
    trial_root = ROOT / "lab/results" / label
    stage = load_json(ROOT / "lab/isolation/generated" / f"{label}.provenance-stress-stage.json")
    require(stage.get("schema") == "paint-ab-provenance-stress-stage-v1" and
            stage.get("build") == build and stage.get("trial_label") == label,
            "Stress stage identity differs")
    selected = stage.get("selected_cases") or []
    require(2 <= len(selected) <= 9 and selected[0] == CONTROL and
            len(selected) == len(set(selected)) and set(selected) <= set(pins) and
            stage.get("stress_case_count") == len(selected) - 1 and
            stage.get("positive_control") == CONTROL,
            "Stress stage selected-case set differs")
    require(stage.get("fixture_manifest_sha256") == stress_manifest_sha,
            "Stress fixture manifest digest differs")
    require(SHA_RE.fullmatch(str(stage.get("profile_sha256", ""))) is not None and
            SHA_RE.fullmatch(str(stage.get("staged_followup_manifest_sha256", ""))) is not None,
            "Stress stage profile/guest manifest digest missing")
    batches = list(trial_root.glob(f"focus-batch-{build}-*.json"))
    require(len(batches) == 1, "Expected one focused batch")
    batch = load_json(batches[0])
    require(batch.get("schema") == "paint-ab-focus-batch-v1" and
            batch.get("build") == build and batch.get("status") == "complete" and
            batch.get("selected_cases") == selected,
            "Focused batch did not complete the staged case order")
    validate_bootstrap(trial_root, batch, build)
    teardown = load_json(trial_root / "teardown-result.json")
    require(teardown.get("state") == "closed" and
            teardown.get("sandbox_process_count_after") == 0,
            "Sandbox teardown not verified")
    rows = []
    profile_manifests: set[str] = set()
    for case_id in selected:
        files = list((trial_root / "focus" / build / case_id).glob("*/result.json"))
        require(len(files) == 1, f"Expected one result for {case_id}")
        result_path = files[0]
        result = load_json(result_path)
        batch_rows = [item for item in batch["cases"] if item.get("case_id") == case_id]
        require(len(batch_rows) == 1, f"Batch row missing/duplicated: {case_id}")
        batch_row = batch_rows[0]
        require(batch_row.get("status") == "complete" and
                batch_row.get("result_sha256") == sha256(result_path) and
                batch_row.get("timed_out") is False and
                batch_row.get("child_exited_verified") is True and
                batch_row.get("process_exit_code") in (None, 0),
                f"Focused child failed or digest differs: {case_id}")
        require(result.get("schema") == "paint-ab-focused-cdb-v1" and
                result.get("status") == "complete" and
                result.get("build") == build and result.get("case_id") == case_id,
                f"Guest result failed: {case_id}")
        require(result.get("installed_package", {}).get("version") == VERSIONS[build] and
                result.get("installed_exe_sha256") == EXE_SHA256[build],
                f"Installed signed Paint differs: {case_id}")
        expected = pins[case_id]
        source = "frozen" if case_id == CONTROL else "followup"
        manifest_sha = frozen_manifest_sha if case_id == CONTROL else stage["staged_followup_manifest_sha256"]
        require(result.get("fixture_source") == source and
                result.get("fixture", {}).get("file") == expected["file"] and
                result.get("fixture", {}).get("sha256") == expected["sha256"] and
                result.get("fixture_manifest_sha256") == manifest_sha,
                f"Guest input or manifest differs: {case_id}")
        require(result.get("trace_script_sha256") == stage["profile_sha256"] and
                SHA_RE.fullmatch(str(result.get("trace_manifest_sha256", ""))) is not None,
                f"CDB script or manifest digest differs: {case_id}")
        profile_manifests.add(result["trace_manifest_sha256"])
        if stage.get("profile_manifest_sha256") is not None:
            require(result["trace_manifest_sha256"] == stage["profile_manifest_sha256"],
                    f"CDB manifest digest differs from stage: {case_id}")
        installed = {entry["module"]: entry["sha256"] for entry in result.get("installed_module_checks", [])}
        require(all(installed.get(name) == digest for name, digest in PINNED[build].items()),
                f"Installed provenance module digest differs: {case_id}")
        loaded = result.get("loaded_module_checks") or []
        require(loaded and all(entry.get("matches_signed_package") is True for entry in loaded) and
                not result.get("loaded_module_error"),
                f"Loaded module identity differs: {case_id}")
        pid = result.get("blank_pid")
        require(isinstance(pid, int) and pid > 0 and
                result.get("cdb_initial_pid") == pid and
                result.get("file_open_launch_pid") == pid and
                result.get("debugger_ready") is True and
                result.get("file_open_entry_method") == "win32_file_name_control_1148" and
                result.get("file_open_filename_value_verified") is True,
                f"Same-PID debugger or exact filename delivery not verified: {case_id}")
        cleanup = result.get("cleanup") or {}
        health = result.get("post_close_health") or {}
        require(pid in (cleanup.get("close_requested_pids") or []) and
                not cleanup.get("forced_pids") and not cleanup.get("remaining_pids") and
                not health.get("remaining_pids") and not health.get("wer_events") and
                health.get("new_dump_count") == 0 and not health.get("error"),
                f"Clean Paint close or post-close health not verified: {case_id}")
        log_path = result_path.with_name("cdb.log")
        require(log_path.is_file() and log_path.stat().st_size <= MAX_LOG_BYTES,
                f"Missing or oversized private CDB log: {case_id}")
        log_bytes = log_path.read_bytes()
        blocks, recovered = marker_blocks(log_bytes.decode("utf-8-sig", errors="replace"), build, pid)
        recorded = (result.get("markers_before_open") or []) + (result.get("markers_after_open") or [])
        require(len(blocks) <= MAX_MARKERS and [item[0] for item in blocks] == recorded and
                recovered == len(result.get("pid_warning_recovered") or []),
                f"CDB marker order or PID recovery differs: {case_id}")
        after = blocks[len(result.get("markers_before_open") or []):]
        labels = [item[0] for item in after]
        require({"image_image_open", "image_decoder", "flow_decoder_return",
                 "flow_provenance_call", "provenance_manifest_entry",
                 "flow_handoff_success_route"} <= set(labels),
                f"Accepted image/provenance route not observed: {case_id}")
        file_size = expected["size" if case_id == CONTROL else "bytes"]
        rows.append({
            "case": case_id,
            "fixture_sha256": expected["sha256"],
            "fixture_bytes": file_size,
            "private_result_sha256": sha256(result_path),
            "private_cdb_sha256": hashlib.sha256(log_bytes).hexdigest(),
            "exact_filename_verified": True,
            "signed_modules_verified": True,
            "same_process_route_verified": True,
            "normal_paint_close": True,
            "post_close_wer_events": 0,
            "post_close_new_dumps": 0,
            "marker_count": len(after),
            "marker_order": labels,
            "branch": old_branch(after, file_size) if build == "old" else new_branch(after, file_size),
        })
    require(len(profile_manifests) == 1, "Cases used different CDB manifest bytes")
    return {
        "build": build, "trial": label,
        "version": VERSIONS[build],
        "profile_sha256": stage["profile_sha256"],
        "profile_manifest_sha256": next(iter(profile_manifests)),
        "positive_control": CONTROL,
        "normal_guest_shutdown": True,
        "zero_sandbox_processes": True,
        "cases": rows,
    }


def compare(old: dict[str, Any], new: dict[str, Any] | None) -> dict[str, Any]:
    control = old["cases"][0]
    require(control["case"] == CONTROL, "Old positive control is not first")
    require(control["branch"]["sdk_status"] == 0 and
            control["branch"]["sdk_edge"] == "zero",
            "Old positive control failed provenance parsing")
    base_headers = control["branch"]["header_sequence"]
    base_guards = control["branch"]["payload_guard_sequence"]
    for row in old["cases"]:
        row["branch"]["first_header_divergence_from_control"] = first_difference(
            base_headers, row["branch"]["header_sequence"]
        )
        row["branch"]["first_payload_divergence_from_control"] = first_difference(
            base_guards, row["branch"]["payload_guard_sequence"]
        )
    if new is not None:
        require(new["cases"][0]["case"] == CONTROL and
                new["cases"][0]["branch"]["bridge_status"] == 0 and
                new["cases"][0]["branch"]["bridge_edge"] == "parse" and
                new["cases"][0]["branch"]["c2pa_reader_export_hit"] and
                new["cases"][0]["branch"]["c2pa_raw_export_hit"],
                "New positive control failed provenance reader/raw route")
        require([r["case"] for r in old["cases"]] == [r["case"] for r in new["cases"]],
                "Old/new selected cases or order differ")
        for a, b in zip(old["cases"], new["cases"]):
            require(a["fixture_sha256"] == b["fixture_sha256"] and
                    a["fixture_bytes"] == b["fixture_bytes"],
                    f"Paired fixture identity differs: {a['case']}")
    return {
        "schema": "paint-ab-provenance-stress-public-v1",
        "paired": new is not None,
        "old": old,
        "new": new,
        "claim_limit": (
            "The old repeated checks show parser route and operands, not an allocation extent. "
            "A new bridge result may occur before helper parsing. No out-of-bounds read or "
            "CVE-2026-83844 fix location follows from a status or checkpoint alone."
        ),
    }


def markdown(result: dict[str, Any]) -> str:
    old = result["old"]
    new = result.get("new")
    indexed = {row["case"]: row for row in new["cases"]} if new else {}
    lines = [
        "# Bounded JUMBF stress branch comparison",
        "",
        "This table is generated from complete focused guest records. It contains no",
        "process IDs, addresses, raw CDB memory, local paths, or screenshots.",
        ("Both signed builds completed the same fixture order with exact filename "
         "delivery and normal closure." if new else
         "The pair remains **pending** until both signed builds complete the same "
         "fixture order with exact filename delivery and normal closure."),
        "",
        "| Case | Old SDK status | Old header / payload guards / reject hits | First old divergence from source | New bridge status / edge | New raw/helper reach |",
        "| --- | ---: | --- | --- | --- | --- |",
    ]
    for row in old["cases"]:
        case = row["case"]
        branch = row["branch"]
        old_hits = (f"{len(branch['header_sequence'])} / "
                    f"{len(branch['payload_guard_sequence'])} / "
                    f"{branch['payload_reject_hits']}")
        header_diff = branch["first_header_divergence_from_control"]
        guard_diff = branch["first_payload_divergence_from_control"]
        divergence = (f"header #{header_diff['ordinal']}" if header_diff else "header same") + \
                     "; " + (f"guard #{guard_diff['ordinal']}" if guard_diff else "guard same")
        if case in indexed:
            other = indexed[case]["branch"]
            bridge_status = other["bridge_status"]
            status_text = (str(bridge_status) if bridge_status >= 0 else
                           f"{bridge_status} (0x{bridge_status & 0xFFFFFFFF:08X})")
            status = f"{status_text} / {other['bridge_edge']}"
            raw_bytes = (other["raw_return_bytes"] if other["c2pa_raw_export_hit"] else
                         "not reached")
            reach = (f"reader={int(other['c2pa_reader_export_hit'])}, "
                     f"raw={int(other['c2pa_raw_export_hit'])}, "
                     f"raw bytes={raw_bytes}, "
                     f"helper={int(other['helper_box_entry_hit'])}")
        else:
            status, reach = "pending", "pending"
        lines.append(f"| `{case}` | {branch['sdk_status']} | {old_hits} | "
                     f"{divergence} | {status} | {reach} |")
    lines += [
        "",
        "The divergence ordinal is a change in **recorded checkpoint order or",
        "bounded operands**, not an instruction-level reject location. A repeated",
        "payload reject hit identifies the named old code site, but the allocation",
        "extent and effective read address still need measurement. The new helper",
        "parses backend-returned bytes only on its reached route. The accompanying",
        "JSON retains the complete address-free marker and guard sequences.",
        "",
        "## Record and input integrity",
        "",
        f"Old guest `{old['trial']}`: Paint {old['version']}, profile SHA-256 `{old['profile_sha256']}`.",
    ]
    if new:
        lines += [
            f"New guest `{new['trial']}`: Paint {new['version']}, profile SHA-256 `{new['profile_sha256']}`.",
            "Each focused record passed signed-module digest, exact input filename and",
            "fixture digest, same-process route, marker order, normal Paint closure,",
            "and post-close WER/dump checks. Each guest closed with zero Sandbox",
            "processes remaining. The source carrier parsed on both builds.",
        ]
    else:
        lines += ["The new guest remains pending."]
    lines += [
        "",
        "| Case | Input bytes | SHA-256 |",
        "| --- | ---: | --- |",
    ]
    for row in old["cases"]:
        lines.append(f"| `{row['case']}` | {row['fixture_bytes']} | `{row['fixture_sha256']}` |")
    lines += [
        "",
        "## Claim boundary",
        "",
    ]
    if new and {
        "stress_outer_lbox_u32_max", "stress_depth2_wrap_late_jumb"
    }.issubset({row["case"] for row in old["cases"]}):
        lines += [
            "The outer 32-bit maximum LBox yielded old SDK status 34 while the new",
            "backend returned raw bytes and reached its helper. The extra-depth",
            "case yielded old SDK status 0 while the new reader returned",
            "`0x80004005` before raw retrieval. These are backend behavior differences.",
            "",
        ]
    elif new:
        lines += [
            "The table records each backend's own return status and reached stage.",
            "Their status codes are not interchangeable across the old SDK and new",
            "C2PA reader, and a stage difference alone does not locate a safety fix.",
            "",
        ]
    lines += [
        "The old repeated checks expose parser traversal and bounded operands, but",
        "the effective read address and its allocation extent were not captured",
        "for these cases. A new backend error can occur before the returned-byte",
        "helper runs. These observations do not establish an out-of-bounds read,",
        "the CVE trigger, or the patch location.",
        "",
    ]
    return "\n".join(lines)


def main() -> None:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--old-trial", required=True)
    parser.add_argument("--new-trial")
    parser.add_argument("--format", choices=("json", "markdown"), default="json")
    parser.add_argument("--output", type=Path, required=True)
    args = parser.parse_args()
    pins, stress_sha, frozen_sha = stress_pins()
    old = load_trial(args.old_trial, "old", pins, stress_sha, frozen_sha)
    new = load_trial(args.new_trial, "new", pins, stress_sha, frozen_sha) if args.new_trial else None
    result = compare(old, new)
    payload = (json.dumps(result, indent=2) + "\n") if args.format == "json" else markdown(result)
    args.output.parent.mkdir(parents=True, exist_ok=True)
    args.output.write_text(payload, encoding="utf-8")
    print(f"Exported {len(old['cases'])} old" +
          (f" and {len(new['cases'])} new" if new else "") +
          f" stress rows to {args.output}")


if __name__ == "__main__":
    main()