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

Python · 12,007 bytes
#!/usr/bin/env python3
"""Build signed, stage-only Paint traces for second-store and depth probes.

The H1/H2 files are offline route controls. This generator writes ignored
CDB input and an address-free sidecar; it never launches a guest or Paint.
"""

from __future__ import annotations

import argparse
import json
from dataclasses import asdict, replace
from pathlib import Path

import pefile

from build_provenance_new_description_trace import build as build_new_bridge
from build_provenance_c2pa_internal_trace import (
    LEAN_BASE, OPCODES as JPEG_OPCODES, RUST_JPEG,
)
from build_provenance_old_child_trace import CHILD
from build_provenance_old_description_trace import CONTINUATION, SDK_SHA256
from generate_cdb import Checkpoint, POINTS, ROOT, VERSION, executable_rva, render, sha256


CORPUS = ROOT / "lab/corpus/provenance_sdk_remaining_routes/generated/manifest.json"
CORPUS_SHA256 = "b9c559d4a30b1e51649685f5f57cd9a8c5cfbbdc5e03042a285314dd0f57ffee"
CORPUS_SCHEMA = "paint-provenance-sdk-remaining-routes-v1"
OLD_MODULE = "provenancesdk.dll"
NEW_MODULE = "c2pa_c.dll"
OLD_STORE = [
    replace(point, path="oldstore") for point in CONTINUATION
]
OLD_STORE.append(
    Checkpoint("oldstore", "instance_mismatch_skip", OLD_MODULE, 0xC96A0,
               "Skip remaining APP11 content after JP or En mismatch",
               "r ax; dw @rbp-0x70 L1")
)
OLD_DEPTH_LABELS = {
    "super_description_return", "child_header_call", "type_jumb",
    "child_dispatch", "child_status", "sdk_retrieval_return",
}
OLD_DEPTH = [replace(point, path="olddepth") for point in CHILD
             if point.label in OLD_DEPTH_LABELS]

NEW_STORE_JPEG_LABELS = {
    "read_cai_entry", "app11_marker", "segment_minimum",
    "stored_en_length", "first_length", "c2pa_first_byte",
    "first_append", "assembled_result",
}
NEW_DEPTH_JPEG_LABELS = {
    "read_cai_entry", "app11_marker", "segment_minimum",
    "first_length", "c2pa_first_byte", "first_append", "assembled_result",
}
NEW_STORE = [
    Checkpoint("newstore", "count_compare", NEW_MODULE, 0x43A4F8,
               "Second recognized first record checks existing store count",
               "dd @rbp+0x180 L1"),
    Checkpoint("newstore", "count_branch", NEW_MODULE, 0x43A4FF,
               "Equal count selects multiple-store error", "r efl"),
    Checkpoint("newstore", "second_store_error", NEW_MODULE, 0x43AA24,
               "Store error discriminator 0x1c after second recognition",
               "r rsi; dd @rbp+0x180 L1"),
]
NEW_DEPTH = [
    Checkpoint("newdepth", "superbox_entry", NEW_MODULE, 0x4C8FE0,
               "Signed JUMBF superbox parser entry", "r r8"),
    Checkpoint("newdepth", "depth_compare", NEW_MODULE, 0x4C9009,
               "Compare R8 depth operand with 32", "r r8"),
    Checkpoint("newdepth", "depth_branch", NEW_MODULE, 0x4C900D,
               "Depth below 32 enters parser; 32 or above rejects", "r r8; r efl"),
    Checkpoint("newdepth", "depth_error", NEW_MODULE, 0x4C900F,
               "Depth 32 or above stores error selector 0x11", "r r8; r rsi"),
    Checkpoint("newdepth", "depth_accept", NEW_MODULE, 0x4C9019,
               "Depth below 32 enters BMFF header reader", "r r8"),
    Checkpoint("newdepth", "alternate_parser_entry", NEW_MODULE, 0x4C76E0,
               "Separate cursor monomorphization, route check", "r r8"),
]
NEW_PINS = {
    0x43A4F8: "83bd8001000001",
    0x43A4FF: "0f841f050000",
    0x43AA24: "48c7061c000000",
    0x4C8FE0: "55",
    0x4C9009: "4983f820",
    0x4C900D: "720a",
    0x4C900F: "48c7460811000000",
    0x4C9019: "4c89c7",
    0x4C76E0: "55",
}
REPEAT = {
    ("old", "H1"): {("oldstore", label) for label in
                    ("app11_minimum", "jp_compare", "jp_decision", "instance_mismatch_skip")},
    ("old", "H2"): {("olddepth", label) for label in
                    ("child_header_call", "child_dispatch", "child_status")},
    ("new", "H1"): {("rustjpeg", label) for label in
                    ("app11_marker", "segment_minimum", "stored_en_length",
                     "first_length", "c2pa_first_byte")}
                    | {("newstore", "count_compare"), ("newstore", "count_branch")},
    ("new", "H2"): {("newdepth", "depth_compare"), ("newdepth", "depth_branch")},
}


def checked_corpus() -> dict[str, object]:
    if not CORPUS.is_file() or sha256(CORPUS) != CORPUS_SHA256:
        raise ValueError("H fixture manifest digest differs")
    corpus = json.loads(CORPUS.read_text(encoding="utf-8"))
    if corpus.get("schema") != CORPUS_SCHEMA or len(corpus.get("cases", [])) != 8:
        raise ValueError("Unexpected H fixture manifest")
    for row in corpus["cases"]:
        path = CORPUS.parent / row["file"]
        if not path.is_file() or path.stat().st_size != row["bytes"] or sha256(path) != row["sha256"]:
            raise ValueError(f"H fixture differs: {row.get('id')}")
    return {"schema": CORPUS_SCHEMA, "sha256": CORPUS_SHA256,
            "case_ids": [row["id"] for row in corpus["cases"]]}


def _points_new(output: Path, batch: str) -> tuple[list[Checkpoint], dict[str, object]]:
    base = build_new_bridge(output, CORPUS)
    bridge: list[Checkpoint] = []
    for row in base["checkpoints"]:
        if (row["path"], row["label"]) in LEAN_BASE:
            values = dict(row)
            values["rva"] = int(values["rva"], 16)
            bridge.append(Checkpoint(**values))
    if len(bridge) != len(LEAN_BASE):
        raise ValueError("New lean bridge selection changed")
    selected = NEW_STORE_JPEG_LABELS if batch == "H1" else NEW_DEPTH_JPEG_LABELS
    jpeg = [point for point in RUST_JPEG if point.label in selected]
    if len(jpeg) != len(selected):
        raise ValueError("New signed JPEG selection changed")
    extra = NEW_STORE if batch == "H1" else NEW_DEPTH
    points = bridge + jpeg + extra
    binary = ROOT / "packages" / VERSION["new"] / "x64/PaintApp" / NEW_MODULE
    if sha256(binary) != base["modules"][NEW_MODULE]["sha256"]:
        raise ValueError("Signed C2PA module digest differs")
    pe = pefile.PE(str(binary), fast_load=True)
    pinned = JPEG_OPCODES | NEW_PINS
    try:
        for point in jpeg + extra:
            expected = pinned.get(point.rva)
            if expected is None or pe.get_data(point.rva, len(bytes.fromhex(expected))) != bytes.fromhex(expected):
                raise ValueError(f"Signed C2PA instruction differs at 0x{point.rva:X}")
    finally:
        pe.close()
    return points, base


def _points_old(batch: str) -> tuple[list[Checkpoint], dict[str, object]]:
    binary = ROOT / "packages" / VERSION["old"] / "x64/PaintApp" / OLD_MODULE
    if not binary.is_file() or sha256(binary) != SDK_SHA256:
        raise ValueError("Signed old SDK digest differs")
    points = [point for point in POINTS["old"]
              if point.path in {"image", "flow", "provenance"}
              and point.label not in {"box_header", "deserializer"}]
    points += OLD_STORE if batch == "H1" else OLD_DEPTH
    modules: dict[str, dict[str, str]] = {}
    for point in points:
        item = ROOT / "packages" / VERSION["old"] / "x64/PaintApp" / point.module
        if not item.is_file() or not executable_rva(item, point.rva):
            raise ValueError(f"Missing/non-executable old checkpoint: {point.module}+0x{point.rva:X}")
        modules[point.module] = {
            "package_path": str(item.relative_to(ROOT)).replace("\\", "/"),
            "sha256": sha256(item),
        }
    return points, {"modules": modules}


def _repeat_selected(script: str, points: list[Checkpoint], build: str, batch: str) -> str:
    lines = script.splitlines(keepends=True)
    lean_depth_capture = {
        ("olddepth", "child_header_call"): "r r12; r r8",
        ("olddepth", "child_dispatch"): "r r8; r rsi",
        ("olddepth", "child_status"): "r eax",
        ("newdepth", "depth_compare"): "r r8",
        ("newdepth", "depth_branch"): "r r8; r efl",
    }
    for point in points:
        if (point.path, point.label) not in REPEAT[(build, batch)]:
            continue
        module = point.module.removesuffix(".dll")
        needle = (f'bu /1 {module}+0x{point.rva:X} '
                  f'".echo PAINT_TRACE_HIT={point.path}_{point.label};')
        matching = [i for i, line in enumerate(lines) if line.startswith(needle)]
        if len(matching) != 1:
            raise ValueError(f"Cannot uniquely repeat {point.path}_{point.label}")
        index = matching[0]
        if batch == "H2":
            marker = f"{point.path}_{point.label}"
            capture = lean_depth_capture[(point.path, point.label)]
            lines[index] = (
                f'bu {module}+0x{point.rva:X} '
                f'".echo PAINT_TRACE_HIT={marker}; '
                f'.printf \\"PAINT_TRACE_HIT_PID={marker}:%u\\n\\", @$tpid; '
                f'.time; {capture}; r rip; g"\n'
            )
        else:
            lines[index] = lines[index].replace("bu /1", "bu", 1)
    return "".join(lines)


def build(output: Path, *, profile: str, batch: str) -> dict[str, object]:
    if profile not in {"old", "new"} or batch not in {"H1", "H2"}:
        raise ValueError("Choose old/new and H1/H2")
    fixture = checked_corpus()
    if profile == "new":
        points, base = _points_new(output, batch)
        modules = base["modules"]
    else:
        points, base = _points_old(batch)
        modules = base["modules"]
    addresses = [(point.module, point.rva) for point in points]
    if len(addresses) != len(set(addresses)):
        raise ValueError("Duplicate H breakpoint address")
    script = render(profile, points, auto_continue=True,
                    ignore_winui_rpc=True, continue_process_exit=True,
                    skip_breakpoint_listing=True)
    if script.count("bu /1 ") != len(points):
        raise ValueError("Unexpected bounded H CDB rendering")
    script = _repeat_selected(script, points, profile, batch)
    if not script.endswith("g\n"):
        raise ValueError("Unexpected H CDB script terminator")
    output.parent.mkdir(parents=True, exist_ok=True)
    output.write_text(script, encoding="ascii")
    result: dict[str, object] = {
        "profile": profile, "version": VERSION[profile], "script": output.name,
        "diagnostic_mode": f"signed-provenance-{batch.lower()}-{profile}",
        "auto_continue": True, "continue_process_exit": True,
        "fixture_manifest": fixture,
        "modules": modules,
        "repeat_labels": sorted(f"{path}_{label}" for path, label in REPEAT[(profile, batch)]),
        "pinned_instruction_bytes": (
            {f"0x{rva:X}": value for rva, value in (JPEG_OPCODES | NEW_PINS).items()
             if rva in {point.rva for point in points if point.module == NEW_MODULE}}
            if profile == "new" else None
        ),
        "checkpoints": [asdict(point) | {"rva": f"0x{point.rva:X}"} for point in points],
        "limits": [
            "Stage-only profile; no guest or Paint process is launched by this generator.",
            "Repeated checkpoint counts are not a validated recursion depth until process and fixture gates pass.",
            "One-shot markers cannot prove absence of a later call or access.",
            "An error status or branch hit does not establish an invalid memory read or CVE fix.",
            "Raw addresses, paths, PIDs, and debugger logs stay in ignored local output.",
        ],
    }
    output.with_suffix(output.suffix + ".json").write_text(
        json.dumps(result, indent=2) + "\n", encoding="utf-8"
    )
    return result


def main() -> None:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--build", choices=("old", "new"), required=True)
    parser.add_argument("--batch", choices=("H1", "H2"), required=True)
    parser.add_argument("--output", type=Path, required=True)
    args = parser.parse_args()
    result = build(args.output, profile=args.build, batch=args.batch)
    print(f"Wrote {len(result['checkpoints'])} signed H checkpoints")


if __name__ == "__main__":
    main()