⬢ DragonFlyBSD Kernel Audit
DF-5542 / verdict.json
← back to finding ↓ download raw
{
  "finding_id": "DF-5542",
  "status": "reproduced",
  "reproduced": true,
  "impact": "dos",
  "confidence": "certain",
  "verdict": "REPRODUCED (deterministic, 2/2 runs, hardware-free). uep_intr_callback() stashes a 1-byte interrupt transfer without validating its header (uep.c:235-237); when the stashed byte is a non-report header (96/255 values, e.g. 0x00), the continuation paths get_pkt_len()==0 branch does goto tr_setup WITHOUT clearing sc->buf_len (uep.c:222-223), so every subsequent transfer is consumed and discarded while the xfer keeps resubmitting (uep.c:261-264) - permanent loss of the touch input stream until unplug/replug (only re-attach zeroes buf_len, uep.c:338; uep_close() at uep.c:413-422 never resets the reassembly state, so close/open of /dev/uep0 does not clear the wedge). Production-code KLD harness (ueph.ko compiles the unmodified /usr/src uep.c, sha256-verified): T2 shows 10 valid transfers post-attack -> queued_reports=0, buf_len=1, submits=11, verdict=PERMANENT_STALL; T1 control shows the parser healthy on aligned streams. Availability only: no memory unsafety, no info leak, no privilege impact. fix.diff (buf_len=0 on the bad-header path + p[0] stash fix for DF-5543 + buf_len reset in uep_close) validated: patched production file shows no_stall (9x3 reports flow after one resync drop), builds as the real uep.ko under -Werror; guest source restored to stock (sha256 match).",
  "exploit_chain": "malicious/reprogrammed USB device presenting eGalax VID/PID (uep.c:289-293) or EMI garble on a real panel -> single 1-byte interrupt transfer with header byte outside {0x0a} U {x : x&0xe0 in 0x80/0xa0/0xc0/0xe0} -> unvalidated stash (uep.c:235-237) -> get_pkt_len()==0 with sc->buf_len preserved (uep.c:222-223) -> all further device input silently dropped forever while /dev/uep0 stays open and reads block -> touch panel dead until replug (DoS). No route to uid=0: the primitive is pure input availability.",
  "evidence": "run.log/run.2.log (stock, identical): T2 stall queued_reports=0 queued_bytes=0 buf_len=1 submits=11 verdict=PERMANENT_STALL; T1 control healthy; fix_run.log: T2 ... queued_reports=27 buf_len=0 verdict=no_stall; fix_build.log (real uep.ko builds with fix, -Werror); env.txt (guest uname + production-file sha256 748a6772...); VERDICT.md (full path:line trace)",
  "kernel_refs": [
    "sys/bus/u4b/input/uep.c:222",
    "sys/bus/u4b/input/uep.c:223",
    "sys/bus/u4b/input/uep.c:235",
    "sys/bus/u4b/input/uep.c:236",
    "sys/bus/u4b/input/uep.c:237",
    "sys/bus/u4b/input/uep.c:261",
    "sys/bus/u4b/input/uep.c:338",
    "sys/bus/u4b/input/uep.c:413",
    "sys/bus/u4b/input/uep.c:421"
  ],
  "poc_changes": "No seed PoC existed (new pass-2 finding). Harness authored from scratch: production uep.c compiled into ueph.ko via #include with DRIVER_MODULE/MODULE_DEPEND/MODULE_VERSION neutered and usbd_*/usb_fifo_* externals #define-renamed to fakes; one identifier corrected against the tree (usb_fifo_put_bytes_max, lowercase b). Guest build needed the production file copied into the module dir (bsd.kmod.mk include-path limitation), sha256-verified byte-for-byte.",
  "attempts": 2,
  "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": 1560,
  "guest_dirty": 0,
  "build_cmd": "guest root: cd /root/ueph && cp /usr/src/sys/bus/u4b/input/uep.c uep.c && make   (see build.sh)",
  "run_cmd": "guest root: kldload ./ueph.ko; sleep 1; kldunload ueph; dmesg | grep UEPH:   (see run.sh)",
  "code_hash": "e72b11536c427a58e9be7b435de0901be91e2997216d9df139969986448370bf",
  "notes": "Shared harness with DF-5543 (same module demonstrates both). uep has no QEMU-emulatable hardware, so the family-standard production-code KLD harness was used instead of a cloned-fd read path; the shadow FIFO records the exact usb_fifo_put_data_linear() records (sole producer->FIFO call site, uep.c:391-392) that /dev/uep0 readers would receive. Impact ceiling is device-input DoS; no escalation path exists (no attacker-controlled kernel write). Same defect exists in FreeBSD uep.c (imported code) - fix applies upstream. Guest /usr/src restored to stock after fix validation (sha256 in env.txt), module unloaded.",
  "recommended_fix": "Clear sc->buf_len before the bad-header goto tr_setup (drop stale fragment, resync on next transfer); also stash p[0] not buf[0] (DF-5543) and reset sc->buf_len in uep_close() - see fix.diff.",
  "fix_status": "fixed",
  "fix_baseline_reproduced": true,
  "fix_patched_reproduced": false,
  "fix_verdict": "Patched production file (fix.diff applied to guest /usr/src copy, harness + real uep.ko rebuilt): T2 no_stall, buf_len returns to 0, 9x3 valid reports flow after a single resync drop; T1 control unchanged. Stock behavior restored afterwards (sha256 match).",
  "fix_evidence": "fix.diff; fix_build.log (harness + real uep.ko build, -Werror clean); fix_run.log (T2 stall queued_reports=27 queued_bytes=135 buf_len=0 submits=11 verdict=no_stall)"
}