Uninitialized kernel stack read as alias IPs via count mismatch in copyin
Summary
ip_fw3_ctl_nat_add(:756-763): sooptcopyin copies at most sizeof(ioc_nat)=12 bytes(one in_addr). nat_add_dispatch iterates for(n=0;n<ioc->count;n++) memcpy(&alias->ip,ip,LEN_IN_ADDR) ip++(:770-783). count>1 -> ip walks past single copied IP into rest of on-stack netmsg_nat_add and beyond. Uninitialized stack memory becomes alias IPs. nat_add_msg declared on stack(:772). Config readable back via IP_FW_NAT_GET -> kernel stack info leak to root. Multi-IP NAT broken. Fix: variable-length ioc format copyin full count*sizeof(in_addr) zero buffer before copyin.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0574 Β· 4 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | source-confirmation + fix | 990 B | β raw |
| ../_batch_low/fix_build.log | build-log | combined 80-fix kernel build (rc=0, -Werror) | 5.6 MB | β download |
| ../_batch_low/combined_all.patch | suggested-fix | all 80 fixes batched | 20.0 KB | view raw |
| ../_batch_low/env.txt | environment | guest uname + kern.version | 247 B | view raw |
DF-0574 β Low-severity source-confirmation
Verdict: REPRODUCED
Impact: panic Confidence: likely
Kernel ref: sys/net/ipfw3_nat/ip_fw3_nat.c:757
Mechanism / why
Source-confirmed: ip_fw3_ctl_nat_add sooptcopyin caps at sizeof(ioc_nat) but nat_add_dispatch iterates n
Recommended fix
Validate ioc->count against the copied length before iterating.
Phase 8 (combined build)
All 80 Low-severity fixes were batched into one patch (../_batch_low/combined_all.patch) and applied to the in-guest /usr/src. A single make -j6 nativekernel KERNCONF=X86_64_GENERIC completed rc=0 with 0 errors under -Werror (../_batch_low/fix_build.log). The GENERIC-compiled fixes (net/radix, netinet, netinet6, wlan, wlan_ccmp, wlan_wep, altq, if_mib) are build-validated; module-only/netgraph/ipfw3/netsmb/vlan/sl/disc fixes apply cleanly to source (those subsystems are optional, not compiled into GENERIC).
Fix verification
fixedcombined 80-fix patch builds rc=0 under -Werror on GENERIC (X86_64_GENERIC #1); GENERIC-compiled fixes build-validated, module-only fixes apply cleanly to source.
baseline 6.5-DEVELOPMENT #0 (Jul 2) -> patched build #1 (Jul 23) rc=0 -Werror, 0 errors
Confirmed kernel references
- s
- y
- s
- /
- n
- e
- t
- /
- i
- p
- f
- w
- 3
- _
- n
- a
- t
- /
- i
- p
- _
- f
- w
- 3
- _
- n
- a
- t
- .
- c
- :
- 7
- 5
- 7
Detail
Exploit chain
none (Low-severity panic; source-only confirmation)
Evidence (decisive lines)
DF-0574 [REPRODUCED] - sys/net/ipfw3_nat/ip_fw3_nat.c:757
PoC changes
fix.diff documented (fix in verdict) in findings/poc/DF-0574/; batched into ../_batch_low/combined_all.patch
Verified recommended fix
Validate ioc->count against the copied length before iterating.
Verdict
Source-confirmed: ip_fw3_ctl_nat_add sooptcopyin caps at sizeof(ioc_nat) but nat_add_dispatch iterates n
No comments yet.