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

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)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-1573 Β· 4 files
FileTypeDescriptionSize
fix.diff suggested-fix git-apply-able fix for the cited bug 455 B view raw
VERDICT.md verdict source-confirmation analysis 710 B ↓ raw
build.sh build-script N/A (source-only) 61 B view raw
run.sh run-script N/A (source-only) 87 B view raw
VERDICT.md verdict source-confirmation analysis
↓ download 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 verification

fixed
baseline reproduced→ patch + rebuild →patched clean

fix.diff compiled in batch kernel build rc=0 -Werror

fix.diff compiled in batch kernel build rc=0 -Werror
↓ fix.diffcombined build rc=0

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)