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

Python · 6,845 bytes
#!/usr/bin/env python3
"""Offline tests for the signed Fill loop census and private log inspector."""

from __future__ import annotations

import unittest

from build_fill_bounds_profile import READS
from build_fill_loop_census import LINE_BREAK, build
from inspect_fill_loop_census import inspect


def log_text(*, map_address: str = "2000", pixel_address: str = "1000",
             total: int = 2, violations: int = 0,
             first_violation: str = "", stride: str = "40") -> str:
    return "\n".join([
        f"PAINT_FILL_LOOP_BITMAP=10:10:{stride}:1000",
        f"PAINT_FILL_LOOP_READ=seed_pixel:{pixel_address}:4",
        "PAINT_FILL_LOOP_MAP_REQUEST=32",
        "PAINT_FILL_LOOP_MAP_BASE=2000",
        f"PAINT_FILL_LOOP_READ=vertical_map:{map_address}:4",
        first_violation,
        f"PAINT_FILL_LOOP_END_TOTAL={total}",
        f"PAINT_FILL_LOOP_MAP_VIOLATIONS={violations}",
    ])


def heap_lock_record(header: str = "ff0") -> str:
    return "\n".join([
        "PAINT_TRACE_HIT=fill_deep_lock_success",
        "Allocation status        : Variable size allocated chunk.",
        f"Chunk header address     : {header}",
        "Chunk size (bytes)       : 1040",
        "Chunk unused bytes       : 0",
    ]) + "\n"


def heap_map_record(address: str = "2000", requested: int = 32) -> str:
    return "\n".join([
        "PAINT_TRACE_HIT=fill_bounds_map_alloc_return",
        "Allocation status        : LFH Allocated",
        f"User requested size      : {requested} Bytes",
        "Unused bytes             : 0",
        f"Block Address            : 0x{address}",
        f"Block Size               : {requested} Bytes",
    ]) + "\n"


class LoopCensusTests(unittest.TestCase):
    def test_builds_all_repeating_signed_sites(self) -> None:
        for build_name in ("old", "new"):
            with self.subTest(build=build_name):
                script, manifest = build(build_name)
                rendered = script.read_text(encoding="utf-8")
                for site in READS[build_name]:
                    line = next(row for row in rendered.splitlines()
                                if row.startswith(f"bu BasePaint+0x{site.rva:X} "))
                    self.assertIn(LINE_BREAK.replace('"', '\\"'), line)
                    self.assertNotIn(f"bu /1 BasePaint+0x{site.rva:X} ", rendered)
                    self.assertIn(f"PAINT_FILL_LOOP_READ={site.label}:", rendered)
                self.assertEqual(rendered.count("PAINT_FILL_LOOP_READ="), 13)
                self.assertIn("PAINT_FILL_LOOP_END_TOTAL", rendered)
                self.assertIn("PAINT_FILL_LOOP_BITMAP", rendered)
                for marker in ("PAINT_FILL_LOOP_BITMAP=", "PAINT_FILL_LOOP_MAP_BASE=",
                               "PAINT_FILL_LOOP_END_TOTAL="):
                    line = next(row for row in rendered.splitlines() if marker in row)
                    self.assertIn(LINE_BREAK.replace('"', '\\"'), line)
                self.assertIn('"loop_census"', manifest.read_text(encoding="utf-8"))

    def test_valid_old_row_and_map(self) -> None:
        result = inspect(log_text(), "old")
        self.assertEqual(result["read_event_count"], 2)
        self.assertEqual(result["map_reads_outside_requested_span"], 0)
        self.assertEqual(result["pixel_reads_outside_declared_rows"], 0)

    def test_cdb_concatenates_tokens_and_echoes_format_definitions(self) -> None:
        # WinDbg's .printf output can share a line with the next marker. Its
        # breakpoint-list echo also contains format strings that are not hits.
        echoed = ('0:001> bu BasePaint+0xC6BD '
                  '".printf \\"PAINT_FILL_LOOP_READ=seed_pixel:%p:4\\n\\"" '
                  '0:001> bu BasePaint+0xC68D '
                  '".printf \\"PAINT_FILL_LOOP_BITMAP=%x:%x:%x:%p\\n\\"" ')
        result = inspect(echoed + log_text().replace("\n", " "), "old")
        self.assertEqual(result["read_event_count"], 2)
        self.assertTrue(result["execute_total_matches"])
        self.assertEqual(result["map_reads_outside_requested_span"], 0)

    def test_truncated_read_stream_fails_closed(self) -> None:
        with self.assertRaisesRegex(ValueError, "differs"):
            inspect(log_text(total=3), "old")

    def test_map_violation_reconciles_with_debugger(self) -> None:
        result = inspect(log_text(map_address="2020", violations=1,
                                  first_violation="PAINT_FILL_LOOP_FIRST_MAP_VIOLATION=2020:4"),
                         "old")
        self.assertEqual(result["map_reads_outside_requested_span"], 1)
        with self.assertRaisesRegex(ValueError, "counter differs"):
            inspect(log_text(map_address="2020"), "old")

    def test_declared_pixel_row_violation(self) -> None:
        result = inspect(log_text(pixel_address="1041"), "old")
        self.assertEqual(result["pixel_reads_outside_declared_rows"], 1)

    def test_negative_stride_row(self) -> None:
        # Scan0 points to the highest row; logical row 1 starts 64 bytes lower.
        raw = log_text(pixel_address="fc0", stride="ffffffc0")
        result = inspect(raw, "old")
        self.assertEqual(result["bitmap_stride"], -64)
        self.assertEqual(result["pixel_reads_outside_declared_rows"], 0)

    def test_pixel_reads_checked_against_backend_heap_user_end(self) -> None:
        result = inspect(heap_lock_record() + log_text(pixel_address="13fc"), "old")
        self.assertEqual(result["pixel_backend_heap_user_bytes"], 1024)
        self.assertTrue(result["pixel_scan0_is_backend_heap_user_start"])
        self.assertEqual(result["pixel_reads_outside_reported_heap_user_span"], 0)
        self.assertEqual(result["minimum_pixel_bytes_from_read_end_to_heap_user_end"], 0)

    def test_mismatched_scan0_and_heap_user_start_fails_closed(self) -> None:
        with self.assertRaisesRegex(ValueError, "Scan0"):
            inspect(heap_lock_record(header="fe0") + log_text(), "old")

    def test_map_reads_checked_against_measured_lfh_user_span(self) -> None:
        raw = log_text().replace("PAINT_FILL_LOOP_MAP_BASE=2000",
                                 heap_map_record() + "PAINT_FILL_LOOP_MAP_BASE=2000")
        result = inspect(raw, "old")
        self.assertEqual(result["map_lfh_heap_user_bytes"], 32)
        self.assertTrue(result["map_return_is_lfh_heap_user_start"])
        self.assertEqual(result["map_reads_outside_reported_heap_user_span"], 0)

    def test_map_return_and_lfh_block_mismatch_fails_closed(self) -> None:
        raw = log_text().replace("PAINT_FILL_LOOP_MAP_BASE=2000",
                                 heap_map_record(address="3000") +
                                 "PAINT_FILL_LOOP_MAP_BASE=2000")
        with self.assertRaisesRegex(ValueError, "Map return"):
            inspect(raw, "old")


if __name__ == "__main__":
    unittest.main()