CVSROOT:        /cvs
Module name:    src
Changes by:     [email protected]    2026/11/19 16:44:25

Modified files:
        sys/net80211   : ieee80211_input.c 

Log message:
ieee80211_input_hwdecrypt() must free the mbuf before returning NULL.

Like ieee80211_decrypt(), ieee80211_input_hwdecrypt() is responsible for
freeing discarded frames, but failed to do so. This bug was introduced by
me in ieee80211_input.c,v r1.216 2020/05/15 when adding this function.

This sounds very bad, but my own impact analysis is as follows:

Only drivers which offload TKIP/CCMP decryption to hardware can be affected.
These are: athn, iwm, iwn, iwx, mtw, mwx, qwx, qwz, ral, run, urtwn, and wpi.

The following drivers filter duplicate data frames in hardware or in the
driver itself: athn, iwm, iwn, iwx, qwx, qwz, wpi, and urtwn.
In which case the leak won't trigger for regular data frames.

Encrypted multicast or management (PMF) frames might also trigger the leak
where drivers offload the group cipher to hardware: iwx, run, qwx, and qwz.
Under normal conditions such frames are rare enough for a leak to go unnoticed.

Edge cases which could trigger the leak are frames too short for CMMP or
with a missing ExtIV bit in the header. Such frames are unlikely to even
pass the hardware decryption engine.

A probable case which would trigger this leak in practice are apparent
replays which may legitimately occur when 11n/11ac block-ack is used, if
the sender has not yet seen a block-ack which covers a frame still on the
sender's Tx aggregation queue but which has already been received.
The leak would only occur if the net80211 stack has to filter such replays.
Relevant drivers either don't support Rx aggregation yet or would usually
filter out duplicates in hardware or in the driver, so this case probably
never happens.

Another case which could trigger the leak would be frames replayed or crafted
on purpose by a rouge wifi device, again provided that hardware and the
driver would pass such frames up to net80211. This might affect PMF capable
drivers if broadcast/multicast frames are received. Rogue data frames would
be filtered by several drivers, as explained above.
It is noteworthy though that injecting such frames only requires sufficient
radio range. Knowledge of the network passphrase is not needed.

Barring further findings, the worst case is probably ral in hostap mode,
which could be driven out of mbufs by a rogue client or bad RF conditions
causing excessive retries.

Patch by Maxwell Swadling who found this leak with ASan/UBsan tooling.
Thank you!

Tested by myself on qwx.
ok phessler@

Reply via email to