DF-4008 / verdict.json
{ "finding_id": "DF-4008", "status": "inconclusive", "reproduced": 0, "impact": "none", "confidence": "likely", "verdict": "Mechanism certain at source level, hardware-gated live: mpr_diag_register() overwrites the single shared fw_diag_{dmat,buffer,map,busaddr} trio without checking it is free, while per-type fw_diag_buffer_list[].size keeps the stale (larger) size; with two diag types enabled by the IOC (mpr.c:588-599 enables every advertised capability) an ioctl user gets (1) a stale-size OOB copyout (kernel disclosure up to first-registration size minus live size), (2) a cross-type free of the other types DMA resources, (3) a NULL-dmat bus_dmamap_sync panic or UAF read on the next READ_BUFFER. Deterministic, no race (serialized by MPR_FLAGS_BUSY). No LSI SAS controller on the audit guest, so not live-reproduced; verbatim userspace replication on the guest shows all three transitions (1,044,480-byte OOB disclosure figure, cross-free, NULL-deref point).", "exploit_chain": "operator-group ioctl user: REGISTER(TRACE,1MB) -> REGISTER(SNAPSHOT,4KB) -> READ_BUFFER(uidTRACE,0,1MB) discloses ~1MB past a 4KB DMA allocation to userspace; UNREGISTER(uidTRACE) frees SNAPSHOTs resources; READ_BUFFER(uidSNAPSHOT) panics (bus_dmamap_sync(NULL), mpr_user.c:1805) or reads freed memory.", "evidence": "replication_run.log (all five steps with the three failure shapes printed), diag_statemachine.c (verbatim port of mpr_diag_register/unregister/read_buffer modulo bus_dma stubs), VERDICT.md root-cause path:line trace", "kernel_refs": [ "sys/dev/raid/mpr/mpr_user.c:1504", "sys/dev/raid/mpr/mpr_user.c:1508", "sys/dev/raid/mpr/mpr_user.c:1523", "sys/dev/raid/mpr/mpr_user.c:1596", "sys/dev/raid/mpr/mpr_user.c:1612", "sys/dev/raid/mpr/mpr_user.c:1681", "sys/dev/raid/mpr/mpr_user.c:1798", "sys/dev/raid/mpr/mpr_user.c:1805", "sys/dev/raid/mpr/mpr_user.c:1812", "sys/dev/raid/mpr/mprvar.h:410", "sys/dev/raid/mpr/mprvar.h:440", "sys/dev/raid/mpr/mpr.c:588" ], "poc_changes": "n/a (new finding; replication authored during pass 2)", "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": 60, "guest_dirty": 0, "build_cmd": "cd /tmp && cc -O2 -Wall -o diag_statemachine diag_statemachine.c", "run_cmd": "/tmp/diag_statemachine", "code_hash": "sha256: see diag_statemachine.c", "notes": "Privileged surface (0640 root:operator). Impact ceiling: kernel heap disclosure + panic/DoS; no write primitive in this path. Live trigger needs FW accepting DIAG_BUFFER_POST and advertising >=2 diag types.", "recommended_fix": "Make the diag DMA trio per-type inside mpr_fw_diagnostic_buffer_t (or refuse REGISTER while sc->fw_diag_buffer is live); bound READ_BUFFER against the live allocation size.", "fix_status": "untested", "fix_baseline_reproduced": 0, "fix_patched_reproduced": 0, "fix_verdict": "fix.diff not yet authored for this finding (see VERDICT.md sketch: per-type dmat/map/buffer/busaddr fields)", "fix_evidence": "" } |