rn_match/rn_insert/rn_delete compare loops bounded by the caller's clen(key) over-read the stored leaf-key allocation β unprivileged via RTM_GET
Summary
The exact-match compare loops size themselves with the CALLER's key length only: rn_match sets klen=clen(key) for host-route leaves and compares key[off..klen) against t->rn_key without bounding by clen(t->rn_key); rn_insert does the same; rn_delete's bcmp uses klen-head_off against tt->rn_key (the over-read sibling of DF-0495's underflow). Stored route keys live in a dst+gateway chunk sized RT_ROUNDUP(sa_len_dst)+RT_ROUNDUP(sa_len_gw) (typically 32 bytes for a v4 host route); an unprivileged RTM_GET carrying a dst sockaddr with sa_len up to 255 (accepted by rt_xaddrs per DF-0390) makes rn_match read up to ~223 bytes past the stored key's chunk - a heap over-read whose result only feeds an equality oracle (loop stops at first mismatch; match/no-match the only observable). rn_match reachable unpriv via rt_get->rtalloc1; rn_insert/rn_delete root-gated. Hardening-grade (adjacent slab bytes, 1-few bytes in practice; slab containment prevents boundary faults). Not run (Low; mechanism certain, impact negligible). Fix: bound every compare by the stored key's own length (MIN discipline as in rn_satisfies_leaf). [VERIFIED pass2: reproduced via guard harness - klen-driven compare over-reads the 16-byte stored key for unpriv RTM_GET sa_len 255; MIN-clamp fix A/B; equality oracle masked by rn_satisfies_leaf discipline]
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-3393 Β· 13 files| File | Type | Description | Size | |
|---|---|---|---|---|
| README.md | β | 946 B | β raw | |
| VERDICT.md | β | 2.2 KB | β raw | |
| allruns.log | β | 4.9 KB | view raw | |
| build.sh | β | 708 B | view raw | |
| df3393.c | β | 5.2 KB | view raw | |
| fix.diff | β | 260 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 | β | 826 B | view raw | |
| run.sh | β | 2.0 KB | view raw | |
| verdict.json | β | 1.7 KB | view raw |
DF-3393 -- verification pack
Method: Verbatim-interposition harness (guard-page technique; no wlan/sppp hardware on this guest) Status: REPRODUCED | impact: none | confidence: certain
What this is
rn_match exact-compare loop is bounded only by the caller clen(key): an unprivileged RTM_GET with dst sa_len=255 reads up to 239 bytes past the stored 16-byte v4 host-route key. Verbatim rn_match/rn_search/rn_satisfies_leaf harness faults the guard page; the same harness also demonstrates the impact ceiling - the MIN-length discipline in rn_satisfies_leaf masks any equality oracle (mismatch at byte 20 still returns the leaf).
Build
./build.sh
Run
df3393 oob
(success criterion: see VERDICT.md)
Evidence
caller clen=255 vs 16-byte stored key rc=139 (guard); control (padded alloc) rc=0; FIXED stored-key clamp clean
Kernel references: sys/net/radix.c:306-329, sys/net/route.c, sys/net/rtsock.c:780-790
DF-3393 -- 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
rn_match exact-compare loop is bounded only by the caller clen(key): an unprivileged RTM_GET with dst sa_len=255 reads up to 239 bytes past the stored 16-byte v4 host-route key. Verbatim rn_match/rn_search/rn_satisfies_leaf harness faults the guard page; the same harness also demonstrates the impact ceiling - the MIN-length discipline in rn_satisfies_leaf masks any equality oracle (mismatch at byte 20 still returns the leaf).
How it was verified
- Method: Verbatim-interposition harness (guard-page technique; no wlan/sppp hardware on this guest)
- Kernel references: sys/net/radix.c:306-329, sys/net/route.c, sys/net/rtsock.c:780-790
- Evidence: caller clen=255 vs 16-byte stored key rc=139 (guard); control (padded alloc) rc=0; FIXED stored-key clamp 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)
caller clen=255 vs 16-byte stored key rc=139 (guard); control (padded alloc) rc=0; FIXED stored-key clamp clean
Verified recommended fix
fix.diff
Verdict
rn_match exact-compare loop is bounded only by the caller clen(key): an unprivileged RTM_GET with dst sa_len=255 reads up to 239 bytes past the stored 16-byte v4 host-route key. Verbatim rn_match/rn_search/rn_satisfies_leaf harness faults the guard page; the same harness also demonstrates the impact ceiling - the MIN-length discipline in rn_satisfies_leaf masks any equality oracle (mismatch at byte 20 still returns the leaf).
No comments yet.