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

Unbounded strlen on possibly non-NUL-terminated user cv_volid in chsetvoltag

Summary

chsetvoltag at scsi_ch.c:1300 memcpy(ssvtp.vitf, csvr->csvr_voltag.cv_volid, min(strlen(csvr->csvr_voltag.cv_volid), sizeof(ssvtp.vitf))). cv_volid is u_char[33] (CH_VOLTAG_MAXLEN+1). User fills all 33 bytes non-NUL -> strlen scans past cv_volid into cv_serial(2 bytes) then into adjacent kernel stack. min() makes memcpy safe but strlen over-read is unbounded. Root-only (SYSCAP_RESTRICTEDROOT). Fix: strnlen(cv_volid, sizeof(cv_volid)).

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1030 Β· 3 files
FileTypeDescriptionSize
fix.diff suggested-fix git-apply-able fix for the cited path 516 B view raw
VERDICT.md verdict source-confirmation narrative 901 B ↓ raw
env.txt environment guest uname + toolchain 247 B view raw
VERDICT.md verdict source-confirmation narrative
↓ download raw

DF-1030 source-confirmation

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

Kernel ref: sys/bus/cam/scsi/scsi_ch.c:1300

Mechanism

chsetvoltag unbounded strlen on cv_volid: min(strlen(cv_volid),...) over-reads non-NUL-terminated u_char[33] into adjacent kernel stack. root-only; confirmed.

Confirmation method

source-only Low-severity; confirmation by code inspection. Runtime PoC not exercised for this Low-severity item; confirmation is by code inspection against sys/.

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

Phase 8 (combined build)

This fix is part of the batched 70-finding combined patch (../_batch70/combined_70.patch) applied to in-guest /usr/src. A single make -j6 nativekernel KERNCONF=X86_64_GENERIC build is validated rc=0 with 0 errors under -Werror (../_batch70/fix_build.log).

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/scsi/scsi_ch.c:1300. combined-70 fix kernel: NK_DONE rc=0 (0 errors, -Werror).

PoC changes

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

Verified recommended fix

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

Verdict

REAL: chsetvoltag strlen on possibly non-NUL-terminated cv_volid[33] over-reads stack. root-only. confirmed.