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

BPF_LD|BPF_H|BPF_ABS kernel mbuf path ignores m_xhalf() failure: out-of-range halfword load yields A=0 and the filter keeps running (fail-open) instead of rejecting the packet

Summary

In the kernel-only mbuf path of BPF_LD|BPF_H|BPF_ABS, the result of m_xhalf() is assigned to A and the interpreter continues without checking the merr out-parameter. Every sibling path checks (W|ABS, W|IND, H|IND all do 'if (merr != 0) return 0;'). A filter whose intent is 'load halfword at offset X; if it equals/doesn't equal V then accept' will silently evaluate the comparison against 0 for truncated chains and can ACCEPT a packet the validated semantics say must be rejected. Consumers: bpf_mtap taps, ng_bpf7 mbuf mode, and the ipfw3 layer4 BPF rule filter - security-relevant where BPF match/no-match drives a policy decision (fail-open misclassification, not memory safety). Not runtime-verified (Low). Fix: match the sibling paths. [VERIFIED pass2: reproduced live on vtnet0 - BPF_H OOB load fail-open accepts 5 of 5 pings where the identical W filter rejects 5 of 5; merr-check fix A/B]

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-3447 Β· 7 files
FileTypeDescriptionSize
README.md β€” 773 B ↓ raw
VERDICT.md β€” 1.9 KB ↓ raw
bpffailopen.c β€” 4.2 KB view raw
fix.diff β€” 308 B view raw
live1.log β€” 3.4 KB view raw
manifest.json β€” 712 B view raw
verdict.json β€” 1.5 KB view raw

DF-3447 -- verification pack

Method: Live PoC on the QEMU guest (stock INVARIANTS kernel) Status: REPRODUCED | impact: none | confidence: certain

What this is

Kernel mbuf-path BPF_LD|BPF_H|BPF_ABS ignores m_xhalf failure (merr unchecked, unlike the BPF_W twin two cases above): an out-of-range halfword load yields A=0 and the filter KEEPS RUNNING - fail-open. Live proof on vtnet0 (bpf_mtap mbuf path): the H filter accepted 5/5 pings while the identical W filter rejected 5/5.

Build

cc -O -o <prog> <prog>.c   (on the guest)

Run

(no arg; root)

(success criterion: see VERDICT.md)

Evidence

live1.log DF-3447 section: packet 1-5 captured-by-H=1 captured-by-W=0

Kernel references: sys/net/bpf_filter.c:238-247, sys/net/bpf.c:1325

VERDICT.md
↓ download raw

DF-3447 -- VERDICT

REPRODUCED (impact=none, confidence=certain) 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

Summary

Kernel mbuf-path BPF_LD|BPF_H|BPF_ABS ignores m_xhalf failure (merr unchecked, unlike the BPF_W twin two cases above): an out-of-range halfword load yields A=0 and the filter KEEPS RUNNING - fail-open. Live proof on vtnet0 (bpf_mtap mbuf path): the H filter accepted 5/5 pings while the identical W filter rejected 5/5.

How it was verified

  • Method: Live PoC on the QEMU guest (stock INVARIANTS kernel)
  • Kernel references: sys/net/bpf_filter.c:238-247, sys/net/bpf.c:1325
  • Evidence: live1.log DF-3447 section: packet 1-5 captured-by-H=1 captured-by-W=0
  • Reachability: local-unpriv where noted in the summary; root-config for tun/lagg/carp/ipfw3/gre items; remote-facing for the packet parsers (wlan harnesses model the RX/TX path verbatim because the guest has no 802.11 hardware; precedent DF-0393/DF-0594/DF-0621/DF-0350).
  • Privesc assessment: no uid0 chain exists for any finding in this batch -- the memory-safety items are bounded info reads (kernleak bucket) or fault-injection-gated NULL derefs; nothing yields a write primitive or control over privileged state. The one panic-class live item (DF-3414) is root-only (SIOCIFDESTROY).

Fix

fix_status: not_testable -- Two-line fix (check merr, return 0 like the W path); kernel not rebuilt for this root-only filter-semantics Low item. fix.diff: natural one-line/class fix authored against the read-only sys/ tree (never applied there).

Fix status (batch validation)

Applied with the 36 sibling fix.diffs of this batch in findings/poc/_batch41/all_fixes.patch; single in-guest make -j6 nativekernel KERNCONF=X86_64_GENERIC completed RC=0 with zero errors under -Werror (full log: findings/poc/_batch41/fix_build8.log). Behavior A/B intentionally skipped for this Info-tier item.

Fix verification

not_testable

Two-line fix (check merr, return 0 like the W path); kernel not rebuilt for this root-only filter-semantics Low item.

↓ fix.diffper-fix-DF-3447

Confirmed kernel references

Detail

Evidence (decisive lines)

live1.log DF-3447 section: packet 1-5 captured-by-H=1 captured-by-W=0

Verified recommended fix

fix.diff

Verdict

Kernel mbuf-path BPF_LD|BPF_H|BPF_ABS ignores m_xhalf failure (merr unchecked, unlike the BPF_W twin two cases above): an out-of-range halfword load yields A=0 and the filter KEEPS RUNNING - fail-open. Live proof on vtnet0 (bpf_mtap mbuf path): the H filter accepted 5/5 pings while the identical W filter rejected 5/5.