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

Python · 15,766 bytes
#!/usr/bin/env python3
"""Compare address-free old/new EMF -> BFDB batch reviews offline.

This reducer never opens a debugger log, memory dump, screenshot, or testcase.
It verifies paired fixture identities and reported evidence hashes before
ranking route changes and old strlen lengths for a fresh order-control repeat.
"""

from __future__ import annotations

import argparse
import hashlib
import json
import re
from collections import Counter
from pathlib import Path


LAB = Path(__file__).resolve().parents[1]
FUZZ_ROOT = LAB / "output" / "emf-bfdb-fuzz"
BASELINE_SHA = "1874ab4dce7f084f944e92b180901cc05fb5381444c6e15b2e103a768bb72777"
SHA = re.compile(r"[0-9a-f]{64}\Z")
CASE = re.compile(r"emf_[a-z0-9_]{1,60}\Z")
LABEL = re.compile(r"[a-z0-9][a-z0-9-]{0,39}\Z")


def require(condition: bool, reason: str) -> None:
    if not condition:
        raise ValueError(reason)


def file_hash(path: Path) -> str:
    digest = hashlib.sha256()
    with path.open("rb") as stream:
        for chunk in iter(lambda: stream.read(1024 * 1024), b""):
            digest.update(chunk)
    return digest.hexdigest()


def read_json(path: Path) -> dict:
    require(path.is_file() and 0 < path.stat().st_size <= 2_000_000,
            "Required bounded JSON is missing or oversized")
    value = json.loads(path.read_text(encoding="utf-8-sig"))
    require(isinstance(value, dict), "Evidence JSON must be an object")
    return value


def check_row(row: object, build: str) -> None:
    require(isinstance(row, dict) and
            isinstance(row.get("id"), str) and CASE.fullmatch(row["id"]) is not None and
            isinstance(row.get("sha256"), str) and SHA.fullmatch(row["sha256"]) is not None and
            row.get("status") in ("verified", "review_required"),
            "Review row identity or status differs")
    if row["status"] == "review_required":
        require(row.get("old_bfdb") is None and
                row.get("new_bounded_reader_markers") is None,
                "Unverified row contains a measured parser result")
        return
    require(row.get("same_paint_process") is True and
            row.get("normal_close") is True and
            all(isinstance(row.get(key), str) and SHA.fullmatch(row[key])
                for key in ("emf_marker_signature_sha256",
                            "bfdb_marker_signature_sha256",
                            "raw_log_sha256", "raw_result_sha256")),
            "Verified row lacks PID, normal-close, marker, or raw-log evidence")
    if build == "new":
        require(row.get("old_bfdb") is None and
                row.get("new_bounded_reader_markers") is True,
                "New-build bounded reader result differs")
    else:
        old = row.get("old_bfdb")
        require(isinstance(old, dict) and
                type(old.get("strlen_length")) is int and
                0 <= old["strlen_length"] < 128 and
                old.get("requested_bytes") == 12 and
                old.get("rounded_block_bytes") == 16 and
                old.get("field_pointer_offset_in_block") == 1 and
                old.get("first_nul_beyond_requested") is
                    (old["strlen_length"] + 1 >= 12) and
                row.get("new_bounded_reader_markers") is False,
                "Old-build BFDB geometry or logical length differs")


def check_review(review: dict, build: str, *, trial: str | None = None,
                 manifest_sha: str | None = None) -> list[dict]:
    rows = review.get("rows")
    require(review.get("schema") == "paint-emf-bfdb-fuzz-batch-review-v1" and
            review.get("build") == build and
            review.get("version") ==
                ("11.2605.81.0" if build == "old" else "11.2609.401.0") and
            review.get("status") in ("verified", "review_required") and
            isinstance(rows, list) and 1 <= len(rows) <= 12 and
            isinstance(review.get("trial_label"), str) and
            LABEL.fullmatch(review["trial_label"]) is not None and
            isinstance(review.get("accepted_manifest_sha256"), str) and
            SHA.fullmatch(review["accepted_manifest_sha256"]) is not None and
            (trial is None or review.get("trial_label") == trial) and
            (manifest_sha is None or
             review["accepted_manifest_sha256"] == manifest_sha),
            "Review schema, build, trial, or accepted corpus differs")
    require(rows[0].get("id") == "emf_baseline" and
            rows[0].get("sha256") == BASELINE_SHA and
            rows[0].get("status") == "verified" and
            len({row.get("id") for row in rows if isinstance(row, dict)}) == len(rows),
            "Review lacks an exact verified within-batch baseline")
    for row in rows:
        check_row(row, build)
    require((review["status"] == "verified") ==
            all(row["status"] == "verified" for row in rows),
            "Review aggregate status differs from its rows")
    return rows


def analyze_pair(old_review: dict, new_review: dict,
                 *, pair_name: str) -> dict:
    old_rows = check_review(old_review, "old")
    new_rows = check_review(new_review, "new")
    require(old_review["accepted_manifest_sha256"] ==
            new_review["accepted_manifest_sha256"] and
            [(r["id"], r["sha256"]) for r in old_rows] ==
            [(r["id"], r["sha256"]) for r in new_rows],
            "Old/new input hashes or order differ")
    baseline_length = old_rows[0]["old_bfdb"]["strlen_length"]
    baseline_old_emf = old_rows[0]["emf_marker_signature_sha256"]
    baseline_new_emf = new_rows[0]["emf_marker_signature_sha256"]
    baseline_old_bfdb = old_rows[0]["bfdb_marker_signature_sha256"]
    baseline_new_bfdb = new_rows[0]["bfdb_marker_signature_sha256"]
    candidates = []
    for old, new in zip(old_rows[1:], new_rows[1:], strict=True):
        measured = old["status"] == new["status"] == "verified"
        length = old["old_bfdb"]["strlen_length"] if measured else None
        delta = length - baseline_length if measured else None
        route_changed = (
            old["emf_marker_signature_sha256"] != baseline_old_emf or
            new["emf_marker_signature_sha256"] != baseline_new_emf or
            old["bfdb_marker_signature_sha256"] != baseline_old_bfdb or
            new["bfdb_marker_signature_sha256"] != baseline_new_bfdb
        ) if measured else None
        reasons = []
        if not measured:
            reasons.append("review_required")
        else:
            if route_changed:
                reasons.append("marker_route_differs_from_baseline")
            if delta:
                reasons.append("old_strlen_differs_from_batch_baseline")
        candidates.append({
            "id": old["id"], "sha256": old["sha256"],
            "old_status": old["status"], "new_status": new["status"],
            "old_strlen_length": length,
            "old_baseline_strlen_length": baseline_length,
            "old_delta_from_batch_baseline": delta,
            "route_changed_from_batch_baseline": route_changed,
            "repeat_priority_reasons": reasons,
        })
    lengths = Counter(row["old_strlen_length"] for row in candidates
                      if row["old_strlen_length"] is not None)
    return {
        "pair_name": pair_name,
        "old_trial": old_review["trial_label"],
        "new_trial": new_review["trial_label"],
        "accepted_manifest_sha256": old_review["accepted_manifest_sha256"],
        "baseline_strlen_length": baseline_length,
        "candidate_count": len(candidates),
        "verified_candidate_pairs": sum(
            row["old_status"] == row["new_status"] == "verified"
            for row in candidates),
        "review_required_candidates": sum(
            row["old_status"] != "verified" or row["new_status"] != "verified"
            for row in candidates),
        "old_strlen_length_counts": {str(key): lengths[key]
                                     for key in sorted(lengths)},
        "candidates": candidates,
    }


def campaign_pairs(campaign_dir: Path) -> tuple[list[dict], dict]:
    plan_path = campaign_dir / "plan.json"
    progress_path = campaign_dir / "progress.json"
    plan = read_json(plan_path)
    progress = read_json(progress_path)
    campaign_id = campaign_dir.name
    manifest_sha = plan.get("accepted_manifest_sha256")
    require(plan.get("schema") == "paint-emf-bfdb-fuzz-campaign-plan-v1" and
            progress.get("schema") == "paint-emf-bfdb-fuzz-campaign-progress-v1" and
            plan.get("campaign_id") == progress.get("campaign_id") ==
                campaign_id and
            isinstance(manifest_sha, str) and SHA.fullmatch(manifest_sha) and
            plan.get("builds") == ["old", "new"] and
            isinstance(plan.get("batches"), list) and
            plan.get("batch_count") == len(plan["batches"]) and
            isinstance(progress.get("trials"), list),
            "Campaign plan/progress identity or A/B build set differs")
    by_trial = {row.get("trial_label"): row for row in progress["trials"]
                if isinstance(row, dict)}
    require(len(by_trial) == len(progress["trials"]),
            "Campaign progress contains duplicate/malformed trial labels")
    results = []
    pending = []
    expected_trial_labels = []
    for batch in plan["batches"]:
        require(isinstance(batch, dict) and
                isinstance(batch.get("trials"), list) and
                [row.get("build") for row in batch["trials"]] ==
                    ["old", "new"] and
                isinstance(batch.get("case_ids"), list) and
                batch["case_ids"][0] == "emf_baseline",
                "Campaign batch has unmatched builds or baseline")
        trial_rows = batch["trials"]
        expected_trial_labels.extend(row["trial_label"] for row in trial_rows)
        require(all(isinstance(row.get("trial_label"), str) and
                    LABEL.fullmatch(row["trial_label"])
                    for row in trial_rows),
                "Campaign trial label is unsafe")
        progress_rows = [by_trial.get(row["trial_label"]) for row in trial_rows]
        require(all(isinstance(row, dict) for row in progress_rows),
                "Campaign trial is absent from progress")
        ready = [row.get("state") in ("reviewed", "review_required")
                 for row in progress_rows]
        if not all(ready):
            pending.append({
                "batch_index": batch["index"],
                "trial_states": {trial_rows[i]["build"]: progress_rows[i].get("state")
                                 for i in range(2)},
            })
            continue
        reviews = []
        for expected, progress_row in zip(trial_rows, progress_rows, strict=True):
            trial = expected["trial_label"]
            path = campaign_dir / f"review-{trial}.json"
            require(path.is_file() and
                    file_hash(path) == progress_row.get("review_sha256"),
                    "Recorded review hash differs")
            review = read_json(path)
            check_review(review, expected["build"], trial=trial,
                         manifest_sha=manifest_sha)
            require(review["status"] == progress_row.get("review_status") and
                    [row["id"] for row in review["rows"]] ==
                        batch["case_ids"],
                    "Campaign review status or ordered IDs differ")
            reviews.append(review)
        results.append(analyze_pair(reviews[0], reviews[1],
                                    pair_name=f"batch_{batch['index']:03d}"))
    require(set(by_trial) == set(expected_trial_labels) and
            len(expected_trial_labels) == len(by_trial),
            "Campaign progress has extra or missing trials")
    return results, {
        "campaign_id": campaign_id,
        "manifest_sha256": manifest_sha,
        "planned_batches": len(plan["batches"]),
        "pending_batches": pending,
        "progress_status": progress.get("status"),
    }


def main() -> None:
    parser = argparse.ArgumentParser(description=__doc__)
    source = parser.add_mutually_exclusive_group(required=True)
    source.add_argument("--campaign-id", help="Existing ignored campaign directory name")
    source.add_argument("--old-review", type=Path,
                        help="Address-free pilot review; requires --new-review")
    parser.add_argument("--new-review", type=Path)
    parser.add_argument("--campaign-root", type=Path,
                        default=FUZZ_ROOT / "campaigns")
    parser.add_argument("--output", type=Path)
    args = parser.parse_args()
    if args.campaign_id:
        require(LABEL.fullmatch(args.campaign_id) is not None,
                "Campaign ID is unsafe")
        require(args.new_review is None,
                "--new-review is only valid with --old-review")
        campaign_dir = args.campaign_root / args.campaign_id
        pairs, context = campaign_pairs(campaign_dir)
        output_path = args.output or campaign_dir / "analysis.json"
    else:
        require(args.new_review is not None,
                "--old-review requires --new-review")
        old = read_json(args.old_review)
        new = read_json(args.new_review)
        pairs = [analyze_pair(old, new, pair_name="pilot")]
        context = {
            "campaign_id": None,
            "manifest_sha256": old["accepted_manifest_sha256"],
            "planned_batches": 1,
            "pending_batches": [],
            "progress_status": "pilot_pair",
        }
        output_path = args.output or FUZZ_ROOT / "analysis-pilot.json"
    verified = sum(pair["verified_candidate_pairs"] for pair in pairs)
    review_required = sum(pair["review_required_candidates"] for pair in pairs)
    repeat_priority = [
        {"pair_name": pair["pair_name"], "id": row["id"],
         "reasons": row["repeat_priority_reasons"]}
        for pair in pairs for row in pair["candidates"]
        if row["repeat_priority_reasons"]
    ]
    output = {
        "schema": "paint-emf-bfdb-fuzz-analysis-v1",
        "status": ("complete" if not context["pending_batches"] and
                   context["progress_status"] in
                       ("complete", "review_required", "pilot_pair")
                   else "partial"),
        "campaign_id": context["campaign_id"],
        "accepted_manifest_sha256": context["manifest_sha256"],
        "planned_batches": context["planned_batches"],
        "analyzed_paired_batches": len(pairs),
        "pending_batches": context["pending_batches"],
        "verified_candidate_pairs": verified,
        "review_required_candidates": review_required,
        "repeat_priority": repeat_priority,
        "pairs": pairs,
        "claim_limit": (
            "A within-batch strlen contrast is observational. It does not "
            "show EMF-caused allocator control, a specific machine-load width, "
            "attacker-visible disclosure, code execution, or CVE attribution. "
            "Repeat priorities require a fresh guest with changed order."
        ),
    }
    encoded = json.dumps(output, sort_keys=True)
    require("\\" not in encoded and
            not re.search(r"(?i)0x[0-9a-f]{8,}", encoded),
            "Private path or address entered analysis")
    safe_root = FUZZ_ROOT.resolve()
    target = output_path.resolve()
    require(target.is_relative_to(safe_root),
            "Analysis output must stay under ignored lab/output/emf-bfdb-fuzz")
    target.parent.mkdir(parents=True, exist_ok=True)
    target.write_text(json.dumps(output, indent=2) + "\n", encoding="utf-8")
    print(f"Analyzed {len(pairs)} paired batches, {verified} verified candidates, "
          f"{len(repeat_priority)} repeat priorities ({output['status']})")


if __name__ == "__main__":
    main()