rtsock message builders fully trust producer sa_len for source reads β no clamp against sizeof(sockaddr_storage) (DF-3320 residual: OOB heap read leaked to unprivileged route-socket listeners)
Summary
Characterization of the DF-3320 residual: rtsock bounds every builder copy against the DESTINATION (rt_msgsize/rt_msg_mbuf size the buffer from the same sa_len they later copy, so no write overflow), but it trusts sa_len COMPLETELY for the SOURCE read: rt_msg_buffer's bcopy(sa, cp, RT_ROUNDUP(sa->sa_len)), rt_msg_mbuf's sizing and m_copyback, plus the calls in sysctl_iflist and rttable_walk_entry. When any producer persists sa_len larger than its true allocation - exactly what DF-3320 demonstrated for IPv4 SIOCAIFADDR - each RTM_NEWADDR/DELADDR broadcast and each NET_RT_IFLIST/DUMP entry over-reads up to sa_len-16 bytes past the embedded sockaddr_in and ships it to every PF_ROUTE listener, which unprivileged users can be. Filed as Low/defense-in-depth (root cause and leak already captured by DF-3320); covers the missing rtsock-side clamp. Fix: clamp sa_len==0 || > sizeof(sockaddr_storage) -> zeroed sockaddr_storage substitute at the three consumer sites. [VERIFIED pass2: reproduced live - unpriv nobody listener receives kernel heap pointers via NET_RT_IFLIST and RTM_NEWADDR with the planted sin_len 200, 12 poisoned event sockaddrs; clamp fix A/B 0 poisoned events]
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-3359 Β· 10 files| File | Type | Description | Size | |
|---|---|---|---|---|
| README.md | β | 1000 B | β raw | |
| VERDICT.md | β | 2.5 KB | β raw | |
| fix.diff | β | 503 B | view raw | |
| fix_run.log | β | 308 B | view raw | |
| fixkernel.log | β | 988 B | view raw | |
| fixkernel3.log | β | 308 B | view raw | |
| live1.log | β | 3.4 KB | view raw | |
| manifest.json | β | 885 B | view raw | |
| rtleak.c | β | 4.7 KB | view raw | |
| verdict.json | β | 2.0 KB | view raw |
DF-3359 -- verification pack
Method: Live PoC on the QEMU guest (stock INVARIANTS kernel) Status: REPRODUCED | impact: leak | confidence: certain
What this is
rtsock builders size the DESTINATION from producer sa_len (no write overflow) but bound the SOURCE read by nothing: with the DF-3320 setup planting sin_len=200 into a live in_ifaddr (one-time root misconfiguration), an UNPRIVILEGED nobody listener received kernel heap pointers (0xfffff8004f2e5da0 etc.) via NET_RT_IFLIST (rt_msg_buffer bcopy) AND via RTM_NEWADDR/RTM_DELADDR events (rt_msg_mbuf), 12 poisoned sockaddrs per run.
Build
cc -O -o <prog> <prog>.c (on the guest)
Run
(driver script; listener runs as nobody)
(success criterion: see VERDICT.md)
Evidence
live1.log DF-3359 section: [IFLIST]/[NEWADDR]/[DELADDR] entries with kernel pointers at offsets 56-88; unpriv listener (nobody)
Kernel references: sys/net/rtsock.c:1140-1144, sys/net/rtsock.c:1175-1180, sys/net/rtsock.c:1202-1206
DF-3359 -- VERDICT
REPRODUCED (impact=leak, 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
rtsock builders size the DESTINATION from producer sa_len (no write overflow) but bound the SOURCE read by nothing: with the DF-3320 setup planting sin_len=200 into a live in_ifaddr (one-time root misconfiguration), an UNPRIVILEGED nobody listener received kernel heap pointers (0xfffff8004f2e5da0 etc.) via NET_RT_IFLIST (rt_msg_buffer bcopy) AND via RTM_NEWADDR/RTM_DELADDR events (rt_msg_mbuf), 12 poisoned sockaddrs per run.
How it was verified
- Method: Live PoC on the QEMU guest (stock INVARIANTS kernel)
- Kernel references: sys/net/rtsock.c:1140-1144, sys/net/rtsock.c:1175-1180, sys/net/rtsock.c:1202-1206
- Evidence: live1.log DF-3359 section: [IFLIST]/[NEWADDR]/[DELADDR] entries with kernel pointers at offsets 56-88; unpriv listener (nobody)
- 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 -- Validated on the patched kernel: the combined-fix build clamps sa_len (0 or > sizeof(sockaddr_storage) -> zeroed substitute with the family preserved) in rt_msg_buffer and rt_msg_mbuf; with the fixed kernel the same planted sin_len=200 produces NO poisoned sockaddrs in NET_RT_IFLIST (see fixkernel section). fix.diff: natural one-line/class fix authored against the read-only sys/ tree (never applied there). Baseline vs patched (kernel): see fixkernel-*.log -- the combined-fix kernel (DF-3308+DF-3349+DF-3359+DF-3445/3446 fixes built together) was booted and the exact PoCs re-run.
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
fixedA/B on the combined-fix kernel (kernel #2, rtsock clamp in rt_msg_buffer + rt_msg_mbuf): baseline unprivileged listener received 12 poisoned event sockaddrs (kernel pointers) plus 2 IFLIST entries; patched kernel: PF_ROUTE poisoned events 0, no sa_len=200 entry in NET_RT_IFLIST (remaining sa_len>16 entries are legitimate 20-byte AF_LINK sockaddrs). See fixkernel3.log / fix_run.log.
Confirmed kernel references
Detail
Evidence (decisive lines)
live1.log DF-3359 section: [IFLIST]/[NEWADDR]/[DELADDR] entries with kernel pointers at offsets 56-88; unpriv listener (nobody)
Verified recommended fix
fix.diff
Verdict
rtsock builders size the DESTINATION from producer sa_len (no write overflow) but bound the SOURCE read by nothing: with the DF-3320 setup planting sin_len=200 into a live in_ifaddr (one-time root misconfiguration), an UNPRIVILEGED nobody listener received kernel heap pointers (0xfffff8004f2e5da0 etc.) via NET_RT_IFLIST (rt_msg_buffer bcopy) AND via RTM_NEWADDR/RTM_DELADDR events (rt_msg_mbuf), 12 poisoned sockaddrs per run.
No comments yet.