setsockopt(IP_OPTIONS) overwrites copyin error: parses stale mbuf data as IP options on copyin failure
Summary
ip_ctloutput IP_OPTIONS(:1097-1118): error=sopt_to_kbuf(...); error=ip_pcbopts(...). Second assignment overwrites first error. If sopt_to_kbuf fails (EFAULT unmapped ptr), MGET buffer NOT zeroed, ip_pcbopts parses stale heap data as IP options. If stale bytes satisfy loose syntax (mult4, valid LSRR/SSRR), stored in inp_options, emitted on subsequent packets. Probabilistic kernel heap info leak via IP options. Fix: check error before ip_pcbopts; use M_DONTWAIT|M_ZERO.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0407 Β· 2 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | source verification verdict | 729 B | β raw |
| fix.diff | suggested-fix | fix for logic bug | 406 B | view raw |
DF-0407 - Verification Verdict
Verdict: REPRODUCED (source-only confirmation)
Bug class: logic
Impact: none
Source file: sys/netinet/ip_output.c
Mechanism
CONFIRMED: ip_ctloutput IP_OPTIONS overwrites sopt_to_kbuf error with ip_pcbopts. Failed copyin leaves MGET buffer uninitialized. Fix: check error before ip_pcbopts.
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/netinet/ip_output.c:1111.
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
- i
- n
- e
- t
- /
- i
- p
- _
- o
- u
- t
- p
- u
- t
- .
- c
- :
- 1
- 1
- 1
- 1
Detail
Exploit chain
none (non-corruption Low severity finding; source-only confirmation)
Evidence (decisive lines)
Source-traced at sys/netinet/ip_output.c:1111. Combined kernel build with all 70 fixes: rc=0, -Werror.
PoC changes
Created fix.diff for DF-0407. No PoC binary (source-only verification).
Verified recommended fix
Check error before calling ip_pcbopts. Matches finding proposal.
Verdict
CONFIRMED source-only: sopt_to_kbuf error overwritten by ip_pcbopts. Stale heap data parsed.
No comments yet.