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

Python · 17,632 bytes
#!/usr/bin/env python3
"""Export strict, address-free old/new combined-description observations.

The old profile includes debugger heap queries at selected field reads and
copies. The new one-shot signed profile observes the unchanged outer
description; it cannot assign a later nested rejection by absence alone.
"""

from __future__ import annotations

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

from export_provenance_sdk_c1_heap import (
    _heap_queries, _hex, _register_address,
)
from export_provenance_sdk_matrix import (
    LAB, MARKER_RE, case_id, digest, read_json, require,
    bounded_register_samples, description_ordinals, profile_path_for_stage,
    verify_trial,
)


NAMES = (
    "control", "label_id_only", "label_signature_only",
    "label_private_only", "label_id_private", "label_signature_private",
    "label_id_signature_private", "label_id_short3",
    "label_signature_short31",
)
CORPUS_SHA = "816f99785e9050f97057496929de20dc5a132ba0371b71fd3e5b2121e43de711"
EXPECTED = {
    "control": (58, None, None, None, 0),
    "label_id_only": (13, 45, None, None, 0),
    "label_signature_only": (13, None, 45, None, 0),
    "label_private_only": (13, None, None, 45, 0),
    "label_id_private": (13, 45, None, 41, 0),
    "label_signature_private": (13, None, 45, 13, 0),
    "label_id_signature_private": (13, 45, 41, 9, 0),
    "label_id_short3": (55, 3, None, None, 36),
    "label_signature_short31": (27, None, 31, None, 36),
}
HEAP_EXTENSIONS = {
    "winext/ext.dll": "42e8ccd67d74f0d1a23fc0c7a0977d4027d5fc37e130431d218d67e990244a03",
    "winxp/exts.dll": "9b2741e158c708484c0e81a2cfe483c2ece9ea52af155c61a15c129664686685",
}


def _section_at_ordinal(log: str, marker: str, ordinal: int) -> str:
    hits = list(MARKER_RE.finditer(log))
    current = 0
    selected: list[int] = []
    for index, hit in enumerate(hits):
        if hit.group(1) == "olddesc_description_entry":
            current += 1
        if hit.group(1) == marker and current == ordinal:
            selected.append(index)
    require(len(selected) == 1, f"Expected one {marker} at description {ordinal}")
    index = selected[0]
    return log[hits[index].end():hits[index + 1].start()
               if index + 1 < len(hits) else len(log)]


def _target_position(markers: list[str], marker: str) -> int | None:
    current = 0
    found: list[int] = []
    for index, item in enumerate(markers):
        if item == "olddesc_description_entry":
            current += 1
        if item == marker and current == 2:
            found.append(index)
    require(len(found) <= 1, f"Repeated target field marker: {marker}")
    return found[0] if found else None


def _label_heap(log: str, label_bytes: int) -> dict[str, Any]:
    scan = _section_at_ordinal(log, "olddesc_label_strnlen", 2)
    scan_source = _register_address(scan, "rcx")
    scan_limit = bounded_register_samples(
        "PAINT_TRACE_HIT=olddesc_label_strnlen\n" + scan,
        "olddesc_label_strnlen", ("rdx",), 0x10000)
    require(scan_limit == [{"rdx": 58}],
            "Nested bounded label scan did not receive 58 bytes")
    scan_queries, scan_samples = _heap_queries(scan, (58,))
    require(scan_queries == [scan_source],
            "Nested label-scan heap query differs from source")

    later = _section_at_ordinal(log, "olddesc_label_strlen", 2)
    later_source = _register_address(later, "rcx")
    later_queries, later_samples = _heap_queries(later, (label_bytes,))
    require(later_queries == [later_source],
            "Nested label strlen heap query differs from source")
    return {"bounded_scan": scan_samples[0],
            "later_nul_terminated_span": later_samples[0]}


def _field_heap(log: str, *, id_read: bool, signature: bool,
                private_bytes: int | None) -> dict[str, Any]:
    samples: dict[str, Any] = {}
    if id_read:
        area = _section_at_ordinal(log, "olddesc_id_load", 2)
        source = _register_address(area, "rcx")
        queries, rows = _heap_queries(area, (4,))
        require(queries == [source], "ID heap query differs from read source")
        samples["id_read"] = rows[0]
    if signature:
        loads: dict[str, Any] = {}
        base: int | None = None
        for index, suffix in enumerate(("first", "second")):
            area = _section_at_ordinal(log, f"olddesc_signature_load_{suffix}", 2)
            current = _register_address(area, "rbx")
            if base is None:
                base = current
            require(current == base, "Signature source changed between loads")
            queries, rows = _heap_queries(area, (16,))
            require(queries == [base + index * 16],
                    "Signature heap query differs from selected 16-byte load")
            loads[suffix] = rows[0]
        samples["signature_reads"] = loads
    if private_bytes is not None:
        area = _section_at_ordinal(log, "olddesc_private_copy", 2)
        before_heap = area.split("Usage:", 1)[0]
        slots = re.findall(r"(?m)^[0-9a-f`]+\s{2,}([0-9a-f`]+)\s*$",
                           before_heap, re.IGNORECASE)
        require(len(slots) == 2, "Private source/count slots incomplete")
        source, count = map(_hex, slots)
        destination = _register_address(area, "r8")
        require(count == private_bytes,
                "Private copy count differs from pinned description layout")
        queries, rows = _heap_queries(area, (count, count))
        require(queries == [source, destination],
                "Private source/destination heap queries differ from operands")
        samples["private_copy"] = {
            "copy_bytes": count, "source": rows[0], "destination": rows[1],
        }
    return samples


def _old_case(name: str, row: dict[str, Any], log: str) -> dict[str, Any]:
    label_bytes, id_remaining, sig_remaining, private_bytes, local_status = EXPECTED[name]
    require(row.get("status_hex") == f"0x{local_status:08X}",
            f"Old G/{name}: SDK status differs from nested return")
    markers = row["markers"]
    operands = row["safe_operands"]
    entries = bounded_register_samples(log, "olddesc_description_entry",
                                       ("r8",), 0x10000)
    require(len(entries) >= 2 and entries[:2] == [{"r8": 22}, {"r8": 75}],
            f"Old G/{name}: outer/nested description input spans differ")
    guards = operands["description_event_ordinals"]
    label_ordinals = guards["label_length_guard"]
    label_values = operands["label_length_compares"]
    require(2 in label_ordinals and len(label_ordinals) == len(label_values) and
            label_values[label_ordinals.index(2)] ==
            {"required": label_bytes, "remaining": 58} and
            2 in guards["label_strlen"] and
            operands["description_return_statuses"][:2] == [0, local_status],
            f"Old G/{name}: nested bounded label or return is incomplete")
    expected_steps = ["olddesc_label_strnlen", "olddesc_label_length_guard",
                      "olddesc_label_strlen"]
    if id_remaining is not None:
        require(guards["id_guard"] == [2] and
                operands["id_remaining_bytes"] == [id_remaining],
                f"Old G/{name}: nested ID guard/operand incomplete")
        expected_steps.append("olddesc_id_guard")
        if id_remaining >= 4:
            require(guards["id_load"] == [2],
                    f"Old G/{name}: guarded ID load missing")
            expected_steps.append("olddesc_id_load")
        else:
            require(2 not in guards["id_load"],
                    "Old G/short ID unexpectedly reached target read")
    else:
        require(2 not in guards["id_guard"] and 2 not in guards["id_load"],
                f"Old G/{name}: unexpected target ID route")
    if sig_remaining is not None:
        require(guards["signature_guard"] == [2] and
                operands["signature_remaining_bytes"] == [sig_remaining],
                f"Old G/{name}: nested signature guard/operand incomplete")
        expected_steps.append("olddesc_signature_guard")
        if sig_remaining >= 32:
            require(guards["signature_load_first"] == [2] and
                    guards["signature_load_second"] == [2],
                    f"Old G/{name}: guarded signature loads missing")
            expected_steps.extend(("olddesc_signature_load_first",
                                   "olddesc_signature_load_second"))
        else:
            require(2 not in guards["signature_load_first"] and
                    2 not in guards["signature_load_second"],
                    "Old G/short signature unexpectedly reached target loads")
    else:
        require(2 not in guards["signature_guard"],
                f"Old G/{name}: unexpected target signature route")
    if private_bytes is not None:
        require(guards["private_alloc"] == [2] and
                guards["private_copy"] == [2],
                f"Old G/{name}: nested private allocation/copy missing")
        expected_steps.extend(("olddesc_private_alloc",
                               "olddesc_private_copy"))
    else:
        require(2 not in guards["private_alloc"] and
                2 not in guards["private_copy"],
                f"Old G/{name}: unexpected target private route")
    positions = [_target_position(markers, marker) for marker in expected_steps]
    require(all(position is not None for position in positions) and
            positions == sorted(positions),
            f"Old G/{name}: nested field order differs from signed parser")
    heap = {"label": _label_heap(log, label_bytes)}
    heap.update(_field_heap(log, id_read=id_remaining is not None and
                            id_remaining >= 4,
                            signature=sig_remaining is not None and
                            sig_remaining >= 32,
                            private_bytes=private_bytes))
    return {
        "nested_description_ordinal": 2,
        "nested_input_bytes": 75,
        "label_required_bytes": label_bytes,
        "id_remaining_bytes": id_remaining,
        "signature_remaining_bytes": sig_remaining,
        "private_copy_bytes": private_bytes,
        "nested_return_status": local_status,
        "ordered_target_markers": expected_steps,
        "heap_samples": heap,
    }


def _new_case(name: str, row: dict[str, Any], log: str) -> dict[str, Any]:
    markers = row["markers"]
    ordered = ("newdesc_c_reader", "rustjpeg_c2pa_accepted",
               "rustjpeg_first_append", "rustjpeg_assembled_result",
               "rustdesc_superbox_entry", "rustdesc_jumd_kind",
               "rustdesc_jumd_minimum", "rustdesc_jumd_size_accept",
               "rustdesc_uuid_copy", "rustdesc_toggle_read",
               "rustdesc_toggle_guard", "rustdesc_label_remaining",
               "rustdesc_label_terminator", "rustdesc_return",
               "newdesc_reader_ffi_return", "newdesc_backend_return")
    require(all(markers.count(marker) == 1 for marker in ordered) and
            [markers.index(marker) for marker in ordered] ==
            sorted(markers.index(marker) for marker in ordered),
            f"New G/{name}: signed outer description/C reader coverage incomplete")
    samples = {
        "kind": bounded_register_samples(log, "rustdesc_jumd_kind", ("ecx",), 0x10000),
        "lbox": bounded_register_samples(log, "rustdesc_jumd_minimum", ("r14",), 0x10000),
        "uuid": bounded_register_samples(log, "rustdesc_uuid_copy", ("r8",), 0x10000),
        "toggle": bounded_register_samples(log, "rustdesc_toggle_guard", ("al",), 0xff),
        "label": bounded_register_samples(log, "rustdesc_label_remaining", ("rcx",), 0x10000),
    }
    require(samples == {"kind": [{"ecx": 2}], "lbox": [{"r14": 30}],
                        "uuid": [{"r8": 16}], "toggle": [{"al": 0xfc}],
                        "label": [{"rcx": 13}]},
            f"New G/{name}: unchanged first outer description operands differ")
    return {"first_outer_jumd_kind": 2, "first_outer_lbox": 30,
            "first_outer_uuid_copy_bytes": 16,
            "first_outer_toggle_test_operand": 0xfc,
            "first_outer_label_remaining_cursor": 13,
            "nested_signed_field_route_localized": False,
            "c_reader_null": row["flags"]["reader_null"],
            "raw_export": row["flags"]["raw_export"]}


def _private_log(label: str, build: str, name: str) -> str:
    case_root = LAB / "results" / label / "focus" / build / case_id(name)
    paths = list(case_root.glob("*/cdb.log"))
    require(len(paths) == 1, f"{build} G/{name}: private log missing or ambiguous")
    return paths[0].read_text(encoding="utf-8-sig", errors="replace")


def export(old_label: str, new_label: str) -> dict[str, Any]:
    corpus_path = LAB / "corpus/provenance_sdk_combined_flags/generated/manifest.json"
    require(digest(corpus_path) == CORPUS_SHA,
            "Pinned G fixture manifest digest differs")
    corpus = read_json(corpus_path)
    require(corpus.get("schema") == "paint-provenance-sdk-combined-flags-v1" and
            [item.get("id") for item in corpus.get("cases", [])] == list(NAMES),
            "Pinned G fixture case order/schema differs")
    old_stage = read_json(LAB / "isolation/generated" /
                          f"{old_label}.provenance-sdk-matrix-stage.json")
    new_stage = read_json(LAB / "isolation/generated" /
                          f"{new_label}.provenance-sdk-matrix-stage.json")
    ids = [case_id(name) for name in NAMES]
    require(all(stage.get("selected_cases") == ids and
                stage.get("batch") == "G" and
                stage.get("corpus_manifest_sha256") == CORPUS_SHA
                for stage in (old_stage, new_stage)) and
            old_stage.get("heap_context") is True and
            old_stage.get("internal_rust") is False and
            old_stage.get("description_guard") is False and
            new_stage.get("description_guard") is True and
            new_stage.get("heap_context") is False and
            new_stage.get("internal_rust") is False,
            "G stage profiles, selected cases or corpus differ")
    old_profile = read_json(Path(str(profile_path_for_stage(
        old_stage, "old", "G")) + ".json"))
    require(old_profile.get("heap_extension_sha256") == HEAP_EXTENSIONS and
            all(digest(LAB / "isolation/dependencies/debugger" / name) == sha
                for name, sha in HEAP_EXTENSIONS.items()),
            "Old G heap extension profile or local bytes differ")
    old = verify_trial("old", old_label, "G", NAMES, corpus, CORPUS_SHA)
    new = verify_trial("new", new_label, "G", NAMES, corpus, CORPUS_SHA)
    require(old["cases"]["control"]["status_hex"] == "0x00000000" and
            new["cases"]["control"]["status_hex"] == "0x00000000" and
            new["cases"]["control"]["flags"]["raw_export"],
            "G unchanged control did not retain the positive provenance path")
    rows: dict[str, Any] = {}
    for name in NAMES:
        old_row = old["cases"][name]
        new_row = new["cases"][name]
        rows[name] = {
            "fixture_sha256": old_row["fixture_sha256"],
            "old_sdk_status": old_row["status_hex"],
            "new_bridge_status": new_row["status_hex"],
            "old_nested_route": _old_case(
                name, old_row, _private_log(old_label, "old", name)),
            "new_signed_route": _new_case(
                name, new_row, _private_log(new_label, "new", name)),
            "private_old_log_sha256": old_row["private_log_sha256"],
            "private_new_log_sha256": new_row["private_log_sha256"],
            "private_old_result_sha256": old_row["private_result_sha256"],
            "private_new_result_sha256": new_row["private_result_sha256"],
        }
    return {
        "schema": "paint-provenance-sdk-combined-flags-observations-v1",
        "selected_case_names": list(NAMES),
        "corpus_manifest_sha256": CORPUS_SHA,
        "old": {key: value for key, value in old.items() if key != "cases"},
        "new": {key: value for key, value in new.items() if key != "cases"},
        "cases": rows,
        "evidence_limits": [
            "Old heap samples report allocated chunk envelopes or LFH requested spans, not every parser access or an independently proven user-allocation end.",
            "The signed new profile is one-shot at the unchanged outer description; the changed nested description's first reject is not localized.",
            "A C-reader null, status difference, or bounded source span is not an allocation out-of-bounds read or CVE patch attribution.",
            "Raw debugger logs, addresses, memory bytes, process IDs and guest paths remain local.",
        ],
    }


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()
    require(all(re.fullmatch(r"[a-z0-9][a-z0-9-]{0,39}", label)
                for label in (args.old_label, args.new_label)),
            "G trial labels must be safe")
    try:
        record = export(args.old_label, args.new_label)
    except (ValueError, FileNotFoundError, KeyError, TypeError) as exc:
        parser.exit(2, f"Refused G export: {exc}\n")
    args.output.parent.mkdir(parents=True, exist_ok=True)
    args.output.write_text(json.dumps(record, indent=2) + "\n", encoding="utf-8")
    print("Verified nine paired G cases, sampled old heap spans, and both teardowns")


if __name__ == "__main__":
    main()