DragonFlyBSD Kernel Audit
DF-2739 / run.sh
← back to finding ↓ download raw
#!/bin/csh -f
# DF-2739 run (run as root on the DragonFly guest)
# Expected on VULNERABLE kernel:
#   step 2  kldunload(vetoa) = EBUSY but kldstat shows vetoa refs=0 (live file)
#   step 3  depb load; vetoa refs=1 (dep-held)
#   step 4  kldunload(vetoa) SUCCEEDS -> vetoa freed while depb depends on it
#   step 5  kldunload(depb) -> linker_file_unload(freed chunk) -> UAF
#           (panic/corruption; console captured via serial log)
# Expected on FIXED kernel:
#   step 2  EBUSY, refs stays 1
#   step 4  EBUSY->0? no: refs=2 -> fast path, vetoa STAYS loaded
#   step 5  depb unload unloads vetoa cleanly. No UAF.
cd /tmp/kldtest
./poc