⬢ DragonFlyBSD Kernel Audit
DF-5002 / verdict.json
← back to finding ↓ download raw
{
  "finding_id": "DF-5002",
  "status": "untested",
  "reproduced": 0,
  "impact": "none",
  "confidence": "certain",
  "verdict": "UNTESTED dynamically (no miibus-attached NIC exists on the QEMU guest, so neither leak path can be driven without a custom fake-NIC scaffold), but the defect is certain by inspection: miibus_probe() kmallocs one mii_attach_args per PHY child (mii.c:157-161) and mii_probe() one mii_probe_args for the bus (mii.c:263-267), both stored as newbus ivars; newbus never frees ivars (device_delete_child, subr_bus.c:1284-1310, frees the device struct and drops the pointer; NULL only at creation, subr_bus.c:1216) and no kfree for these allocations exists anywhere in sys/ (only tlphy.c:183 / mlphy.c:218,426 free unrelated M_TEMP devlists). Consequently every failed mii_probe() leaks one mii_probe_args immediately (mii.c:274-278; bge retries up to 5x per attach, if_bge.c:2582-2589) and every miibus destroy -- NIC detach via module unload or CardBus/USB hot-removal (if_rue USB NICs use miibus) -- leaks the bus args plus one child args per PHY (~104-152 bytes/cycle). Pure CWE-401 resource leak, slow bounded heap exhaustion only; the blocks are never referenced again, so no UAF composition and no C/I impact. Severity Low.",
  "exploit_chain": "",
  "evidence": "VERDICT.md (full static proof with path:line for every claim); fixcheck-build.log (fix.diffs patched mii.c compiles clean under the kernel -Werror set as a KLD source on the guest); fix.diff (git apply --check OK)",
  "kernel_refs": [
    "sys/dev/netif/mii_layer/mii.c:157-161",
    "sys/dev/netif/mii_layer/mii.c:263-267",
    "sys/dev/netif/mii_layer/mii.c:274-278",
    "sys/dev/netif/mii_layer/mii.c:187-198",
    "sys/kern/subr_bus.c:1284-1310",
    "sys/kern/subr_bus.c:1216",
    "sys/dev/netif/bge/if_bge.c:2582-2589"
  ],
  "poc_changes": "No runtime PoC (see verdict): triggering requires miibus hardware absent from the guest; a synthetic fake-NIC scaffold would test the scaffold, not the code. Static evidence pack + compile-checked fix instead.",
  "attempts": 0,
  "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": 120,
  "guest_dirty": 0,
  "build_cmd": "fix compile-check only: guest /root/df5002chk: make -m /usr/share/mk (see fixcheck-build.log)",
  "run_cmd": "",
  "code_hash": "",
  "fix_status": "not_testable",
  "fix_baseline_reproduced": 0,
  "fix_patched_reproduced": 0,
  "fix_verdict": "fix.diff (free per-PHY mii_attach_args and the bus mii_probe_args in miibus_detach with device_set_ivars(NULL) after each free; free args on the mii_probe ENXIO path) applies cleanly and compiles under -Werror as a KLD source on the guest (fixcheck-build.log). End-to-end exercise requires miibus hardware (absent); placement verified against every NIC drivers detach path (all delete the miibus child: if_bge.c:2727, if_nfe.c:678, if_xl.c:1581, ...).",
  "fix_evidence": "fixcheck-build.log (miifix2.ko linked from patched mii.c); fix.diff (git apply --check OK)",
  "notes": "Leak of ~104-152 bytes per miibus destroy + up to 5x56 bytes per failed bge probe cycle. Unprivileged repeatable trigger requires physical access (USB NIC replug). No UAF composition possible (pointer dropped, never reused).",
  "recommended_fix": "Free the ivars miibus owns: kfree(child mii_attach_args) in miibus_detach, kfree(bus mii_probe_args) at detach end and on the mii_probe ENXIO path, NULLing ivars after each free (fix.diff)."
}