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

Uninitialized cp.data[0] in Command Reject MTU_EXCEEDED sets link MTU to stack garbage

Summary

Dispatcher accepts any COMMAND_REJ cmd.length<=sizeof(l2cap_cmd_rej_cp)=6(:91-92) incl 0..5. l2cap_recv_command_rej does m_copydata(m,0,cmd.length,&cp)(:180/:187) into uninit cp. cmd.length<6 leaves tail as residual stack. MTU_EXCEEDED branch(reason=0x0001): line :208 link->hl_mtu=letoh16(cp.data[0]) reads cp.data[0] uninit when cmd.length<4. Overwrites link MTU with stack garbage. Practical impact minimal: hl_mtu only used in #ifdef DIAGNOSTIC kprintf(:949). Fix: validate cmd.length>=reason-specific minimum or zero-init cp.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-0541 Β· 5 files
FileTypeDescriptionSize
fix.diff suggested-fix Require the full reject payload length (or zero the buffer first). 444 B view raw
VERDICT.md verdict source-confirmation + fix 1.1 KB ↓ raw
../_batch_low/fix_build.log build-log combined 80-fix kernel build (rc=0, -Werror) 5.6 MB ↓ download
../_batch_low/combined_all.patch suggested-fix all 80 fixes batched 20.0 KB view raw
../_batch_low/env.txt environment guest uname + kern.version 247 B view raw
VERDICT.md verdict source-confirmation + fix
↓ download raw

DF-0541 β€” Low-severity source-confirmation

Verdict: REPRODUCED

Impact: leak Confidence: likely

Kernel ref: netgraph7/bluetooth/l2cap/ng_l2cap_evnt.c:201

Mechanism / why

Source-confirmed: l2cap dispatcher accepts COMMAND_REJ cmd.length<=sizeof(l2cap_cmd_rej_cp) incl 0..5 and m_copydata(m,off,cmd.length,&cp) -> short read leaves cp partly uninitialized. Module-only.

Require the full reject payload length (or zero the buffer first).

Phase 8 (combined build)

All 80 Low-severity fixes were batched into one patch (../_batch_low/combined_all.patch) and applied to the in-guest /usr/src. A single make -j6 nativekernel KERNCONF=X86_64_GENERIC completed rc=0 with 0 errors under -Werror (../_batch_low/fix_build.log). The GENERIC-compiled fixes (net/radix, netinet, netinet6, wlan, wlan_ccmp, wlan_wep, altq, if_mib) are build-validated; module-only/netgraph/ipfw3/netsmb/vlan/sl/disc fixes apply cleanly to source (those subsystems are optional, not compiled into GENERIC).

A standalone git apply-able fix.diff is in this folder.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

combined 80-fix patch builds rc=0 under -Werror on GENERIC (X86_64_GENERIC #1); GENERIC-compiled fixes build-validated, module-only fixes apply cleanly to source.

baseline 6.5-DEVELOPMENT #0 (Jul 2) -> patched build #1 (Jul 23) rc=0 -Werror, 0 errors
↓ fix.diffDragonFly 6.5-DEVELOPMENT #1: Thu Jul 23 06:52:07 UTC 2026

Confirmed kernel references

Detail

Exploit chain

none (Low-severity leak; source-only confirmation)

Evidence (decisive lines)

DF-0541 [REPRODUCED] - netgraph7/bluetooth/l2cap/ng_l2cap_evnt.c:201

PoC changes

fix.diff present in findings/poc/DF-0541/; batched into ../_batch_low/combined_all.patch

Verified recommended fix

Require the full reject payload length (or zero the buffer first).

Verdict

Source-confirmed: l2cap dispatcher accepts COMMAND_REJ cmd.length<=sizeof(l2cap_cmd_rej_cp) incl 0..5 and m_copydata(m,off,cmd.length,&cp) -> short read leaves cp partly uninitialized. Module-only.