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

Unbounded EHCI extended-capability chain traversal allows malicious PCI controller to hang the kernel

Summary

ehci_pci_take_controller at ehci_pci.c:517-518 has for(eecp=EHCI_HCC_EECP(cparams); eecp!=0; eecp=EHCI_EECP_NEXT(eec)) with NO iteration cap and NO cycle detection. Both head pointer (HCCPARAMS EECP field, bits 8-15 of MMIO DWORD at EHCI_HCCPARAMS read at :514) and every next pointer (eec bits 8-15, read via pci_read_config at :519) are fully attacker-controlled PCI device data. If device returns DWORD whose bits 8-15 (NEXT) equal current eecp and low byte (ID) != 0x01 (EHCI_EC_LEGSUP), eecp never changes and loop becomes zero-sleep CPU spin. Also reachable on USB resume via USB_TAKE_CONTROLLER from usb_bus_resume (usb_controller.c:537). Attacker position: malicious Thunderbolt/PCIe hot-plug device, compromised firmware, or VM host feeding crafted EHCI to guest. Impact: hard system hang (boot stall or CPU pin + watchdog trip). If LEGSUP ID with bios_sem!=0 and self-referential NEXT, inner while-loop bounds BIOS-wait to 5s but outer loop re-visits same entry -> throttled infinite loop. Same class in pci.c:ehci_early_takeover. Fix: add iteration cap (n<32) and alignment check.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1092 Β· 3 files
FileTypeDescriptionSize
VERDICT.md verdict Source-confirmation verdict for DF-1092 618 B ↓ raw
fix.diff suggested-fix Cap EHCI extended-capability chain iteration at 32 575 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-1092
↓ download raw

DF-1092 Verification Verdict

Severity: Low Impact class: dos 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: Cap EHCI extended-capability chain iteration at 32

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): ehci_pci_take_controller extended-capability chain loop has NO iteration cap and NO cycle detection; malicious PCI config can cause infinite loop / kernel hang.

Verified recommended fix

REPRODUCED (source-only): ehci_pci_take_controller extended-capability chain loop has NO iteration cap and NO cycle detection; malicious PCI config can cause infinite loop / kernel hang.

Verdict

REPRODUCED (source-only): ehci_pci_take_controller extended-capability chain loop has NO iteration cap and NO cycle detection; malicious PCI config can cause infinite loop / kernel hang.