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

Unvalidated NIC descriptor index in RX mismatch recovery causes OOB kernel heap access

Summary

bge_rxeof at if_bge.c:3061: rxidx=cur_rx->bge_idx (uint16 from NIC DMA, 0..65535). Mismatch recovery paths at :3079 bge_setup_rxdesc_jumbo(sc,rxidx) and :3105 bge_setup_rxdesc_std(sc,rxidx) use unvalidated rxidx. bge_rx_jumbo_ring[256] and bge_rx_std_ring[512] indexed OOB for rxidx>=256/512. Also OOB deref of rc->bge_mbuf->m_len from garbage chain pointer. All other error paths in same function correctly use validated sc->bge_jumbo/sc->bge_std. Requires NIC firmware bug, DMA corruption, or NIC errata to trigger. Fix: use sc->bge_jumbo/sc->bge_std in mismatch paths matching all other error paths.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1159 Β· 3 files
FileTypeDescriptionSize
VERDICT.md verdict Source-confirmation verdict for DF-1159 634 B ↓ raw
fix.diff suggested-fix Use validated sc->bge_jumbo/sc->bge_std in mismatch recovery paths 667 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-1159
↓ download raw

DF-1159 Verification Verdict

Severity: Low Impact class: oob 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: Use validated sc->bge_jumbo/sc->bge_std in mismatch recovery paths

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): bge_rxeof uses rxidx=cur_rx->bge_idx (u16 from NIC DMA) in bge_setup_rxdesc_jumbo/std without bounds validation; corrupted descriptor -> OOB.

Verified recommended fix

REPRODUCED (source-only): bge_rxeof uses rxidx=cur_rx->bge_idx (u16 from NIC DMA) in bge_setup_rxdesc_jumbo/std without bounds validation; corrupted descriptor -> OOB.

Verdict

REPRODUCED (source-only): bge_rxeof uses rxidx=cur_rx->bge_idx (u16 from NIC DMA) in bge_setup_rxdesc_jumbo/std without bounds validation; corrupted descriptor -> OOB.