β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-0379

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)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-0379 Β· 2 files
FileTypeDescriptionSize
VERDICT.md verdict source verification verdict 750 B ↓ raw
fix.diff suggested-fix fix for oob-read bug 402 B view raw
VERDICT.md verdict source verification verdict
↓ download 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

fixed
baseline reproduced→ patch + rebuild →patched clean

VALIDATED: 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.
↓ fix.diff6.5-DEVELOPMENT #0 (combined-fix build, rc=0 -Werror, Thu Jul 23 04:36:20 UTC 2026)

Confirmed kernel references

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.