mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
wifi: libipw: reject TKIP frames without a full MIC
libipw_michael_mic_verify() assumes that an skb contains an eight-byte
Michael MIC. A short TKIP frame makes the unsigned payload length wrap,
causing michael_mic() to read past the skb.
Check that the MIC is present before verifying it, and use the existing
MICHAEL_MIC_LEN constant for all MIC lengths in the verifier.
Fixes: b453872c35 ("[NET] ieee80211 subsystem")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Daehyeon Ko <4ncienth@gmail.com>
Link: https://patch.msgid.link/20260909061124.3802517-1-4ncienth@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
e5c8d7acd3
commit
06f42accaf
|
|
@ -474,14 +474,16 @@ static int libipw_michael_mic_verify(struct sk_buff *skb, int keyidx,
|
|||
int hdr_len, void *priv)
|
||||
{
|
||||
struct libipw_tkip_data *tkey = priv;
|
||||
u8 mic[8];
|
||||
u8 mic[MICHAEL_MIC_LEN];
|
||||
|
||||
if (!tkey->key_set)
|
||||
if (!tkey->key_set || skb->len < hdr_len + MICHAEL_MIC_LEN)
|
||||
return -1;
|
||||
|
||||
michael_mic(&tkey->key[24], (struct ieee80211_hdr *)skb->data,
|
||||
skb->data + hdr_len, skb->len - 8 - hdr_len, mic);
|
||||
if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
|
||||
skb->data + hdr_len,
|
||||
skb->len - MICHAEL_MIC_LEN - hdr_len, mic);
|
||||
if (memcmp(mic, skb->data + skb->len - MICHAEL_MIC_LEN,
|
||||
MICHAEL_MIC_LEN) != 0) {
|
||||
struct ieee80211_hdr *hdr;
|
||||
hdr = (struct ieee80211_hdr *)skb->data;
|
||||
printk(KERN_DEBUG "%s: Michael MIC verification failed for "
|
||||
|
|
@ -499,7 +501,7 @@ static int libipw_michael_mic_verify(struct sk_buff *skb, int keyidx,
|
|||
tkey->rx_iv32 = tkey->rx_iv32_new;
|
||||
tkey->rx_iv16 = tkey->rx_iv16_new;
|
||||
|
||||
skb_trim(skb, skb->len - 8);
|
||||
skb_trim(skb, skb->len - MICHAEL_MIC_LEN);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user