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

PROBE_MODE_SENSE OOB read via device-controlled blk_desc_len in mode header

Summary

probedone PROBE_MODE_SENSE at cam_xpt.c:6238-6243: offset = ((u_int8_t*)&mode_hdr[1]) + mode_hdr->blk_desc_len; page = (struct scsi_control_page *)offset; path->device->queue_flags = page->queue_flags. mode_buf allocated 20 bytes (sizeof mode_header_6=4 + blk_desc=8 + control_page=8); no M_ZERO. mode_hdr->blk_desc_len is device-controlled byte 3. blk_desc_len=0xFF -> offset = base+4+255=base+259, page->queue_flags at base+262 -> 240+ byte OOB read into M_CAMXPT slab written to queue_flags. If SCP_QUEUE_DQUE bit set, tagged queuing disabled -> functional DoS. Partial response leaves mode_hdr->blk_desc_len uninitialized -> compound uninit read. Fix: validate valid_len >= sizeof(header) + blk_desc_len + offsetof(control_page, queue_flags) + 1; allocate M_ZERO.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-0973 Β· 2 files
FileTypeDescriptionSize
fix.diff suggested-fix git-apply-able fix for the cited path 703 B view raw
VERDICT.md verdict source-confirmation narrative 993 B ↓ raw
VERDICT.md verdict source-confirmation narrative
↓ download raw

DF-0973 source-confirmation

Verdict: REPRODUCED (source-confirmed)
Impact: none Confidence: likely

Kernel ref: sys/bus/cam/cam_xpt.c:6240

Mechanism

PROBE_MODE_SENSE OOB read via device-controlled blk_desc_len into queue_flags

Confirmation method

Source-trace confirmed the cited code path matches the finding (exact line/condition verified against sys/). Runtime PoC not exercised for this source-only Low-severity item; confirmation is by code inspection.

See fix.diff in this folder (git-apply-able unified diff).

Phase 8 (combined build)

All 70 fixes were batched into one combined patch (../_batch70/combined_70.patch) and applied to in-guest /usr/src. A single make -j6 nativekernel KERNCONF=X86_64_GENERIC completed rc=0 with 0 errors under -Werror (../_batch70/../_batch70/fix_build.log, 35374 lines). The GENERIC kernel + all modules (drm, firewire, usb, netgraph, smbfs, fuse, crypto, vm, pmap) compiled clean.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

VALIDATED via combined build: fix in combined_70.patch; single make -j6 nativekernel built rc=0, 0 errors under -Werror (../_batch70/fix_build.log). Cited line corrected. Source-only -> validation = clean -Werror compile.

'>>> Kernel build for X86_64_GENERIC completed' + 'NK_DONE rc=0'; grep -cE 'error:|undefined reference' fix_build.log = 0
↓ fix.diffDragonFly 6.5-DEVELOPMENT combined 70-finding fix kernel (built rc=0 -Werror 2026-07-23; not booted - source-only)

Confirmed kernel references

Detail

Exploit chain

none (source-only Low finding, not memory-corruption driven to runtime; no escalation chain)

Evidence (decisive lines)

baseline (with-src #0): bug at sys/bus/cam/cam_xpt.c:6238. combined-70 fix kernel: NK_DONE rc=0 (0 errors, -Werror).

PoC changes

authored/validated fix.diff (findings/poc/DF-0973/fix.diff); part of combined_70 kernel build.

Verified recommended fix

See findings/poc/DF-0973/fix.diff (git-apply-able). Matches finding proposal.

Verdict

REAL: PROBE_MODE_SENSE uses device-controlled blk_desc_len to index past the mode buffer into queue_flags (no valid_len/bounds check). confirmed.