SETIFACE passes non-NUL-terminated msg->data to ifunit bounded heap OOB read
Summary
NGM_SOURCE_SETIFACE hands user-controlled message buffer to ifunit() with only arglen<2 length check. ifunit() compares strncmp(ifp->if_xname name IFNAMSIZ) reads up to 16 bytes. If name shorter than IFNAMSIZ and not NUL-terminated strncmp reads (16-first_nul_pos) bytes past intended message data. With arglen=2 no NUL reads 14 bytes past allocation into heap-adjacent ng_mesg. Bytes only feed comparison not returned. Latent file not built by default. [VERIFIED pass2: reproduced - 2-byte SETIFACE data plus groomed residue completes lo0 in real ifunit resolved-lo0 vs garbage NULL; comparison-only bytes, latent file]
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-2600 Β· 2 files| File | Type | Description | Size | |
|---|---|---|---|---|
| harness.c | β | 7.6 KB | view raw | |
| run.log | β | 7 B | view raw |
Fix verification
not_testableConfirmed kernel references
Detail
Evidence (decisive lines)
ngsource_all.log mode 2: resolved=lo0 via residue; mode 3: NULL
PoC changes
real ifunit + real interfaces
Verified recommended fix
require NUL-termination within arglen before ifunit()
Verdict
SETIFACE (ng_source.c:405-414) checks only arglen<2 before ifunit(msg->data) whose strncmp reads up to IFNAMSIZ: with 2-byte lo + groomed residue 0\0, ifunit() resolved lo0 (name completed past the message); control residue resolved NULL. Bytes feed the comparison only. netgraph7 is not in the stock kernel (DF-2539); ng_source.c is additionally absent from sys/conf/files and cannot compile as-is (:743 undeclared ifq). The harness module compiles the pristine file with only the documented build adaptations (:743 ifq->ifsq; DFly API renames IF_ENQUEUE/altq/ifq_var includes); ng7 core (netgraph.ko) kldloaded for the framework.
No comments yet.