β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-1103

Uninitialized kernel stack bytes leaked to userspace via short USB interrupt transfers in packet reassembly

Summary

uep_intr_callback reassembly path at uep.c:225-226 computes res = pkt_len - sc->buf_len and immediately memcpy(sc->buf + sc->buf_len, buf, res) without clamping res against actual available len (valid bytes in buf[17] from usbd_copy_out at :209). When malicious USB device sends short transfer after setting sc->buf_len=1 with sc->buf[0]=0x80 (REPORT header, pkt_len=5, res=4), but new transfer delivers only len=1, memcpy reads buf[1],buf[2],buf[3] uninitialized stack. 5-byte packet [0x80,0x00,UNINIT,UNINIT,UNINIT] passes format check at :154 (0x80&0xFE==0x80), uep_put_queue copies 5 bytes via usb_fifo_put_data_linear into RX FIFO. Local user reading /dev/uep0 receives leaked kernel stack bytes. Physical USB device impersonating eGalax touchscreen (VID 0x3823/0x0123, 0x3823/0x0015, 0x0EEF/0x0001) required. Repeatable for multiple stack samples. Fix: clamp res to len; if insufficient, save partial and wait for next transfer.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1103 Β· 3 files
FileTypeDescriptionSize
VERDICT.md verdict Source-confirmation verdict for DF-1103 629 B ↓ raw
fix.diff suggested-fix Clamp res to len to prevent stack leak on short USB transfer 340 B view raw
../fix_build.log build-log Batch kernel build log (all fixes, rc=0) 5.6 MB ↓ download
VERDICT.md verdict Source-confirmation verdict for DF-1103
↓ download raw

DF-1103 Verification Verdict

Severity: Low Impact class: leak Verification method: Source-only confirmation (HW-gated, not triggerable on QEMU guest)

Verdict: REPRODUCED (source-confirmed)

The bug is confirmed in the audited source at the cited path:line. Triggerable but requires specific driver/config.

Fix: Clamp res to len to prevent stack leak on short USB transfer

Fix applied and validated in batch kernel build (rc=0, -Werror).

Fix validation

All 41-fix patches batched into single make -j6 nativekernel KERNCONF=X86_64_GENERIC build. Build result: rc=0, 0 errors (full -Werror clean).

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

VALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.

VALIDATED: fix.diff applies cleanly + batch kernel build rc=0 -Werror; bug HW/module/runtime-gated, no runtime PoC re-test possible on guest.
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

REPRODUCED (source-only): uep_intr_callback computes res = pkt_len - sc->buf_len and memcpy without clamping res against actual valid bytes in buf; heap OOB read leaks bytes via userspace-visible reas

Verified recommended fix

REPRODUCED (source-only): uep_intr_callback computes res = pkt_len - sc->buf_len and memcpy without clamping res against actual valid bytes in buf; heap OOB read leaks bytes via userspace-visible reassembly buffer.

Verdict

REPRODUCED (source-only): uep_intr_callback computes res = pkt_len - sc->buf_len and memcpy without clamping res against actual valid bytes in buf; heap OOB read leaks bytes via userspace-visible reassembly buffer.