bpf_mtap_hdr submits partially-initialized stack mbuf: bpf_mtap reads uninitialized m_pkthdr.rcvif
Summary
bpf_mtap_hdr(:1347-1393): allocates only struct m_hdr on stack, initializes mh_flags/next/len/data but NOT m_pkthdr. Casts to struct mbuf* hands to bpf_mtap(). bpf_mtap(:1322) reads m->m_pkthdr.rcvif in control-flow check (!bd_seesent&&rcvif==NULL). m_pkthdr past end of stack m_hdr -> reads adjacent uninitialized stack bytes. Contrast bpf_ptap(:1377-1393) correctly inits rcvif. Rare driver caller + bd_seesent cleared. No confirmed leak to userspace (bpf_mcopy uses initialized m_len/m_data/m_next).
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0433 Β· 2 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | source verification verdict | 699 B | β raw |
| fix.diff | suggested-fix | fix for uninit bug | 539 B | view raw |
DF-0433 - Verification Verdict
Verdict: REPRODUCED (source-only confirmation)
Bug class: uninit
Impact: dos
Source file: sys/net/bpf.c
Mechanism
CONFIRMED: bpf_mtap_hdr allocates only struct m_hdr on stack, doesn't init m_pkthdr. bpf_mtap reads m->m_pkthdr.rcvif. Fix: use full struct mbuf.
Fix
See fix.diff for the git-apply-able patch.
Build validation
Combined kernel build with all 70 Low-severity fixes: rc=0, -Werror.
All fixes compile cleanly in X86_64_GENERIC kernel configuration.
Guest: 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
Fix verification
fixedVALIDATED: fix.diff compiles cleanly in combined kernel build (rc=0, -Werror). Source trace confirms bug at sys/net/bpf.c:1347.
Combined build: 70 fix.diffs applied to /usr/src, nativekernel KERNCONF=X86_64_GENERIC rc=0 -Werror. All fixes compile.
Confirmed kernel references
- s
- y
- s
- /
- n
- e
- t
- /
- b
- p
- f
- .
- c
- :
- 1
- 3
- 4
- 7
Detail
Exploit chain
none (non-corruption Low severity finding; source-only confirmation)
Evidence (decisive lines)
Source-traced at sys/net/bpf.c:1347. Combined kernel build with all 70 fixes: rc=0, -Werror.
PoC changes
Created fix.diff for DF-0433. No PoC binary (source-only verification).
Verified recommended fix
Use full struct mbuf instead of m_hdr. Supersedes finding proposal.
Verdict
CONFIRMED source-only: bpf_mtap_hdr only allocates m_hdr, no m_pkthdr init. bpf_mtap reads rcvif.
No comments yet.