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

Python · 9,325 bytes
#!/usr/bin/env python3
"""Summarize logical BFDB strlen spans from verified old-build EMF batches.

This reads address-free reviews and never inspects raw memory or debugger logs.
It reports the bytes through the observed first NUL, not CRT machine-load width.
"""

from __future__ import annotations

import argparse
import json
import time
from collections import Counter
from pathlib import Path

from analyze_emf_bfdb_fuzz_campaign import (
    FUZZ_ROOT, LABEL, check_review, file_hash, read_json, require,
)

DECLARED_FIELD_BYTES = 11
REQUESTED_BYTES = 12
ROUNDED_BLOCK_BYTES = 16
FIELD_POINTER_OFFSET = 1


def counts(values: list[int]) -> dict[str, int]:
    counter = Counter(values)
    return {str(value): counter[value] for value in sorted(counter)}


def logical_span(old: dict) -> dict:
    """Compute inclusive logical span through the first NUL in one review."""
    length = old["strlen_length"]
    offset = old["field_pointer_offset_in_block"]
    requested = old["requested_bytes"]
    rounded = old["rounded_block_bytes"]
    require((offset, requested, rounded) ==
            (FIELD_POINTER_OFFSET, REQUESTED_BYTES, ROUNDED_BLOCK_BYTES),
            "Old review uses a different allocation geometry")
    nul_in_block = offset + length
    return {
        "strlen_length": length,
        "nul_offset_from_field_start": length,
        "nul_offset_in_block": nul_in_block,
        "non_nul_bytes_beyond_declared_field":
            max(0, length - DECLARED_FIELD_BYTES),
        "logical_bytes_through_nul_beyond_declared_field":
            max(0, length + 1 - DECLARED_FIELD_BYTES),
        "logical_bytes_through_nul_beyond_requested_allocation":
            max(0, nul_in_block + 1 - requested),
        "nul_inside_reported_rounded_block": nul_in_block < rounded,
    }


def old_campaign_reviews(campaign_dir: Path) -> tuple[list[tuple[int, dict]], dict]:
    """Accept only old reviews whose hashes and case order match progress."""
    plan = read_json(campaign_dir / "plan.json")
    progress_path = campaign_dir / "progress.json"
    for attempt in range(3):
        try:
            progress = read_json(progress_path)
            break
        except (json.JSONDecodeError, ValueError):
            if attempt == 2:
                raise
            time.sleep(0.2)
    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_dir.name and
            plan.get("builds") == ["old", "new"],
            "Campaign plan/progress identity differs")
    progress_rows = {row.get("trial_label"): row
                     for row in progress.get("trials", [])
                     if isinstance(row, dict)}
    require(len(progress_rows) == len(progress.get("trials", [])),
            "Campaign progress has duplicate or malformed rows")
    reviewed: list[tuple[int, dict]] = []
    pending: list[int] = []
    batches = plan.get("batches")
    require(isinstance(batches, list) and
            plan.get("batch_count") == len(batches),
            "Campaign batch plan differs")
    expected_labels = []
    for batch in batches:
        require(isinstance(batch, dict) and
                isinstance(batch.get("trials"), list) and
                [trial.get("build") for trial in batch["trials"]] ==
                    ["old", "new"],
                "Campaign build order differs")
        expected_labels.extend(trial["trial_label"] for trial in batch["trials"])
        old_trial = batch["trials"][0]["trial_label"]
        row = progress_rows.get(old_trial)
        require(isinstance(row, dict) and row.get("build") == "old" and
                row.get("batch_index") == batch.get("index") and
                LABEL.fullmatch(old_trial) is not None,
                "Old trial is absent or mismatched")
        if row.get("state") not in ("reviewed", "review_required"):
            pending.append(batch["index"])
            continue
        path = campaign_dir / f"review-{old_trial}.json"
        require(path.is_file() and file_hash(path) == row.get("review_sha256"),
                "Recorded old review hash differs")
        review = read_json(path)
        rows = check_review(review, "old", trial=old_trial,
                            manifest_sha=plan["accepted_manifest_sha256"])
        require(review["status"] == row.get("review_status") and
                [item["id"] for item in rows] == batch.get("case_ids"),
                "Old review order or status differs from plan")
        reviewed.append((batch["index"], review))
    require(set(progress_rows) == set(expected_labels),
            "Campaign has extra or missing progress trials")
    return reviewed, {
        "campaign_id": campaign_dir.name,
        "accepted_manifest_sha256": plan["accepted_manifest_sha256"],
        "planned_batches": len(batches),
        "pending_old_batches": pending,
        "progress_status": progress.get("status"),
    }


def summarize(reviews: list[tuple[int, dict]], context: dict) -> dict:
    cases = []
    unverified = 0
    for batch_index, review in reviews:
        for row in review["rows"]:
            if row["status"] != "verified":
                unverified += 1
                continue
            cases.append({
                "batch_index": batch_index,
                "trial_label": review["trial_label"],
                "id": row["id"],
                "sha256": row["sha256"],
                "is_within_batch_baseline": row["id"] == "emf_baseline",
                "logical_span": logical_span(row["old_bfdb"]),
            })
    spans = [case["logical_span"] for case in cases]
    beyond_requested = [
        span["logical_bytes_through_nul_beyond_requested_allocation"]
        for span in spans
    ]
    return {
        "schema": "paint-emf-bfdb-logical-span-v1",
        "status": ("complete" if not context["pending_old_batches"] and
                   context["progress_status"] in ("complete", "review_required")
                   else "partial"),
        "campaign_id": context["campaign_id"],
        "accepted_manifest_sha256": context["accepted_manifest_sha256"],
        "scope": "Fixed 11-byte unterminated BFDB JPEG trigger in the EMF-first campaign",
        "declared_field_bytes": DECLARED_FIELD_BYTES,
        "requested_allocation_bytes": REQUESTED_BYTES,
        "reported_rounded_block_bytes": ROUNDED_BLOCK_BYTES,
        "field_pointer_offset_in_block": FIELD_POINTER_OFFSET,
        "planned_batches": context["planned_batches"],
        "reviewed_old_batches": len(reviews),
        "pending_old_batches": context["pending_old_batches"],
        "verified_old_cases_including_baselines": len(cases),
        "review_required_old_cases": unverified,
        "strlen_length_counts": counts([span["strlen_length"] for span in spans]),
        "logical_bytes_through_nul_beyond_declared_field_counts": counts([
            span["logical_bytes_through_nul_beyond_declared_field"]
            for span in spans]),
        "logical_bytes_through_nul_beyond_requested_allocation_counts":
            counts(beyond_requested),
        "maximum_observed_logical_bytes_beyond_requested":
            max(beyond_requested, default=None),
        "nul_inside_reported_rounded_block_count": sum(
            span["nul_inside_reported_rounded_block"] for span in spans),
        "nul_at_or_beyond_reported_rounded_block_count": sum(
            not span["nul_inside_reported_rounded_block"] for span in spans),
        "cases": cases,
        "claim_limit": (
            "This is the logical span through the first NUL, not a census of "
            "CRT machine loads or a bound on all bytes physically read. "
            "A changing span does not establish EMF control, disclosure, "
            "code execution, or CVE fix attribution."
        ),
    }


def main() -> None:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--campaign-id", required=True)
    parser.add_argument("--campaign-root", type=Path,
                        default=FUZZ_ROOT / "campaigns")
    parser.add_argument("--output", type=Path)
    args = parser.parse_args()
    require(LABEL.fullmatch(args.campaign_id) is not None,
            "Campaign ID is unsafe")
    campaign_dir = args.campaign_root / args.campaign_id
    reviews, context = old_campaign_reviews(campaign_dir)
    output = summarize(reviews, context)
    encoded = json.dumps(output, sort_keys=True)
    require("\\" not in encoded,
            "Private path entered address-free logical-span summary")
    target = (args.output or campaign_dir / "logical-span.json").resolve()
    require(target.is_relative_to(FUZZ_ROOT.resolve()),
            "Output must stay under ignored EMF fuzz directory")
    target.parent.mkdir(parents=True, exist_ok=True)
    target.write_text(json.dumps(output, indent=2) + "\n", encoding="utf-8")
    print(f"Summarized {len(reviews)} old batches, "
          f"{output['verified_old_cases_including_baselines']} verified cases, "
          f"maximum {output['maximum_observed_logical_bytes_beyond_requested']} "
          f"logical bytes beyond requested ({output['status']})")


if __name__ == "__main__":
    main()