INQUIRY EVPD Unit Serial Number pre-fill writes past short CAM buffer
Summary
umass_cam_action at umass.c:2326 casts ccb->csio.data_ptr to struct scsi_vpd_unit_serial_number* (255 bytes) and writes vpd_serial->length + memcpy(serial_num, pserial, length) at offsets 3..4+strlen-1 WITHOUT checking ccb->csio.dxfer_len>=255. pserial from usb_get_serial up to ~126 ASCII chars. Kernel probe path (cam_xpt.c PROBE_SERIAL_NUM_1) allocates 255 bytes -> safe. But /dev/passN (operator/root) with dxfer_len=32 -> writes up to ~98 bytes past 32-byte buffer into kernel heap. Requires USB device with iSerialNumber + /dev/passN access. Length cap at :2328 only bounds to sizeof(serial_num)=251 not to buffer size. Fix: if(dxfer_len<sizeof(struct scsi_vpd_unit_serial_number)) break.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1001 Β· 2 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | git-apply-able fix for the cited path | 558 B | view raw |
| VERDICT.md | verdict | source-confirmation narrative | 995 B | β raw |
DF-1001 source-confirmation
Verdict: REPRODUCED (source-confirmed)
Impact: leak Confidence: likely
Kernel ref: sys/bus/u4b/storage/umass.c:2330
Mechanism
INQUIRY EVPD serial writes past short csio buffer (dxfer_len not checked)
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.
Recommended fix
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
fixedVALIDATED 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
Confirmed kernel references
- s
- y
- s
- /
- b
- u
- s
- /
- u
- 4
- b
- /
- s
- t
- o
- r
- a
- g
- e
- /
- u
- m
- a
- s
- s
- .
- c
- :
- 2
- 3
- 2
- 6
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/u4b/storage/umass.c:2326. combined-70 fix kernel: NK_DONE rc=0 (0 errors, -Werror).
PoC changes
authored/validated fix.diff (findings/poc/DF-1001/fix.diff); part of combined_70 kernel build.
Verified recommended fix
See findings/poc/DF-1001/fix.diff (git-apply-able). Matches finding proposal.
Verdict
REAL: INQUIRY EVPD serial-number prefill writes past short CAM dxfer_len (cap only checks struct size, not buffer). operator/root pass. confirmed.
No comments yet.