Firmware-controlled lengths in iwm_phy_db_set_section never validated against RX packet size: heap OOB read / kernel panic
Summary
iwm_phy_db_set_section L264-328 parses firmware IWM_CALIB_RES_NOTIF_PHY_DB notification (pkt->data <=4KB mbuf cluster IWM_RBUF_SIZE=4096) but NEVER calls iwm_rx_packet_payload_len(pkt) (helper exists if_iwmreg.h:6943-6948 used defensively elsewhere if_iwm.c:2778/5535). L271 size=le16toh(phy_db_notif->length) consumed as memcpy length L319 memcpy(entry->data,phy_db_notif->data,size) with size up to 65535 but source has at most payload_len-4 valid bytes (~4092). Firmware claiming length=65535 with short payload makes memcpy walk ~61KB past 4KB mbuf cluster -> reliably crosses unmapped page -> kernel panic. type/length reads L270-271 need payload_len>=4; chg_id reads L279/293 *(uint16_t*)phy_db_notif->data need payload_len>=6; none checked. channel_id_to_txp L389 casts entry->data to iwm_phy_db_chg_txp* reads max_channel_idx offset 4 without checking entry->size>=6. Attacker is WiFi firmware (hardware trust boundary). Trigger: ifconfig iwm0 up INIT-ucode calibration. No remote/network path. Buggy/hostile firmware notification. Fix: validate size<=paylen-sizeof(notif) before memcpy; check entry->size>=sizeof(iwm_phy_db_chg_txp) in channel_id_to_txp.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-1898 Β· 4 files| File | Type | Description | Size | |
|---|---|---|---|---|
| fix.diff | suggested-fix | git-apply-able fix for the cited bug | 369 B | view raw |
| VERDICT.md | verdict | source-confirmation analysis | 713 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 |
DF-1898 VERDICT
Verdict: REPRODUCED (source-confirmed)
Impact: Low (driver-level NULL deref / OOB / leak / DoS β hardware-gated)
Mechanism: iwm_phy_db_set_section L264-328 parses firmware IWM_CALIB_RES_NOTIF_PHY_DB notification (pkt->data <=4KB mbuf cluster IWM_RBUF_SIZE=4096) but NEVER calls iwm_rx_packet_payload_len(pkt) (helper exists
Citation: sys/dev/netif/iwm/if_iwm_phy_db.c:268-389
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
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-controlled size never validated in phy_db_set_section (if_iwm_phy_db.c:268-389)
Verified recommended fix
Source-confirmed: firmware-controlled size never validated in phy_db_set_section (if_iwm_phy_db.c:268-389)
Verdict
Source-confirmed: firmware-controlled size never validated in phy_db_set_section (if_iwm_phy_db.c:268-389)
No comments yet.