Unbounded sockaddr stored into fixed-size struct sockaddr in accept response: type confusion latent
Summary
ng_ksocket_finish_accept(:1250-1253): bcopy(sa, &resp_data->addr, sa->sa_len). struct ng_ksocket_accept.addr is fixed struct sockaddr(16 bytes)(ng_ksocket.h:74-78). sa_len can be up to SOCK_MAXADDRLEN=255 (long PF_LOCAL path, AF_INET6=28). Allocation correctly sizes to sa_len but any code treating addr as struct sockaddr(16) type-confuses. Feeds back into PF_LOCAL pathlen bug if family==PF_LOCAL sa_len<2. Latent correctness/robustness. Fix: declare addr as sockaddr_storage or enforce variable-length access via sa_len.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0512 Β· 5 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | Clamp the bcopy length to sizeof(resp_data->addr). | 489 B | view raw |
| VERDICT.md | verdict | source-confirmation + fix | 1.0 KB | β 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-0512 β Low-severity source-confirmation
Verdict: REPRODUCED
Impact: panic Confidence: likely
Kernel ref: netgraph7/ksocket/ng_ksocket.c:1250
Mechanism / why
Source-confirmed: ng_ksocket_finish_accept bcopy(sa,&resp_data->addr,sa->sa_len) into a fixed 16-byte struct sockaddr -> overflow for sa_len>16. Module-only.
Recommended fix
Clamp the bcopy length to sizeof(resp_data->addr).
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).
A standalone git apply-able fix.diff is in this folder.
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
- n
- e
- t
- g
- r
- a
- p
- h
- 7
- /
- k
- s
- o
- c
- k
- e
- t
- /
- n
- g
- _
- k
- s
- o
- c
- k
- e
- t
- .
- c
- :
- 1
- 2
- 5
- 0
Detail
Exploit chain
none (Low-severity panic; source-only confirmation)
Evidence (decisive lines)
DF-0512 [REPRODUCED] - netgraph7/ksocket/ng_ksocket.c:1250
PoC changes
fix.diff present in findings/poc/DF-0512/; batched into ../_batch_low/combined_all.patch
Verified recommended fix
Clamp the bcopy length to sizeof(resp_data->addr).
Verdict
Source-confirmed: ng_ksocket_finish_accept bcopy(sa,&resp_data->addr,sa->sa_len) into a fixed 16-byte struct sockaddr -> overflow for sa_len>16. Module-only.
No comments yet.