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

Python · 6,243 bytes
#!/usr/bin/env python3
"""Prepare an isolated signed trace for private-present description headers.

The zero/one remaining-byte cases take a different route from the ID-off
exact-remainder guard. This generator writes ignored CDB input only.
"""

from __future__ import annotations

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

import pefile

from build_provenance_missing_fields_trace import (
    MANIFEST, MANIFEST_SHA256, MODULE, MODULE_SHA256,
    build as build_base, checked_manifest,
)
from generate_cdb import Checkpoint, ROOT, VERSION, sha256


POINTS = (
    Checkpoint("privatehdr", "private_flag_test", MODULE, 0x4C9409,
               "Test nested optional private-field bit"),
    Checkpoint("privatehdr", "private_flag_branch", MODULE, 0x4C9410,
               "Branch into the optional private-field route"),
    Checkpoint("privatehdr", "header_entry", MODULE, 0x4C94C6,
               "Enter the optional private-field box-header path"),
    Checkpoint("privatehdr", "header_call", MODULE, 0x4C94D3,
               "Call signed box-header reader with current cursor"),
    Checkpoint("privatehdr", "header_return", MODULE, 0x4C94D8,
               "Return from signed box-header reader"),
    Checkpoint("privatehdr", "header_kind_compare", MODULE, 0x4C94E6,
               "Compare returned header category against one"),
    Checkpoint("privatehdr", "header_kind_branch", MODULE, 0x4C94ED,
               "Branch on returned header category"),
    Checkpoint("privatehdr", "header_equal_route", MODULE, 0x4C94EF,
               "Immediate equality successor"),
    Checkpoint("privatehdr", "header_other_route", MODULE, 0x4C950F,
               "Immediate inequality successor"),
    Checkpoint("privatehdr", "header_size_branch", MODULE, 0x4C951E,
               "Test returned header extent for zero"),
    Checkpoint("privatehdr", "header_nonzero_route", MODULE, 0x4C9524,
               "Continue when returned header extent is nonzero"),
)
PINNED_BYTES = {
    0x4C9409: "f6850704000010",
    0x4C9410: "0f85b0000000",
    0x4C94C6: "4d89cc",
    0x4C94D3: "e818d0ffff",
    0x4C94D8: "488b8da0030000",
    0x4C94E6: "83bd9803000001",
    0x4C94ED: "7520",
    0x4C94EF: "c6851f04000001",
    0x4C950F: "b802000000",
    0x4C951E: "0f845e010000",
    0x4C9524: "498d4424f8",
}
CASES = ("private_on_zero_remaining", "private_on_one_remaining")
CAP = 64


def _append_repeated(script: str) -> str:
    lines = script.splitlines()
    if not lines or lines[-1] != "g":
        raise ValueError("Expected final auto-continue command")
    if any(f"c2pa_c+0x{p.rva:X}" in script for p in POINTS):
        raise ValueError("Private-header checkpoint collides with base profile")
    additions = [f"r $t{8 + index} = 0" for index in range(len(POINTS))]
    for index, point in enumerate(POINTS):
        number = 718 + index
        register = f"$t{8 + index}"
        marker = f"{point.path}_{point.label}"
        extra = "dd @rbp+0x398 L1; dq @rbp+0x3a8 L1; " if point.rva in {
            0x4C94D8, 0x4C94E6, 0x4C94ED,
        } else ""
        additions.append(
            f'bu{number} c2pa_c+0x{point.rva:X} "'
            f'.if (@{register} < {CAP}) {{ '
            f'r {register} = @{register} + 1; '
            f'.echo PAINT_TRACE_HIT={marker}; '
            f'.printf \\"PAINT_TRACE_HIT_PID={marker}:%u\\n\\", @$tpid; '
            'r rip; r rbp; r rbx; r r9; r r12; r r14; r efl; '
            f'{extra}u @rip L1; g '
            f'}} .else {{ .echo PAINT_PRIVATE_HEADER_CAP={point.label}; '
            f'bd {number}; g }}"'
        )
    return "\n".join(lines[:-1] + additions + ["g", ""])


def build(output: Path, manifest_path: Path = MANIFEST) -> dict[str, object]:
    checked_manifest(manifest_path)
    binary = ROOT / "packages" / VERSION["new"] / "x64/PaintApp" / MODULE
    if not binary.is_file() or sha256(binary) != MODULE_SHA256:
        raise ValueError("Signed new C2PA reader digest differs")
    pe = pefile.PE(str(binary), fast_load=True)
    try:
        for rva, opcode in PINNED_BYTES.items():
            expected = bytes.fromhex(opcode)
            if pe.get_data(rva, len(expected)) != expected:
                raise ValueError(f"Signed private-header instruction differs at 0x{rva:X}")
    finally:
        pe.close()
    profile = build_base("new", output, manifest_path)
    output.write_text(_append_repeated(output.read_text(encoding="ascii")),
                      encoding="ascii")
    profile["checkpoints"].extend(
        asdict(point) | {"rva": f"0x{point.rva:X}"} for point in POINTS
    )
    profile["schema"] = "paint-provenance-new-private-header-profile-v1"
    profile["diagnostic_mode"] = "new-nested-private-header"
    profile["private_header_trace"] = {
        "selected_case_ids": list(CASES),
        "repeated_labels": [point.label for point in POINTS],
        "max_hits_per_site": CAP,
        "cap_marker": "PAINT_PRIVATE_HEADER_CAP",
        "pinned_opcodes": {f"0x{rva:X}": value for rva, value in PINNED_BYTES.items()},
        "static_candidate": (
            "Bit 0x10 routes to the box-header reader at +0x4C94D3; "
            "the returned category and extent select later branches."
        ),
        "limits": [
            "The category one interpretation is not assigned before guest branch evidence.",
            "A header read must be checked against its actual owner for any memory-safety claim.",
            "This path is distinct from the no-private r9 == 8 gate.",
        ],
    }
    if profile["fixture_manifest"]["sha256"] != MANIFEST_SHA256:
        raise ValueError("Pinned corpus identity differs")
    output.with_suffix(output.suffix + ".json").write_text(
        json.dumps(profile, indent=2) + "\n", encoding="utf-8"
    )
    return profile


def main() -> None:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--output", type=Path, required=True)
    parser.add_argument("--fixture-manifest", type=Path, default=MANIFEST)
    args = parser.parse_args()
    result = build(args.output, args.fixture_manifest)
    print(f"Prepared {len(result['checkpoints'])} signed checkpoints; guest not launched")


if __name__ == "__main__":
    main()