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

Python · 8,216 bytes
#!/usr/bin/env python3
"""Build a small signed new-reader UUID/toggle/label heap-sample profile.

This is a stage-only follow-up to the first-error trace. It samples the
second description visit's UUID copy request and selected pre-read source
bytes against the debugger-reported heap chunk. It cannot census the whole
label loop or establish a CVE fix.
"""

from __future__ import annotations

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

import pefile

from build_provenance_nested_later_read import (
    EXTENSIONS, MODULES, build as build_base, quoted,
)
from generate_cdb import Checkpoint, ROOT, VERSION, executable_rva, sha256


MODULE = "c2pa_c.dll"
INTERVENING_OPCODE = (0x4C9233, "488b8510040000")  # saved base -> RAX before label load


@dataclass(frozen=True)
class SamplePoint:
    label: str
    rva: int
    opcode: str
    purpose: str
    capture: str
    read_width: int | None = None
    when: str = "@$t2 == 2"


POINTS = (
    SamplePoint("uuid_cap_compare", 0x4C911D, "4883f910",
                "Physical UUID available-byte cap", "r rcx; r r8; r efl; kv 5"),
    SamplePoint("uuid_cap_branch", 0x4C912F, "750b",
                "One-byte UUID path versus bounded call", "r rcx; r r8; r efl; kv 5"),
    SamplePoint("uuid_copy_request", 0x4C9146, "e8551cb400",
                "UUID copy source and requested byte count",
                "r rdx; r r8; r rcx; r rip; u @rip L1; "
                "db @rdx L10; !ext.address @rdx; !exts.heap -x @rdx; kv 6", 16),
    SamplePoint("toggle_extent_compare", 0x4C9169, "4d39e7",
                "Physical toggle cursor/end compare", "r r15; r r12; r efl; kv 5"),
    SamplePoint("toggle_extent_branch", 0x4C9173, "0f864b010000",
                "Missing-toggle branch", "r r15; r r12; r efl; kv 5"),
    SamplePoint("toggle_preload", 0x4C918A, "460fb63c20",
                "One-byte toggle load before instruction",
                "r $t18 = @rax + @r12; r $t18; r rax; r r12; r rip; u @rip L1; "
                "db @$t18 L1; !ext.address @$t18; !exts.heap -x @$t18; kv 6", 1),
    SamplePoint("label_declared_compare", 0x4C9220, "4883f909",
                "Declared remaining bytes before first label read", "r rcx; r efl; kv 5"),
    SamplePoint("label_declared_branch", 0x4C9224, "0f8258040000",
                "Declared short-label branch", "r rcx; r efl; kv 5"),
    SamplePoint("label_first_preload", 0x4C923A, "460fb63c20",
                "First one-byte label load before instruction",
                "r $t18 = @rax + @r12; r $t18; r rax; r r12; r rip; u @rip L1; "
                "db @$t18 L1; !ext.address @$t18; !exts.heap -x @$t18; kv 6", 1),
    SamplePoint("label_last_guard", 0x4C922D, "0f866b010000",
                "Fixture-specific final-label physical guard and prospective source byte",
                "r $t18 = poi(@rbp+0x410) + @r12; r $t18; r r8; r r12; "
                "r rcx; r efl; r rbp; dq @rbp+0x410 L1; r rip; u @rip L1; db @$t18 L1; "
                "!ext.address @$t18; !exts.heap -x @$t18; kv 6", 1,
                "(@$t2 == 2) && (((@r12 == 0x80) && (@rcx == 0x9)) || "
                "((@r12 == 0x88) && (@rcx == 0x11)))"),
    SamplePoint("label_last_postload", 0x4C924C, "4584ff",
                "Confirm final label byte loaded as NUL at pinned cursor",
                "r r15; r r12; r rip; u @rip L1; kv 6", None,
                "(@$t2 == 2) && (@r15 == 0) && "
                "((@r12 == 0x80) || (@r12 == 0x88))"),
)


def command(point: SamplePoint, number: int, counter: int) -> str:
    label = f"newheap_{point.label}"
    body = (
        f"r $t{counter} = @$t{counter} + 1; "
        f".if (@$t{counter} > 1) {{ .echo PAINT_NEW_HEAP_CAP={label}; bd {number} "
        "} .else { "
        f".echo PAINT_TRACE_HIT={label}; "
        f'.printf "PAINT_TRACE_HIT_PID={label}:%u\\n", @$tpid; '
        f'.printf "PAINT_NEW_HEAP_TID={label}:%u\\n", @$tid; '
        f"lmv m c2pa_c; r rip; {point.capture} "
        "}; g"
    )
    return f'bu{number} /w "{point.when}" c2pa_c+0x{point.rva:X} {quoted(body)}'


def build(output: Path) -> dict[str, object]:
    base = build_base("new", output)
    repeats = base.get("repeated") or []
    if len(repeats) < 3 or repeats[2].get("label") != "jumd_size_branch" or \
            repeats[2].get("breakpoint") != 402:
        raise ValueError("Base second-description counter changed")
    binary = ROOT / "packages" / VERSION["new"] / "x64/PaintApp" / MODULE
    if sha256(binary) != MODULES["new"][MODULE]:
        raise ValueError("Signed new C2PA DLL digest differs")
    pe = pefile.PE(str(binary), fast_load=True)
    try:
        for point in POINTS:
            expected = bytes.fromhex(point.opcode)
            if not executable_rva(binary, point.rva) or \
                    pe.get_data(point.rva, len(expected)) != expected:
                raise ValueError(f"Signed new heap-sample opcode differs: +0x{point.rva:X}")
        rva, opcode = INTERVENING_OPCODE
        if pe.get_data(rva, len(bytes.fromhex(opcode))) != bytes.fromhex(opcode):
            raise ValueError("Signed saved-base load before final label differs")
    finally:
        pe.close()
    for name, digest in EXTENSIONS.items():
        path = ROOT / "lab/isolation/dependencies/debugger" / name
        if sha256(path) != digest:
            raise ValueError(f"Pinned heap extension differs: {name}")
    script = output.read_text(encoding="ascii")
    if not script.endswith("g\n") or "r $t5 = 0" in script:
        raise ValueError("Unexpected base CDB script layout")
    loads = (r".load C:\PaintLab\Input\debugger\winext\ext.dll" + "\n" +
             r".load C:\PaintLab\Input\debugger\winxp\exts.dll" + "\n")
    counters = "".join(f"r $t{i} = 0\n" for i in range(5, 5 + len(POINTS)))
    extra = [command(point, 600 + index, 5 + index)
             for index, point in enumerate(POINTS)]
    output.write_text(
        script[:-2] + loads + counters + "\n".join(extra) + "\ng\n",
        encoding="ascii",
    )
    checkpoints = [Checkpoint("newheap", point.label, MODULE, point.rva, point.purpose)
                   for point in POINTS]
    labels = [f"{row['path']}_{row['label']}" for row in base["checkpoints"]]
    labels.extend(f"{point.path}_{point.label}" for point in checkpoints)
    if len(labels) != len(set(labels)):
        raise ValueError("Duplicate new heap-sample guest marker label")
    base["schema"] = "paint-new-nested-heap-sample-profile-v1"
    base["diagnostic_mode"] = "new-nested-xlbox-heap-sample"
    base["heap_extension_sha256"] = EXTENSIONS
    base["checkpoints"].extend(
        asdict(point) | {"rva": f"0x{point.rva:X}"} for point in checkpoints
    )
    base["heap_sample"] = {
        "points": [asdict(point) | {"rva": f"0x{point.rva:X}", "breakpoint": 600 + i}
                   for i, point in enumerate(POINTS)],
        "per_point_cap": 1,
        "second_description_only": True,
        "signed_label_saved_base_rva": f"0x{INTERVENING_OPCODE[0]:X}",
        "limits": [
            "The UUID sample measures a copy request before a call, not every instruction in the callee.",
            "Toggle and first-label samples are pre-instruction effective source addresses.",
            "The last-label sample is at the physical guard before the pinned load; a post-load NUL marker links the path.",
            "The fixture-specific last-label cursor conditions must hit, or the result is inconclusive.",
            "One-hit samples are deliberately not a full-loop bound.",
            "If a heap extension cannot name the containing user allocation, record inconclusive.",
            "Raw addresses, memory bytes, process IDs and debugger output remain local.",
        ],
    }
    output.with_suffix(output.suffix + ".json").write_text(
        json.dumps(base, indent=2) + "\n", encoding="utf-8"
    )
    return base


def main() -> None:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--output", type=Path, required=True)
    args = parser.parse_args()
    profile = build(args.output)
    print(f"Wrote {len(profile['heap_sample']['points'])} signed new-reader samples")


if __name__ == "__main__":
    main()