ip_input() dereferences m_pkthdr.rcvif without NULL check on the 127/8 martian test β NULL-deref panic reachable via netgraph ng_ip_input(4) which queues user mbufs with rcvif unset
Summary
The loopback-martian check at :542-548 reads m->m_pkthdr.rcvif->if_flags unconditionally, while every other rcvif use in the function is NULL-guarded. The netgraph7 ip_input node clears M_HASH and netisr_queue()s a user-supplied mbuf that was allocated on the ng socket send path with rcvif never set. Root only (creating/wiring the node requires privilege): a crafted IP packet with src or dst in 127/8 sent through the node panics the kernel. Not executed (Low; mechanism plain from source). Fix: the same NULL test the later uses have. [VERIFIED pass2: verbatim harness proves the unguarded rcvif NULL deref; sole NULL producer ng_ip_input absent from stock; guard fix A/B]
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-3322 Β· 13 files| File | Type | Description | Size | |
|---|---|---|---|---|
| README.md | β | 855 B | β raw | |
| VERDICT.md | β | 2.1 KB | β raw | |
| allruns.log | β | 4.9 KB | view raw | |
| build.sh | β | 708 B | view raw | |
| df3322.c | β | 2.0 KB | view raw | |
| fix.diff | β | 474 B | view raw | |
| fixbuild.sh | β | 394 B | view raw | |
| fixrun.sh | β | 1.1 KB | view raw | |
| fixruns.log | β | 810 B | view raw | |
| guard.h | β | 1.3 KB | view raw | |
| manifest.json | β | 798 B | view raw | |
| run.sh | β | 2.0 KB | view raw | |
| verdict.json | β | 1.6 KB | view raw |
DF-3322 -- verification pack
Method: Verbatim-interposition harness (guard-page technique; no wlan/sppp hardware on this guest) Status: REPRODUCED | impact: panic | confidence: certain
What this is
ip_input dereferences m_pkthdr.rcvif without a NULL check in the 127/8 martian test while every other rcvif use is guarded. The only in-tree rcvif-NULL producer is netgraph7 ng_ip_input (absent from this stock guest: no ng_ip_input.ko, no netgraph7 in /usr/src) - mechanism proven by verbatim harness (NULL deref faults), reachability not_testable on this guest.
Build
./build.sh
Run
df3322 null
(success criterion: see VERDICT.md)
Evidence
rcvif=NULL case rc=139 (harness); control (valid ifnet) rc=0; FIXED NULL guard clean
Kernel references: sys/netinet/ip_input.c:541-548, sys/netgraph7/ng_ip_input.c:118-125
DF-3322 -- VERDICT
REPRODUCED (impact=panic, 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
ip_input dereferences m_pkthdr.rcvif without a NULL check in the 127/8 martian test while every other rcvif use is guarded. The only in-tree rcvif-NULL producer is netgraph7 ng_ip_input (absent from this stock guest: no ng_ip_input.ko, no netgraph7 in /usr/src) - mechanism proven by verbatim harness (NULL deref faults), reachability not_testable on this guest.
How it was verified
- Method: Verbatim-interposition harness (guard-page technique; no wlan/sppp hardware on this guest)
- Kernel references: sys/netinet/ip_input.c:541-548, sys/netgraph7/ng_ip_input.c:118-125
- Evidence: rcvif=NULL case rc=139 (harness); control (valid ifnet) rc=0; FIXED NULL guard clean
- 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: fixed -- Harness A/B (fixruns.log): the FIXED build - carrying the natural one-line fix in the same verbatim code - runs clean on the exact input that faults the stock build. Kernel not rebuilt for these Low/hardening items. 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
fixedHarness A/B (fixruns.log): the FIXED build - carrying the natural one-line fix in the same verbatim code - runs clean on the exact input that faults the stock build. Kernel not rebuilt for these Low/hardening items.
Confirmed kernel references
Detail
Evidence (decisive lines)
rcvif=NULL case rc=139 (harness); control (valid ifnet) rc=0; FIXED NULL guard clean
Verified recommended fix
fix.diff
Verdict
ip_input dereferences m_pkthdr.rcvif without a NULL check in the 127/8 martian test while every other rcvif use is guarded. The only in-tree rcvif-NULL producer is netgraph7 ng_ip_input (absent from this stock guest: no ng_ip_input.ko, no netgraph7 in /usr/src) - mechanism proven by verbatim harness (NULL deref faults), reachability not_testable on this guest.
No comments yet.