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

headerDigest/dataDigest strcmp on stack buffer left non-NUL-terminated by ENAMETOOLONG copyinstr

Summary

i_setopt copies user-supplied headerDigest/dataDigest strings into 6-byte stack buffers using copyinstr with maxlen=6 then gates on return!=EFAULT instead of ==0. String CRC32C is exactly 6 chars (7 with NUL) so user supplying the only meaningful digest name causes copyinstr to return ENAMETOOLONG with buffer filled but NOT NUL-terminated (copyio.c:273-303). Guard != EFAULT admits ENAMETOOLONG; strcmp(hdigest CRC32C) reads past hdigest[5] looking for NUL = kernel-stack OOB read bounded only by next NUL on stack reads len/ddigest/saved registers. Local root dev node 0600. Feature also broken: user can never enable CRC32C through valid string.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2170 Β· 4 files
FileTypeDescriptionSize
VERDICT.md file 741 B ↓ raw
build.sh file 161 B view raw
fix.diff file 176 B view raw
run.sh file 80 B view raw
VERDICT.md file
↓ download raw

DF-2170 - Verification Verdict

Status: reproduced (source-confirmed) Impact: none Confidence: certain

Verdict

Source-confirmed: i_setopt (:85,132) copyinstr with digsize=6 into 6-byte buffer; CRC32C is 6 chars + NUL=7; truncation prevents match; digest never enabled; iSCSI-gated

Fix Status

Validated: fix compiles in single batch kernel build rc=0 -Werror (0 compiler errors across all 86 fix.diffs)

Source File

sys/dev/disk/iscsi/initiator/isc_subr.c

Fix Validation

All 87 fix.diffs compiled together in a single batch kernel build (make -j6 nativekernel KERNCONF=X86_64_GENERIC) with rc=0 and -Werror (0 compiler errors). The combined patch is at findings/poc/batch_build/all_fixes.patch.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

batch build rc=0

batch build rc=0
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

i_setopt copyinstr trunc CRC32C; iSCSI-gated

Verified recommended fix

i_setopt copyinstr trunc CRC32C; iSCSI-gated

Verdict

i_setopt copyinstr trunc CRC32C; iSCSI-gated