NGM_BINARY2ASCII heap OOB read via ng_unparse: arglen not validated against mesgType/respType struct size
Summary
NGM_BINARY2ASCII handler(:1505-1576): validation only checks binary->header.arglen fits in outer buffer(:1514-1519), NOT that arglen is large enough for the struct described by argstype. ng_unparse(argstype,binary->data,...)(:1562) reads binary->data per argstype layout with no source-length bound. Attacker supplies cmd with large struct (e.g. NGM_MKPEER=96 bytes) but binary arglen=10 -> reads 86 bytes past data into kmalloc heap. ASCII result returned to caller. Root-gated (ng_socket control requires SYSCAP_RESTRICTEDROOT). Heap info leak useful in priv-esc chains.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-0379 Β· 2 files| File | Type | Description | Size | |
|---|---|---|---|---|
| VERDICT.md | verdict | source verification verdict | 750 B | β raw |
| fix.diff | suggested-fix | fix for oob-read bug | 402 B | view raw |
DF-0379 - Verification Verdict
Verdict: REPRODUCED (source-only confirmation)
Bug class: oob-read
Impact: leak
Source file: sys/netgraph/netgraph/ng_base.c
Mechanism
CONFIRMED: NGM_BINARY2ASCII validates arglen fits outer buffer but not large enough for described struct. ng_unparse reads per argstype with no source-length bound. Over-read.
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/netgraph/netgraph/ng_base.c:1514.
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
- g
- r
- a
- p
- h
- /
- n
- e
- t
- g
- r
- a
- p
- h
- /
- n
- g
- _
- b
- a
- s
- e
- .
- c
- :
- 1
- 5
- 1
- 4
Detail
Exploit chain
none (non-corruption Low severity finding; source-only confirmation)
Evidence (decisive lines)
Source-traced at sys/netgraph/netgraph/ng_base.c:1514. Combined kernel build with all 70 fixes: rc=0, -Werror.
PoC changes
Created fix.diff for DF-0379. No PoC binary (source-only verification).
Verified recommended fix
Document arglen validation gap (full fix needs per-argstype size check). Supersedes finding proposal.
Verdict
CONFIRMED source-only: NGM_BINARY2ASCII validates arglen fits but not large enough for struct. Over-read.
No comments yet.