DF-5340 / verdict.json
{ "finding_id": "DF-5340", "status": "untested", "reproduced": false, "impact": "none", "confidence": "likely", "verdict": "Defect is certain at code level and its arithmetic is proven on the audited guest: when the EBDA pointer is absent (ebda_addr==0, read from BDA 0x40e at machdep.c:2275-2276), mptable_search() computes the last 1K of base memory scan target as (u_int32_t)((base_memory-1)*1024) (mptable.c:284) where base_memory = physmap[1]/1024 (machdep.c:2270) comes straight from the loader-supplied SMAP/EFI memory map with no lower bound \u2014 the same input DF-5326 proved degenerate. base_memory==1 wraps the u_int subtraction to target==0 and mptable_search_sig() KKASSERTs target!=0 (mptable.c:368) -> boot-time panic on INVARIANTS kernels (X86_64_GENERIC). base_memory==0 wraps to target=0xFFFFFC00: pmap_mapdev() (pmap.c:6192-6218, accepts ANY pa) then maps and scans the top-of-4GB MMIO hole with a span crossing the 4GB wrap instead of base memory. The guest-compiled verbatim-arithmetic reproducer prints target=0 for basemem 1 (KKASSERT panic path modeled) and 0xfffffc00 (wrapped) for basemem 0, with 2..639 producing the intended region. End-to-end kernel-boot manifestation UNTESTED: needs a crafted loader SMAP (first usable region <= 2047 bytes) unavailable on the standard QEMU/SeaBIOS guest; strictly dominated in blast radius by DF-5326s physmap[1] corruption which fires on the same input, but a distinct unguarded instance in this file.", "exploit_chain": "", "evidence": "run.log \u2014 base_memory=1 -> target=0x00000000 KERNEL PANIC (assertion target != 0, mptable.c:368); base_memory=0 -> target=0xfffffc00 ... WRAPPED past 4GB; basemem 2/16/511/638/639 -> sane scan regions. fix.diff guards the branch with base_memory > 1.", "kernel_refs": [ "sys/platform/pc64/x86_64/mptable.c:284", "sys/platform/pc64/x86_64/mptable.c:368", "sys/platform/pc64/x86_64/machdep.c:2270", "sys/platform/pc64/x86_64/machdep.c:2275", "sys/platform/pc64/x86_64/mp_machdep.c:212" ], "poc_changes": "No seed PoC existed; authored from scratch. Reproducer copies the cited mptable.c logic verbatim (u_int/u_char semantics preserved); KKASSERT is modeled as a kernel-panic path (setjmp-resumable in the harness), and pmap_mapdev/MMIO access is elided where userland cannot express it (clearly marked in the source header).", "attempts": 1, "guest_uname": "DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 root@dfbsd:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64", "runtime_sec": 300, "guest_dirty": 0, "build_cmd": "guest: cc -O2 -Wall -Wextra -o /tmp/basemem_scan_underflow /tmp/basemem_scan_underflow.c", "run_cmd": "guest: /tmp/basemem_scan_underflow", "code_hash": "d110566fcb0d0c878fa9ba53bc5fefc5e7cd8d0d2fa56f94a43c642102cc35df", "notes": "Boot-time, malicious-firmware/loader threat class (same bar as accepted DF-1034/DF-5326). Kernel-boot manifestation not armable on the standard QEMU/SeaBIOS guest (no MP-table/SMAP injection, no unprivileged in-guest path) \u2014 verification is the guest-executed verbatim-logic reproducer per the DF-5326 precedent. Guest left clean (only /tmp scratch).", "recommended_fix": "skip the last-1K base-memory scan when base_memory <= 1 (mptable.c:282-287)", "fix_status": "not_testable", "fix_baseline_reproduced": false, "fix_patched_reproduced": false, "fix_verdict": "fix.diff is authored against the read-only sys/ tree and passes git apply --check, but could not be kernel-build-validated: the bugs kernel manifestation cannot be armed on this guest (needs injected firmware tables), so there is no baseline to compare a patched kernel against.", "fix_evidence": "findings/poc/DF-5340/fix.diff (git apply --check passes); reasoning in VERDICT.md" } |