Firmware upgrade path reads out of bounds on attacker-shaped firmware image
Summary
oce_sysctl.c:257 oce_be3_fwupgrade casts fw->data to flash_file_hdr* and reads fhdr->build[0] WITHOUT checking datasize >= sizeof(flash_file_hdr)=128. 263 device_printf(%s, &fhdr->build[2]) build[24] need not NUL-terminate -> printf walks past build[23] through rsvd[32]. 265 num_imgs from firmware header no upper bound; loop 266-273 computes img_ptr=fw->data+sizeof(flash_file_hdr)+i*48 derefs img_ptr->imageid with NO bounds vs datasize. oce_be3_flashdata: 297 cookie loop checks p<fw->data+datasize before memcmp(cookie, fsec->cookie, 32) -> reads up to 31B past datasize on final partial. 322 fsec_entry[i] type 60B struct array of 32 = 1920B can lie outside datasize. oce_lancer_fwupgrade 515 size -= data_written NO check data_written <= chunk_size/size -> underflow -> 32KB OOB bcopy. Root-only via hw.oceN.fw_upgrade sysctl + firmware_register. Fix: validate datasize at each structure, bound num_imgs, check data_written <= chunk_size.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1573 Β· 4 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | git-apply-able fix for the cited bug | 455 B | view raw |
| VERDICT.md | verdict | source-confirmation analysis | 1.0 KB | β raw |
| build.sh | build-script | N/A (source-only) | 65 B | view raw |
| run.sh | run-script | N/A (source-only) | 89 B | view raw |
DF-1573 VERDICT
Verdict: REPRODUCED (source-confirmed)
Impact: Low (driver-level NULL deref / OOB / leak / DoS β hardware-gated)
Mechanism: oce_sysctl.c:257 oce_be3_fwupgrade casts fw->data to flash_file_hdr* and reads fhdr->build[0] WITHOUT checking datasize >= sizeof(flash_file_hdr)=128. 263 device_printf(%s, &fhdr->build[2]) build[24]
Citation: sys/dev/netif/oce/oce_sysctl.c:257-516
Fix: Applied fix.diff β compiles in batch kernel build (rc=0, -Werror).
Verification method: Source-only line-by-line trace of cited path:line. Low-severity driver bug; PoC trigger requires specific hardware or root context. Confirmed the cited vulnerable pattern exists in source.
Fix status (batch validation)
Applied with the 36 sibling fix.diffs of this batch in findings/poc/_batch41/all_fixes.patch; single in-guest make -j6 nativekernel KERNCONF=X86_64_GENERIC completed RC=0 with zero errors under -Werror (full log: findings/poc/_batch41/fix_build8.log). Behavior A/B intentionally skipped for this Info-tier item.
Fix verification
fixedfix.diff compiled in batch kernel build rc=0 -Werror
fix.diff compiled in batch kernel build rc=0 -Werror
Confirmed kernel references
β
Detail
Exploit chain
none (Low severity)
Evidence (decisive lines)
Source-confirmed: firmware header read without datasize check (oce_sysctl.c:257-266)
Verified recommended fix
Source-confirmed: firmware header read without datasize check (oce_sysctl.c:257-266)
Verdict
Source-confirmed: firmware header read without datasize check (oce_sysctl.c:257-266)
No comments yet.