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

Python · 4,763 bytes
#!/usr/bin/env python3
"""Private, bounded screenshot-to-fixture correlation for Remove Background.

This is diagnostic only. A best partial match never satisfies the guest's
exact-raster preflight. Keep output under ignored lab/output or lab/results.
"""

from __future__ import annotations

import argparse
import hashlib
import json
from pathlib import Path

from PIL import Image


ROOT = Path(__file__).resolve().parents[2]


def sha256(path: Path) -> str:
    return hashlib.sha256(path.read_bytes()).hexdigest()


def main() -> None:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--fixture-id", required=True)
    parser.add_argument("--screenshot", type=Path, required=True)
    parser.add_argument("--anchor", type=int, nargs=2, metavar=("X", "Y"), required=True)
    parser.add_argument("--radius", type=int, default=16)
    parser.add_argument("--output", type=Path,
                        help="Optional private JSON path under lab/output or lab/results")
    args = parser.parse_args()
    if not 0 <= args.radius <= 32:
        parser.error("radius must be between 0 and 32")
    manifest = json.loads((ROOT / "lab/corpus/followup/generated/manifest.json").read_text())
    cases = [case for case in manifest["cases"] if case["id"] == args.fixture_id]
    if len(cases) != 1 or cases[0].get("same_raster_group") != "removebg_stride_33x17":
        parser.error("fixture must be one pinned Remove Background stride case")
    case = cases[0]
    fixture_path = ROOT / "lab/corpus/followup/generated" / case["file"]
    if sha256(fixture_path) != case["sha256"]:
        parser.error("fixture hash differs from the frozen corpus manifest")
    if not args.screenshot.is_file():
        parser.error("screenshot is absent")
    with Image.open(fixture_path) as source_image, Image.open(args.screenshot) as screen_image:
        source = source_image.convert("RGB")
        screen = screen_image.convert("RGB")
        width, height = source.size
        if (width, height) != (33, 17):
            parser.error("fixture dimensions differ from the pinned 33x17 profile")
        transparent = tuple(case.get("transparent_pixel_xy", [-1, -1]))
        minimum = width * height - int(transparent[0] >= 0)
        best = (-1, -1, -1, None)
        exact = []
        anchor_x, anchor_y = args.anchor
        for dy in range(-args.radius, args.radius + 1):
            for dx in range(-args.radius, args.radius + 1):
                ox, oy = anchor_x + dx, anchor_y + dy
                if ox < 0 or oy < 0 or ox + width > screen.width or oy + height > screen.height:
                    continue
                mismatches = [
                    (x, y) for y in range(height) for x in range(width)
                    if source.getpixel((x, y)) != screen.getpixel((ox + x, oy + y))
                ]
                equal = width * height - len(mismatches)
                unexpected = [xy for xy in mismatches if xy != transparent]
                if equal > best[0]:
                    best = (equal, ox, oy, mismatches)
                if not unexpected and equal >= minimum:
                    exact.append((ox, oy, equal))
        if best[0] < 0:
            parser.error("bounded search had no candidate inside the screenshot")
        mismatch_rows = [sum(y == row for _, y in best[3]) for row in range(height)]
        mismatch_cols = [sum(x == col for x, _ in best[3]) for col in range(width)]
        record = {
            "schema": "paint-ab-removebg-private-canvas-diagnostic-v1",
            "status": "diagnostic_only_not_a_raster_gate",
            "fixture_id": args.fixture_id,
            "fixture_sha256": case["sha256"],
            "screenshot_sha256": sha256(args.screenshot),
            "anchor": list(args.anchor),
            "radius": args.radius,
            "best_origin": [best[1], best[2]],
            "best_equal_pixels": best[0],
            "total_pixels": width * height,
            "best_mismatch_count_by_row": mismatch_rows,
            "best_mismatch_count_by_column": mismatch_cols,
            "exact_candidate_count": len(exact),
            "unique_exact_origin": list(exact[0][:2]) if len(exact) == 1 else None,
        }
    rendered = json.dumps(record, indent=2) + "\n"
    if args.output:
        resolved = args.output.resolve()
        allowed = (ROOT / "lab/output").resolve(), (ROOT / "lab/results").resolve()
        if not any(resolved.is_relative_to(base) for base in allowed):
            parser.error("diagnostic output must stay under ignored lab/output or lab/results")
        resolved.parent.mkdir(parents=True, exist_ok=True)
        resolved.write_text(rendered, encoding="utf-8")
    print(rendered, end="")


if __name__ == "__main__":
    main()