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_e_unknown_r4_heap.py

Python · 11,243 bytes
#!/usr/bin/env python3
"""Export address-free r4 heap extent and selected generic-reject geometry.

This companion verifies the one-case published decision, its immutable stage,
pinned fixture, private result/log hashes, and the live heap report. It never
publishes process addresses, memory bytes, a PID, or a local path.
"""

from __future__ import annotations

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

from review_provenance_e_header_heap import review_header_copy


ROOT = Path(__file__).resolve().parents[2]
LAB = ROOT / "lab"
TRIAL = "new-e-unknown-r4"
CASE = "child_unknown_parent_plus1"
FOCUS = "sdk_child_unknown_parent_plus1"
DECISION = LAB / "evidence" / "provenance-e-unknown-r4.json"
OUTPUT = LAB / "evidence" / "provenance-e-unknown-r4-heap.json"
MARKER = re.compile(r"(?m)^PAINT_TRACE_HIT=(echild_[a-z0-9_]+)\r?$")
REQUIRED = (
    "selected_header_call", "unknown_payload_call", "generic_read_entry",
    "generic_overflow_add", "generic_carry_branch", "generic_end_compare",
    "generic_end_branch", "generic_reject_entry",
    "generic_reject_result_write", "generic_common_return",
    "parent_result_return",
)


def _require(value: bool, reason: str) -> None:
    if not value:
        raise ValueError(reason)


def _digest(path: Path) -> str:
    return hashlib.sha256(path.read_bytes()).hexdigest()


def _json(path: Path) -> dict[str, object]:
    value = json.loads(path.read_text(encoding="utf-8-sig"))
    _require(isinstance(value, dict), "Expected JSON object")
    return value


def _value(log: str, label: str, field: str) -> int:
    expression = (rf"PAINT_ECHILD_VALUE=echild_{re.escape(label)}\."
                  rf"{re.escape(field)}:([0-9a-fA-F`]+)")
    matches = re.findall(expression, log)
    _require(len(matches) == 1, f"Missing or ambiguous {label}.{field}")
    return int(matches[0].replace("`", ""), 16)


def reduce_generic(log: str, user_extent: int, module_base: int) -> dict[str, object]:
    """Bind one same-reader generic request to its rejected signed route."""
    markers = [item.group(1).removeprefix("echild_")
               for item in MARKER.finditer(log)]
    _require(all(markers.count(name) == 1 for name in REQUIRED),
             "Required generic marker missing or repeated")
    positions = [markers.index(name) for name in REQUIRED]
    _require(positions == sorted(positions), "Generic marker order differs")
    _require("generic_in_bounds_entry" not in markers and
             "generic_small_copy" not in markers,
             "Success or small-copy checkpoint unexpectedly reached")

    parent_reader = _value(log, "selected_header_call", "reader")
    parent_base = _value(log, "selected_header_call", "base")
    parent_length = _value(log, "selected_header_call", "length")
    payload_reader = _value(log, "unknown_payload_call", "reader")
    payload_request = _value(log, "unknown_payload_call", "requested")
    payload_cursor = _value(log, "unknown_payload_call", "cursor")
    entry_reader = _value(log, "generic_read_entry", "reader")
    entry_request = _value(log, "generic_read_entry", "requested")
    entry_return = _value(log, "generic_read_entry", "return")
    end = _value(log, "generic_end_compare", "end")
    compare_length = _value(log, "generic_end_compare", "reader_length")
    compare_cursor = _value(log, "generic_end_compare", "cursor")
    compare_request = _value(log, "generic_end_compare", "requested")
    compare_base = _value(log, "generic_end_compare", "reader_base")
    branch_end = _value(log, "generic_end_branch", "end")
    branch_length = _value(log, "generic_end_branch", "reader_length")
    branch_flags = _value(log, "generic_end_branch", "flags")
    carry_flags = _value(log, "generic_carry_branch", "flags")
    reject_end = _value(log, "generic_reject_entry", "end")
    reject_length = _value(log, "generic_reject_entry", "reader_length")
    result_end = _value(log, "generic_reject_result_write", "end")
    result_length = _value(log, "generic_reject_result_write", "reader_length")
    result_field = _value(log, "generic_common_return", "result_field_8")
    return_cursor = _value(log, "generic_common_return", "cursor")
    _require(parent_reader != 0 and parent_base != 0 and
             parent_reader == payload_reader == entry_reader and
             parent_base == compare_base and
             parent_length == compare_length == branch_length ==
             reject_length == result_length == user_extent and
             payload_request == entry_request == compare_request == 50_982 and
             payload_cursor == compare_cursor == return_cursor == 137 and
             end == branch_end == reject_end == result_end ==
             payload_cursor + payload_request == user_extent + 1 and
             entry_return == module_base + 0x4C9F95 and
             (carry_flags & 1) == 0 and (branch_flags & 0x41) == 0 and
             result_field == 30,
             "Selected reader, physical bound, flags, or reject result differs")
    return {
        "selected_reader_same_object": True,
        "generic_reader_base_matches_header_allocation": True,
        "signed_call_return_matches": True,
        "requested_bytes": payload_request,
        "cursor_bytes": payload_cursor,
        "computed_end_bytes": end,
        "backend_user_extent_bytes": user_extent,
        "requested_end_exceeds_user_extent_by_bytes": end - user_extent,
        "add_carry_clear": True,
        "in_bounds_jbe_not_taken": True,
        "reject_entry_and_result_write_reached": True,
        "numeric_result_field_8": result_field,
        "common_return_reached_with_unchanged_cursor": True,
        "success_branch_checkpoint_reached": False,
        "all_read_or_copy_sites_censused": False,
    }


def export() -> dict[str, object]:
    decision = _json(DECISION)
    stage_path = LAB / "isolation" / "generated" / \
        f"{TRIAL}.provenance-e-unknown-r4-stage.json"
    stage = _json(stage_path)
    corpus_path = LAB / "corpus" / "provenance_sdk_child_frontier" / \
        "generated" / "manifest.json"
    corpus = _json(corpus_path)
    source = next((row for row in corpus.get("cases", [])
                   if row.get("id") == CASE), None)
    _require(decision.get("schema") == "paint-provenance-e-unknown-r4-review-v1" and
             decision.get("selected_case_names") == [CASE] and
             decision.get("shutdown_verified") is True and
             stage.get("schema") == "paint-provenance-e-unknown-r4-stage-v1" and
             stage.get("trial_label") == TRIAL and
             stage.get("selected_case_ids") == [CASE] and
             stage.get("selected_focus_ids") == [FOCUS] and
             _digest(stage_path) == decision.get("stage_sha256") and
             stage.get("profile_sha256") == decision.get("profile_sha256") and
             stage.get("profile_manifest_sha256") ==
             decision.get("profile_manifest_sha256") and
             isinstance(source, dict),
             "Published r4 decision, stage, or fixture set differs")
    fixture = corpus_path.parent / source["file"]
    identity = decision["cases"][CASE]
    _require(fixture.is_file() and fixture.stat().st_size == source["bytes"] and
             _digest(fixture) == source["sha256"] == identity["fixture_sha256"],
             "Pinned r4 fixture differs")
    results = list((LAB / "results" / TRIAL / "focus" / "new" /
                    FOCUS).glob("*/result.json"))
    _require(len(results) == 1 and
             _digest(results[0]) == identity["private_result_sha256"],
             "Private r4 result missing or changed")
    result = _json(results[0])
    log_path = results[0].with_name("cdb.log")
    _require(log_path.is_file() and
             _digest(log_path) == identity["private_log_sha256"] and
             result.get("case_id") == FOCUS and
             result.get("status") == "complete" and
             result.get("error") is None and
             result.get("fixture", {}).get("sha256") == source["sha256"] and
             result.get("trace_script_sha256") == decision["profile_sha256"] and
             result.get("trace_manifest_sha256") ==
             decision["profile_manifest_sha256"] and
             result.get("installed_package", {}).get("version") ==
             decision["version"],
             "Private r4 log, profile, fixture, or package differs")
    modules = [row for row in result.get("loaded_module_checks", [])
               if row.get("module") == "c2pa_c.dll"]
    _require(len(modules) == 1 and
             modules[0].get("matches_signed_package") is True and
             modules[0].get("sha256") ==
             decision["signed_module_sha256"]["c2pa_c.dll"],
             "Loaded signed C2PA module identity differs")
    module_base = int(modules[0]["base"], 16)
    log = log_path.read_text(encoding="utf-8-sig", errors="replace")
    heap = review_header_copy(log)
    generic = reduce_generic(log, int(heap["backend_user_extent_bytes"]),
                             module_base)
    published = identity["first_child"]["generic_reject"]
    _require(published["entry_reached"] is True and
             published["reject_entry_reached"] is True and
             published["result_write_instruction_reached"] is True and
             published["common_return_reached"] is True and
             published["in_bounds_checkpoint_reached"] is False and
             published["requested_bytes"] == generic["requested_bytes"] and
             published["computed_end_bytes"] == generic["computed_end_bytes"] and
             published["reader_length_bytes"] ==
             generic["backend_user_extent_bytes"],
             "Public r4 branch and private heap geometry differ")
    return {
        "schema": "paint-provenance-e-unknown-r4-heap-public-v1",
        "trial": TRIAL,
        "decision_sha256": _digest(DECISION),
        "stage_sha256": decision["stage_sha256"],
        "profile_sha256": decision["profile_sha256"],
        "fixture_sha256": source["sha256"],
        "private_log_sha256": identity["private_log_sha256"],
        "header_copy_heap": heap,
        "generic_request": generic,
        "claim_limit": (
            "The one-byte excess was requested and rejected before the selected "
            "success/copy branch. It was not an observed out-of-bounds read. "
            "This is not an all-read census or CVE patch attribution."
        ),
    }


def main() -> None:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--output", type=Path, default=OUTPUT)
    parser.add_argument("--check", action="store_true")
    args = parser.parse_args()
    try:
        encoded = json.dumps(export(), indent=2) + "\n"
        if args.check:
            _require(args.output.read_text(encoding="utf-8") == encoded,
                     "Published r4 heap companion differs")
        else:
            args.output.write_text(encoded, encoding="utf-8")
    except (OSError, ValueError, KeyError, TypeError) as exc:
        raise SystemExit(f"r4 heap companion inconclusive: {exc}") from None
    print("Pinned r4 heap companion verified" if args.check else
          "Wrote address-free r4 heap companion")


if __name__ == "__main__":
    main()