{
  "finding_id": "DF-3408",
  "status": "reproduced",
  "reproduced": 1,
  "impact": "dos",
  "confidence": "certain",
  "verdict": "Reproduced deterministically: 30000 EFAULTing 8KB writes to /dev/tun moved mbufs in use from 8 to 30007 (exactly +1 mbuf per faulted write); a control run with both pages readable left the count flat (30007 before and after). Root cause: tunwrites mbuf loop (if_tun.c:875-882) pre-allocates the next MGET (:880-881) which is never linked when uiomove faults with uio_resid>0, and the error path frees only the linked chain (m_freem(top), :884-885). Privileged-only (tunopen is SYSCAP_RESTRICTEDROOT-gated, if_tun.c:283): a root-triggered kernel mbuf-exhaustion primitive. fix.diff (m_freem(m) of the spare) built into the patched kernel and validated: same PoC leaves the mbuf count flat. Fix validated: same PoC on the patched kernel leaves the mbuf count flat (8->7 over 30000 faulted writes).",
  "exploit_chain": "root: open /dev/tun, write() a buffer whose second page is PROT_NONE -> uiomove EFAULT with resid>0 -> spare MGET leaked -> repeat ~kern.ipc.nmbclusters times -> mbuf/cluster pool exhaustion -> networking DoS system-wide.",
  "evidence": [
    "run.log \u2014 BEFORE 8/146632 mbufs, 30000 faulted writes, AFTER 30007/146632",
    "run.control.log \u2014 control: 20000 successful writes, count flat 30007->30007",
    "run.fix.log \u2014 patched kernel: 30000 faulted writes, count flat",
    "fix.diff \u2014 one-line m_freem(m) for the unlinked spare",
    "VERDICT.md \u2014 full narrative"
  ],
  "kernel_refs": [
    "sys/net/tun/if_tun.c:869-888",
    "sys/net/tun/if_tun.c:283"
  ],
  "poc_changes": "PoC written fresh for this finding (no seed). None needed after first build.",
  "attempts": 3,
  "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": 95,
  "guest_dirty": 1,
  "build_cmd": "cc -O2 -o /root/tun_eault_leak /root/tun_eault_leak.c",
  "run_cmd": "/root/tun_eault_leak 30000",
  "code_hash": "bf17caddb37ae75ba92215b6ef8a64a84398223f4b2ee6bcef1af3ad561f8ca0",
  "notes": "Deterministic (2/2 leak runs exact +1/write; control flat; patched flat). Twin of tap(4) DF-3406; tap needs the same one-line fix. Escalation N/A: leak requires root to reach tunwrite. Guest reset with-src after validation.",
  "recommended_fix": "Free the unlinked spare mbuf on the uiomove error path: add m_freem(m) beside m_freem(top) in tunwrites error branch.",
  "fix_status": "fixed",
  "fix_kernel_uname": "DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #1: Sat Sep 12 09:05:29 UTC 2026 root@dfbsd:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64",
  "fix_baseline_reproduced": 1,
  "fix_patched_reproduced": 0,
  "fix_verdict": "fix.diff (m_freem(m) of the unlinked spare in tunwrites error branch) built into the validated kernel (kernel #1 09:05:29, same build as DF-3407 v3): 30000 faulted writes leave mbuf count flat (8 -> 7, noise) vs +29999 on baseline. Fix confirmed.",
  "fix_evidence": "run.fix.log; fix.diff; fix_kernel_info.txt"
}