Sockaddr padding not zeroed in rt_msg_buffer/rt_msg_mbuf: 1-7 bytes kernel memory leak per sockaddr
Summary
rt_msg_buffer(:1140-1141) and rt_msg_mbuf(:1202-1203) bcopy/m_copyback RT_ROUNDUP(sa->sa_len) bytes but do NOT bzero alignment padding between sa_len and RT_ROUNDUP boundary. E.g. sockaddr_in6(sa_len=28) -> RT_ROUNDUP=32, 4 trailing bytes copied from adjacent kernel memory. FreeBSD explicitly bzeros: bcopy(sa,cp,sa_len); bzero(cp+sa_len,dlen-sa_len). DragonFly omits bzero. Affects all route message output paths. Unpriv via sysctl/RTM_GET.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0389 Β· 2 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | source verification verdict | 719 B | β raw |
| fix.diff | suggested-fix | fix for leak bug | 332 B | view raw |
DF-0389 - Verification Verdict
Verdict: REPRODUCED (source-only confirmation)
Bug class: leak
Impact: leak
Source file: sys/net/rtsock.c
Mechanism
CONFIRMED: rt_msg_buffer/rt_msg_mbuf bcopy RT_ROUNDUP bytes without bzeroing alignment padding. Trailing bytes leak kernel memory. Fix: bzero padding before bcopy.
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/net/rtsock.c:1140.
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
- /
- r
- t
- s
- o
- c
- k
- .
- c
- :
- 1
- 1
- 4
- 0
Detail
Exploit chain
none (non-corruption Low severity finding; source-only confirmation)
Evidence (decisive lines)
Source-traced at sys/net/rtsock.c:1140. Combined kernel build with all 70 fixes: rc=0, -Werror.
PoC changes
Created fix.diff for DF-0389. No PoC binary (source-only verification).
Verified recommended fix
bzero padding before bcopy in rt_msg_buffer/rt_msg_mbuf. Matches finding proposal.
Verdict
CONFIRMED source-only: RT_ROUNDUP padding bytes not zeroed. Kernel memory leaked to userspace.
No comments yet.