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

Python · 18,656 bytes
#!/usr/bin/env python3
"""Export a strict, address-free old/new APP11 wrap follow-up comparison.

Only completed local guest records are read. This never opens Paint, starts a
guest, or publishes debugger addresses, memory bytes, PIDs, or file paths.
"""

from __future__ import annotations

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

from build_provenance_app11_wrap_trace import CORPUS, CORPUS_SHA256, EXPECTED
from build_provenance_reopen_trace import SIGNED_HASHES
from export_provenance_sdk_matrix import (
    LAB, MARKER_RE, ROOT, VERSIONS, bounded_register_samples, digest,
    read_json, require, require_clean_guest, require_normal_close,
    section_value,
)


CASE_NAMES = tuple(EXPECTED)
CASE_IDS = tuple(f"prov_wrap_{name}" for name in CASE_NAMES)
STAGE_SCHEMA = "paint-provenance-app11-wrap-stage-v1"
EXPORT_SCHEMA = "paint-provenance-app11-wrap-paired-v1"
LABEL_RE = re.compile(r"^[a-z0-9][a-z0-9-]{0,39}$")


def verified_corpus() -> dict[str, Any]:
    require(CORPUS.is_file() and digest(CORPUS) == CORPUS_SHA256,
            "Pinned APP11 wrap manifest differs")
    manifest = read_json(CORPUS)
    rows = manifest.get("cases", [])
    require(manifest.get("schema") == "paint-provenance-app11-wrap-followup-v1" and
            [row.get("id") for row in rows] == list(CASE_NAMES),
            "APP11 wrap manifest schema or case order differs")
    for row in rows:
        expected = EXPECTED[row["id"]]
        path = CORPUS.parent / row["file"]
        require(row.get("sha256") == expected and
                row.get("paint_outcome") == "not_tested" and
                path.is_file() and path.stat().st_size == row["bytes"] and
                digest(path) == expected,
                f"Pinned APP11 wrap fixture differs: {row['id']}")
    return manifest


def _one_small(log: str, marker: str, register: str,
               maximum: int) -> int:
    samples = bounded_register_samples(log, marker, (register,), maximum)
    require(len(samples) == 1, f"Missing or repeated {marker} scalar")
    return samples[0][register]


def _one_seek_scalar(log: str, marker: str, register: str,
                     maximum: int) -> int:
    """Read one seek scalar, including CDB's PID/register same-line form.

    The conditional CDB callback emits the register immediately after its
    PID .printf. CDB can concatenate both outputs on one line. Accept only
    that exact marker-scoped form or the ordinary standalone register line.
    """
    hits = list(MARKER_RE.finditer(log))
    selected = [index for index, hit in enumerate(hits)
                if hit.group(1) == marker]
    require(len(selected) == 1, f"Missing or repeated {marker} seek marker")
    index = selected[0]
    area = log[hits[index].end():
               hits[index + 1].start() if index + 1 < len(hits) else len(log)]
    plain = re.findall(rf"(?mi)^{re.escape(register)}=([0-9a-f]+)\r?$", area)
    combined = re.findall(
        rf"(?mi)^PAINT_TRACE_HIT_PID={re.escape(marker)}:([1-9][0-9]*)"
        rf"[ \t]+{re.escape(register)}=([0-9a-f]+)\r?$", area)
    values = plain + [value for _, value in combined]
    require(len(values) == 1, f"Missing or ambiguous {register} at {marker}")
    value = int(values[0], 16)
    require(0 <= value <= maximum,
            f"Non-length/status seek scalar at {marker}")
    return value


def observe_route(build: str, name: str, markers: list[str],
                  log: str) -> dict[str, Any]:
    """Retain only finite lengths, status, and named branch reachability."""
    present = set(markers)
    if build == "old":
        required = {
            "uuid_jumd_declared_gate", "uuid_read_call", "uuid_read_return",
            "uuid_segment_before", "uuid_segment_after",
            "uuid_uuid_first_compare", "uuid_uuid_second_compare",
            "provenance_sdk_init_result",
        }
        require(required <= present, f"Old {name} UUID/status checkpoints incomplete")
        count = _one_small(log, "uuid_segment_after", "ax", 0xFFFF)
        read_count = _one_small(log, "uuid_read_return", "rax", 16)
        require(read_count == 16 and "uuid_reader_copy" in present,
                f"Old {name} 16-byte reader copy not established")
        require(markers.index("uuid_read_call") <
                markers.index("uuid_reader_copy") <
                markers.index("uuid_read_return"),
                f"Old {name} reader-copy marker is outside the UUID call")
        if name == "split_before_uuid_end":
            require(count == 0xFFFF and
                    {"uuid_uuid_mismatch", "wrap_skip_seek_call",
                     "wrap_skip_seek_result"} <= present and
                    markers.index("uuid_uuid_mismatch") <
                    markers.index("wrap_skip_seek_call") <
                    markers.index("wrap_skip_seek_result") and
                    "uuid_copy_decision" not in present,
                    "Old before-UUID split did not take measured wrap/mismatch route")
            seek_request = _one_seek_scalar(
                log, "wrap_skip_seek_call", "rdx", 0xFFFF)
            seek_status = _one_seek_scalar(
                log, "wrap_skip_seek_result", "eax", 0xFF)
            require(seek_request == 0xFFFF,
                    "Old wrapped skip operand differs from local count")
        else:
            require("uuid_copy_decision" in present and
                    "oldcont_first_copy" in present and
                    "wrap_first_copy_return" in present and
                    "wrap_skip_seek_call" not in present,
                    f"Old {name} accepted-first-record copy route incomplete")
            if "uuid_uuid_mismatch" in present:
                require(markers.index("uuid_copy_decision") <
                        markers.index("uuid_uuid_mismatch"),
                        f"Old {name} UUID mismatch preceded accepted first copy")
            seek_request = seek_status = None
        if "oldcont_first_copy" in present:
            first_request = _one_small(log, "oldcont_first_copy", "r9", 0xFFFF)
            first_return = _one_small(log, "wrap_first_copy_return", "rax", 0xFFFF)
            require(first_request == first_return,
                    f"Old {name} first copy returned a short count")
        else:
            first_request = first_return = None
        if name.startswith("split_after_uuid_end"):
            require(count == 0 and
                    {"oldcont_instance_compare", "oldcont_sequence_compare",
                     "oldcont_continuation_capacity", "oldcont_continuation_copy",
                     "oldcont_continuation_copy_return", "oldcont_reported_output_length"}
                    <= present,
                    f"Old {name} continuation route incomplete")
            continuation_request = _one_small(
                log, "oldcont_continuation_copy", "r9", 0xFFFF)
            continuation_return = _one_small(
                log, "oldcont_continuation_copy_return", "rax", 0xFFFF)
            require(continuation_request == continuation_return,
                    f"Old {name} continuation reader returned a short count")
        else:
            continuation_request = continuation_return = None
        if name == "control_unsplit":
            require(section_value(log, "provenance_sdk_init_result", "rax") ==
                    "0x00000000", "Old unchanged carrier did not reach success status")
        return {
            "status_hex": section_value(log, "provenance_sdk_init_result", "rax"),
            "uuid_read_count": read_count,
            "segment_count_after_uuid": count,
            "uuid_mismatch_before_first_copy":
                name == "split_before_uuid_end",
            "wrapped_seek_request": seek_request,
            "wrapped_seek_status": seek_status,
            "first_copy": "oldcont_first_copy" in present,
            "first_copy_request": first_request,
            "first_copy_return": first_return,
            "continuation_request": continuation_request,
            "continuation_return": continuation_return,
            "reported_output_length_hit": "oldcont_reported_output_length" in present,
        }
    require(build == "new", "Unknown Paint build")
    required = {
        "rustjpeg_first_length", "rustjpeg_c2pa_first_byte",
        "rustjpeg_c2pa_accepted", "rustjpeg_first_append",
        "rustjpeg_assembled_result", "newdesc_c_reader",
        "newdesc_reader_ffi_return", "newdesc_backend_return",
    }
    require(required <= present, f"New {name} signed first-record route incomplete")
    if name != "control_unsplit":
        require({"rustjpeg_continuation_append", "rustjpeg_continuation_copy"}
                <= present, f"New {name} signed continuation route incomplete")
    if name == "control_unsplit":
        require("newdesc_c_raw" in present and
                section_value(log, "newdesc_backend_return", "ebx") ==
                "0x00000000",
                "New unchanged carrier did not reach raw success route")
    return {
        "status_hex": section_value(log, "newdesc_backend_return", "ebx"),
        "first_record_accepted": True,
        "continuation_append": "rustjpeg_continuation_append" in present,
        "continuation_copy": "rustjpeg_continuation_copy" in present,
        "assembled_result_hit": True,
        "raw_export": "newdesc_c_raw" in present,
        "reader_null": "newdesc_reader_null" in present,
    }


def validate_case_record(build: str, name: str,
                         summary_case: dict[str, Any], result: dict[str, Any],
                         log: str, stage: dict[str, Any],
                         profile_manifest_sha: str,
                         module_hashes: dict[str, str]) -> dict[str, Any]:
    expected_id = f"prov_wrap_{name}"
    expected_hash = EXPECTED[name]
    require(summary_case.get("case_id") == expected_id and
            summary_case.get("second_case_id") is None and
            summary_case.get("status") == "complete" and
            summary_case.get("child_exited_verified") is True and
            summary_case.get("timed_out") is False and
            summary_case.get("process_exit_code") == 0 and
            summary_case.get("error") is None,
            f"{build}/{name} focused case did not finish normally")
    require(result.get("schema") == "paint-ab-focused-cdb-v1" and
            result.get("build") == build and
            result.get("case_id") == expected_id and
            result.get("second_case_id") is None and
            result.get("status") == "complete" and
            result.get("error") is None and
            result.get("file_open_filename_value_verified") is True and
            result.get("fixture", {}).get("sha256") == expected_hash and
            result.get("trace_script_sha256") == stage["profile_sha256"] and
            result.get("trace_manifest_sha256") == profile_manifest_sha and
            result.get("fixture_source") == "followup" and
            result.get("fixture_manifest_sha256") ==
            stage.get("staged_manifest_sha256") and
            result.get("installed_package", {}).get("version") == VERSIONS[build] and
            result.get("installed_exe_sha256") == module_hashes["mspaint.exe"],
            f"{build}/{name} file, profile, or signed package differs")
    loaded = result.get("loaded_module_checks", [])
    require({row.get("module") for row in loaded} == set(module_hashes) and
            len(loaded) == len(module_hashes) and
            all(row.get("matches_signed_package") is True and
                row.get("sha256") == module_hashes[row.get("module")]
                for row in loaded),
            f"{build}/{name} loaded module hashes differ")
    paint_pid = result.get("blank_pid")
    markers = result.get("markers_after_open", [])
    before = result.get("markers_before_open", [])
    pid_records = result.get("marker_pid_records", [])
    require(type(paint_pid) is int and paint_pid > 0 and
            result.get("file_open_launch_pid") == paint_pid and
            result.get("cdb_initial_pid") == paint_pid and
            summary_case.get("blank_pid") == paint_pid and
            summary_case.get("file_open_launch_pid") == paint_pid and
            isinstance(markers, list) and isinstance(before, list) and
            isinstance(pid_records, list) and
            [row.get("marker") for row in pid_records] == before + markers and
            all(row.get("pid") == paint_pid for row in pid_records) and
            markers[:2] == ["image_image_open", "image_decoder"] and
            "flow_handoff_success_route" in markers and
            [match.group(1) for match in MARKER_RE.finditer(log)] == before + markers,
            f"{build}/{name} file-open/debugger marker identity differs")
    require_normal_close(result.get("cleanup", {}),
                         result.get("post_close_health", {}),
                         paint_pid, build, name)
    return {"case_id": name, "fixture_sha256": expected_hash,
            "route": observe_route(build, name, markers, log)}


def verify_trial(build: str, label: str, manifest: dict[str, Any]) -> dict[str, Any]:
    require(LABEL_RE.fullmatch(label) is not None, "Unsafe trial label")
    stage = read_json(LAB / "isolation/generated" /
                      f"{label}.provenance-app11-wrap-stage.json")
    require(stage.get("schema") == STAGE_SCHEMA and
            stage.get("build") == build and stage.get("trial_label") == label and
            stage.get("selected_cases") == list(CASE_IDS) and
            stage.get("per_case_timeout_seconds") == 220 and
            stage.get("fixture_manifest_sha256") == CORPUS_SHA256,
            f"{build} APP11 wrap staging differs")
    profile_path = LAB / "output/provenance-app11-wrap" / f"{build}.auto.cdb.txt"
    meta_path = Path(str(profile_path) + ".json")
    profile = read_json(meta_path)
    require(digest(profile_path) == stage.get("profile_sha256") and
            digest(meta_path) == stage.get("profile_manifest_sha256") and
            profile.get("profile") == build and
            profile.get("version") == VERSIONS[build] and
            profile.get("diagnostic_mode") == "app11-wrap-followup" and
            profile.get("auto_continue") is True and
            profile.get("continue_process_exit") is True and
            profile.get("fixture_manifest", {}).get("sha256") == CORPUS_SHA256 and
            profile["fixture_manifest"].get("fixture_sha256") == EXPECTED and
            len(profile.get("checkpoints", [])) == 42,
            f"{build} signed profile or pinned corpus differs")
    if build == "old":
        require(profile.get("conditional_wrapped_seek") == {
            "call_rva": "0xC96B9", "return_rva": "0xC96BF",
            "operand": 65535, "early_seek_excluded": 14,
            "return_paired_with_debugger_local_flag": True,
        }, "Old wrapped seek profile did not exclude the early 14-byte skip")
    module_hashes = {name: row["sha256"] for name, row in profile["modules"].items()}
    require(module_hashes == SIGNED_HASHES[build] and
            all(digest(ROOT / row["package_path"]) == row["sha256"]
                for row in profile["modules"].values()),
            f"{build} signed module set differs")
    require(digest(LAB / "isolation/generated" / f"{label}.wsb") ==
            stage.get("wsb_sha256") and
            re.fullmatch(r"[0-9a-f]{64}",
                         stage.get("staged_manifest_sha256", "")) is not None,
            f"{build} staged manifest receipt or launch configuration differs")
    root = LAB / "results" / label
    batches = list(root.glob("focus-batch-*.json"))
    shutdowns = list(root.glob("focus-shutdown-*.json"))
    require(len(batches) == len(shutdowns) == 1,
            f"{build} batch/shutdown receipt missing or ambiguous")
    summary = read_json(batches[0])
    shutdown = read_json(shutdowns[0])
    teardown = read_json(root / "teardown-result.json")
    require_clean_guest(summary, shutdown, teardown, build, label, list(CASE_IDS))
    require(summary.get("sequence_pairs") is None,
            f"{build} expected fresh Paint process per JPEG")
    rows = []
    pids = []
    for name, summary_case in zip(CASE_NAMES, summary["cases"]):
        case_root = root / "focus" / build / f"prov_wrap_{name}"
        results = list(case_root.glob("*/result.json"))
        require(len(results) == 1,
                f"{build}/{name} focused result missing or ambiguous")
        result_path = results[0]
        log_path = result_path.with_name("cdb.log")
        require(log_path.is_file() and
                digest(result_path) == summary_case.get("result_sha256"),
                f"{build}/{name} private result or log differs")
        result = read_json(result_path)
        row = validate_case_record(
            build, name, summary_case, result,
            log_path.read_text(encoding="utf-8", errors="replace"),
            stage, digest(meta_path), module_hashes)
        pids.append(result["blank_pid"])
        rows.append(row)
    require(len(set(pids)) == len(CASE_NAMES),
            f"{build} did not use a fresh Paint process for each JPEG")
    return {
        "version": VERSIONS[build],
        "signed_module_sha256": module_hashes,
        "shutdown_and_teardown_verified": True,
        "cases": rows,
    }


def export(old_label: str, new_label: str) -> dict[str, Any]:
    manifest = verified_corpus()
    old = verify_trial("old", old_label, manifest)
    new = verify_trial("new", new_label, manifest)
    return {
        "schema": EXPORT_SCHEMA,
        "source_sha256": manifest["source_sha256"],
        "corpus_manifest_sha256": CORPUS_SHA256,
        "case_order": list(CASE_NAMES),
        "claim_boundary": (
            "This record establishes only the sampled signed routes, scalar counts, "
            "statuses, and clean guest lifecycle. It does not establish an allocation "
            "out-of-bounds read, disclosure, or the CVE patch location."
        ),
        "old": old, "new": new,
    }


def main() -> None:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--old-label", required=True)
    parser.add_argument("--new-label", required=True)
    parser.add_argument("--output", type=Path, required=True)
    args = parser.parse_args()
    result = export(args.old_label, args.new_label)
    args.output.parent.mkdir(parents=True, exist_ok=True)
    args.output.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")
    print("Verified four cases in each signed build; wrote address-free paired record")


if __name__ == "__main__":
    main()