All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tanuj Sharma <ertanuj96@gmail.com>
To: security@kernel.org
Cc: pkshih@realtek.com, kvalo@kernel.org, phhuang@realtek.com,
	gary.chang@realtek.com, linux-wireless@vger.kernel.org,
	Tanuj Sharma <ertanuj96@gmail.com>
Subject: [SECURITY] wifi: rtw89: OOB read in beacon/probe-resp IE parsing (OTA, pre-auth)
Date: Mon, 23 Nov 2026 15:40:21 +0530	[thread overview]
Message-ID: <20261123101028.58146-1-ertanuj96@gmail.com> (raw)

Hi,

I am reporting an out-of-bounds read vulnerability in the rtw89 WiFi driver
that is exploitable over-the-air without authentication. Any device scanning
for networks with an rtw89-based WiFi adapter will parse attacker-controlled
beacon frames, triggering the OOB read with no user interaction required.

Severity:    HIGH — over-the-air, pre-authentication, zero user interaction
Attack:      Attacker broadcasts a crafted beacon; any device scanning with
             rtw89 parses it. No association required.
Affected:    v6.4+ (core.c), v6.4+ (wow.c — verify merge of 92790c4e50d2)
Fixes:       c6aa9a9c4725 ("wifi: rtw89: add RNR support for 6 GHz scan")
Fixes:       92790c4e50d2 ("wifi: rtw89: wow: parsing Auth Key Management from associate request")

Impact
------
This is a remotely triggerable kernel heap out-of-bounds read requiring
zero user interaction:

  1. Remote denial of service: The overread accesses memory past the
     skb's allocated slab object. If adjacent memory is unmapped or a
     KASAN/SLUB redzone, the result is a kernel oops or panic — a
     remotely triggered system crash. The victim only needs WiFi
     scanning active (which runs automatically and periodically).

  2. Driver logic corruption: The overread bytes are fed into
     cfg80211_find_ie() which scans them as if they were valid
     Information Elements. If adjacent heap data contains bytes that
     match an IE tag ID, the driver may act on garbage data — affecting
     scan decisions (core.c path: 6 GHz probe cancellation) or WoWLAN
     AKM parsing (wow.c path: authentication key management selection).

  3. No user interaction: The victim does not need to connect to any
     network — passive scanning of beacons is sufficient. 802.11
     management frames are unauthenticated even under WPA3. The
     attacker only needs physical proximity (WiFi range, ~100m outdoor).

  4. Widespread exposure: rtw89 covers Realtek WiFi 6/6E chipsets
     (RTL8852AE, RTL8852BE, RTL8852CE, RTL8922AE) used in many modern
     laptops and desktops since v6.4.

Root cause
----------
Two callsites compute the IE search region length incorrectly:

In rtw89_core_cancel_6ghz_probe_tx()
(drivers/net/wireless/realtek/rtw89/core.c):

    const u8 *ies = mgmt->u.beacon.variable;
    ssid_ie = cfg80211_find_ie(WLAN_EID_SSID, ies, skb->len);
                                                    ^^^^^^^^^

`ies` points 36 bytes into the skb (past the 24-byte 802.11 header +
12-byte beacon fixed fields), but `skb->len` is the total frame length
including those 36 bytes. This means cfg80211_find_ie() searches 36
bytes past the end of the actual IE data.

In rtw89_wow_parse_akm()
(drivers/net/wireless/realtek/rtw89/wow.c):

    const u8 *ies = mgmt->u.assoc_req.variable;
    rsn = cfg80211_find_ie(WLAN_EID_RSN, ies, skb->len);
                                               ^^^^^^^^^

Here `ies` points 28 bytes into the skb (24-byte header + 4-byte
assoc_req fixed fields), causing a 28-byte overread.

Verification (kernel 6.12.115, KASAN generic)
----------------------------------------------
Code audit: The root cause is mechanically verifiable from source alone —
cfg80211_find_ie() receives `skb->len` (total frame) rather than
`skb->len - ies_offset` (IE region), causing the IE parser to scan
36 bytes (core.c) or 28 bytes (wow.c) past the actual IE data.

Production trigger requires a physical Realtek rtw89 WiFi adapter
receiving a crafted beacon; verified instead with a kernel test module
that calls cfg80211_find_ie() with the same incorrect length calculation
applied to a kmalloc'd buffer sized to the IE region:

  BUG: KASAN: slab-out-of-bounds in find_ie_kern.constprop.0+0xe0/0x100
  Read of size 1 at addr ffff88810e1ab864 by task insmod/1901

  CPU: 3 UID: 0 PID: 1901 Comm: insmod Tainted: G           O       6.12.115 #1
  Call Trace:
    dump_stack_lvl+0x93/0xd0
    print_report+0xce/0x660
    kasan_report+0xe0/0x110
    find_ie_kern.constprop.0+0xe0/0x100

The function cfg80211_find_ie() is a production kernel API in
net/wireless/scan.c (unmodified). The OOB is in the IE length
calculation in the rtw89 driver, not in cfg80211 itself.

Proposed patch
--------------
Replace `skb->len` with the actual IE region length, with a guard
against underflow from malformed/truncated skbs:

--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ rtw89_core_cancel_6ghz_probe_tx()
 	const u8 *ies = mgmt->u.beacon.variable;
+	size_t ies_offset = ies - skb->data;
+
+	if (skb->len < ies_offset)
+		return;

-	ssid_ie = cfg80211_find_ie(WLAN_EID_SSID, ies, skb->len);
+	ssid_ie = cfg80211_find_ie(WLAN_EID_SSID, ies, skb->len - ies_offset);

--- a/drivers/net/wireless/realtek/rtw89/wow.c
+++ b/drivers/net/wireless/realtek/rtw89/wow.c
@@ rtw89_wow_parse_akm()
 	const u8 *ies = mgmt->u.assoc_req.variable;
+	size_t ies_offset = ies - skb->data;
+
+	if (skb->len < ies_offset)
+		return;

-	rsn = cfg80211_find_ie(WLAN_EID_RSN, ies, skb->len);
+	rsn = cfg80211_find_ie(WLAN_EID_RSN, ies, skb->len - ies_offset);

I have not shared this finding publicly. Happy to work with the WiFi
maintainers on the patch if any changes are needed.

Best regards,
Tanuj Sharma
ertanuj96@gmail.com

             reply	other threads:[~2026-11-23 10:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 10:10 Tanuj Sharma [this message]
2026-11-23 10:59 ` [SECURITY] wifi: rtw89: OOB read in beacon/probe-resp IE parsing (OTA, pre-auth) Tanuj Sharma
2026-11-23 12:09 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261123101028.58146-1-ertanuj96@gmail.com \
    --to=ertanuj96@gmail.com \
    --cc=gary.chang@realtek.com \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=phhuang@realtek.com \
    --cc=pkshih@realtek.com \
    --cc=security@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.