⬢ DragonFlyBSD Kernel Audit
DF-3109 / verdict.json
← back to finding ↓ download raw
{
 "finding_id": "DF-3109",
 "status": "reproduced",
 "reproduced": 1,
 "impact": "panic",
 "confidence": "certain",
 "verdict": "Crafted HAMMER1 image with a CRC-corrupted root B-Tree node panics the stock INVARIANTS kernel at mount: panic assertion error == 0 failed in hammer_init_cursor at hammer_cursor.c:202, via sys_mount -> hammer_vfs_mount -> hammer_vfs_vget -> hammer_get_inode -> hammer_init_cursor. The commented-out cleanup line sits directly beneath the assertion, so on production kernels the same trigger returns with cursor->node NULL and cursor->ip refs and the inode sh-lock held, feeding the NULL-node cursor into btree_search (left_bound deref) for the twelve ignoring callers. Root-gated (mount of crafted image); availability only, no privilege gain.",
 "exploit_chain": "",
 "evidence": "panic.txt (full dmesg panic + backtrace), run.log (craft + mount sequence), corrupt_root.c (scans CRC-valid btree nodes, flips a byte in the parent==0 root node)",
 "kernel_refs": [
  "sys/vfs/hammer/hammer_cursor.c:202",
  "sys/vfs/hammer/hammer_cursor.c:117-130",
  "sys/vfs/hammer/hammer_ondisk.c:1315-1333",
  "sys/vfs/hammer/hammer_inode.c:499"
 ],
 "poc_changes": "corrupt_root.c written from scratch: locates the root node by scanning for CRC-valid btree nodes whose parent offset is zero, then flips one byte so the stored CRC no longer matches",
 "attempts": 1,
 "guest_uname": "DragonFly dfbsd 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": 90,
 "guest_dirty": 0,
 "build_cmd": "guest: cc -O -o corrupt_root corrupt_root.c; image: vnconfig -c -S 2g /dev/vn0 h1.img && newfs_hammer -f /dev/vn0 && vnconfig -u vn0 && ./corrupt_root h1.img",
 "run_cmd": "guest: vnconfig -c -S 2g /dev/vn0 h1.img && mount_hammer /dev/vn0 /mnt/h1",
 "code_hash": "197a27654d3d3d1bfb099aadc9c48f6fcf8c77d95491e2af5617309389cfe965",
 "notes": "production-path consequence (NULL cursor->node into btree_search left_bound deref, 12 ignoring callers) traced in the finding; live panic is the INVARIANTS form fix.diff extended with the hammer_get_inode caller propagation (the first of the twelve ignoring callers; the row fix alone moved the panic to hammer_btree_cmp via that caller - captured in ab_fixed_panic2.txt - which live-confirms the finding analysis that fixing init_cursor alone is insufficient). A/B on fixed kernel #3: the same CRC-corrupt image mounts with clean EIO, no panic, guest alive (ab_fixed.log).",
 "recommended_fix": "hammer_init_cursor now unwinds via hammer_done_cursor and returns the error instead of asserting; combined-kernel A/B: mount of the same image returns clean EIO with no panic"
}