NULL td dereference in SIOCSIFDSTADDR and default ioctl handlers despite documented td might be NULL contract
Summary
in_control(:221) documents td might be NULL. Priv guards(:513,:561) use if(td&&...) skip when NULL. But SIOCSIFDSTADDR handler(:606) ifp->if_ioctl(ifp,SIOCSIFDSTADDR,(caddr_t)ia,td->td_proc->p_ucred) derefs td unconditionally. Default-case handler(:735) same pattern. Kernel-initiated path with td=NULL for these cmds -> NULL-page fault panic. Not reachable from unpriv userspace (td always non-NULL for user ioctls). Latent crash bug contradicts API contract. Fix: if(td==NULL) return EINVAL or use proc0.p_ucred fallback.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0491 Β· 2 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | source verification verdict | 710 B | β raw |
| fix.diff | suggested-fix | fix for null-deref bug | 409 B | view raw |
DF-0491 - Verification Verdict
Verdict: REPRODUCED (source-only confirmation)
Bug class: null-deref
Impact: dos
Source file: sys/netinet/in.c
Mechanism
CONFIRMED: in_control documents td might be NULL but SIOCSIFDSTADDR and default-case deref td->td_proc->p_ucred unconditionally. Fix: check td!=NULL.
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/in.c:609.
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
- n
- .
- c
- :
- 6
- 0
- 9
Detail
Exploit chain
none (non-corruption Low severity finding; source-only confirmation)
Evidence (decisive lines)
Source-traced at sys/netinet/in.c:609. Combined kernel build with all 70 fixes: rc=0, -Werror.
PoC changes
Created fix.diff for DF-0491. No PoC binary (source-only verification).
Verified recommended fix
Check td!=NULL before p_ucred deref. Matches finding proposal.
Verdict
CONFIRMED source-only: in_control SIOCSIFDSTADDR derefs td->td_proc->p_ucred when td may be NULL.
No comments yet.