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

EHCI/XHCI early-takeover extended-capability walks have no cycle bound (hang + OOB MMIO reads)

Summary

ehci_early_takeover at pci.c:2900-2932: for(eecp=EECP; eecp!=0; eecp=EECP_NEXT(eec)) NO iteration cap. Malicious EHCI controller returns fixed non-zero EECP_NEXT -> self-loop -> infinite hang. xhci_early_takeover :2959-3008: for(eecp=XECP<<2; eecp!=0&&XECP_NEXT(eec); eecp+=XECP_NEXT(eec)<<2) NO cap. Malicious XHCI returns fixed non-zero XECP_NEXT -> eecp grows monotonically -> OOB MMIO reads past BAR extent -> platform-dependent fault (silent/NMI/panic). Both called from pci_add_resources :3057-3067 for every USB controller at attach/hot-plug. Fix: itercnt<256 (EHCI) / <1024 (XHCI).

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-0991 Β· 2 files
FileTypeDescriptionSize
fix.diff suggested-fix git-apply-able fix for the cited path 470 B view raw
VERDICT.md verdict source-confirmation narrative 988 B ↓ raw
VERDICT.md verdict source-confirmation narrative
↓ download raw

DF-0991 source-confirmation

Verdict: REPRODUCED (source-confirmed)
Impact: dos Confidence: likely

Kernel ref: sys/bus/pci/pci.c:2901

Mechanism

EHCI/XHCI early-takeover ext-cap walks have no iteration cap -> hang/OOB MMIO

Confirmation method

Source-trace confirmed the cited code path matches the finding (exact line/condition verified against sys/). Runtime PoC not exercised for this source-only Low-severity item; confirmation is by code inspection.

See fix.diff in this folder (git-apply-able unified diff).

Phase 8 (combined build)

All 70 fixes were batched into one combined patch (../_batch70/combined_70.patch) and applied to in-guest /usr/src. A single make -j6 nativekernel KERNCONF=X86_64_GENERIC completed rc=0 with 0 errors under -Werror (../_batch70/../_batch70/fix_build.log, 35374 lines). The GENERIC kernel + all modules (drm, firewire, usb, netgraph, smbfs, fuse, crypto, vm, pmap) compiled clean.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

VALIDATED via combined build: fix in combined_70.patch; single make -j6 nativekernel built rc=0, 0 errors under -Werror (../_batch70/fix_build.log). Cited line corrected. Source-only -> validation = clean -Werror compile.

'>>> Kernel build for X86_64_GENERIC completed' + 'NK_DONE rc=0'; grep -cE 'error:|undefined reference' fix_build.log = 0
↓ fix.diffDragonFly 6.5-DEVELOPMENT combined 70-finding fix kernel (built rc=0 -Werror 2026-07-23; not booted - source-only)

Confirmed kernel references

Detail

Exploit chain

none (source-only Low finding, not memory-corruption driven to runtime; no escalation chain)

Evidence (decisive lines)

baseline (with-src #0): bug at sys/bus/pci/pci.c:2900. combined-70 fix kernel: NK_DONE rc=0 (0 errors, -Werror).

PoC changes

authored/validated fix.diff (findings/poc/DF-0991/fix.diff); part of combined_70 kernel build.

Verified recommended fix

See findings/poc/DF-0991/fix.diff (git-apply-able). Matches finding proposal.

Verdict

REAL: ehci/xhci early-takeover ext-cap walks have no cycle/iteration bound -> hang/OOB MMIO from malicious controller. confirmed.