CVE-2025-38657 Overview
CVE-2025-38657 is a vulnerability in the Linux kernel's rtw89 Wi-Fi driver, specifically within the rtw89_core_mlsr_switch() function used for Multi-Link Single Radio (MLSR) operations. The link_id value is supplied by a local user through debugfs. When this value exceeds BITS_PER_LONG, the driver performs a shift operation that wraps around, which can lead to an out-of-bounds read later in execution. The vulnerability is limited to users with root access to debugfs, reducing its practical security impact. The upstream fix caps link_id at IEEE80211_MLD_MAX_NUM_LINKS (15).
Critical Impact
A local privileged user can trigger an out-of-bounds read in the Linux kernel Wi-Fi stack, resulting in kernel memory corruption or denial of service on affected systems.
Affected Products
- Linux Kernel 6.16
- Realtek rtw89 Wi-Fi driver (MLSR code path)
- Distributions shipping the affected kernel version without the backported fix
Discovery Timeline
- 2025-08-22 - CVE-2025-38657 published to NVD
- 2026-07-30 - Last updated in NVD database
Technical Details for CVE-2025-38657
Vulnerability Analysis
The vulnerability resides in the rtw89_core_mlsr_switch() function of the Realtek rtw89 Wi-Fi driver. This function handles Multi-Link Single Radio switching for 802.11be (Wi-Fi 7) Multi-Link Devices (MLD). The driver receives a link_id parameter from userspace through a debugfs interface. It then uses this identifier in a bitwise shift operation without validating that the value fits within the target integer width.
When link_id is greater than or equal to BITS_PER_LONG (64 on 64-bit platforms, 32 on 32-bit), the shift expression produces undefined behavior in C. The compiled result typically wraps or produces an unexpected mask value. That corrupted mask is then used to index or iterate structures tied to per-link state, resulting in an out-of-bounds memory read outside the intended MLD link array. This maps to [CWE-125] Out-of-Bounds Read.
Root Cause
The root cause is missing input validation on a user-controlled integer used as a bit shift operand. The driver assumed link_id fell within the valid MLD link range but did not enforce that assumption before performing arithmetic on it. The upstream patch introduces a bound check against IEEE80211_MLD_MAX_NUM_LINKS, which caps the value at 15 and eliminates the wrap condition.
Attack Vector
Exploitation requires local access with root privileges, since debugfs is only writable by root by default. A privileged local user writes a crafted link_id value to the relevant rtw89 debugfs file, triggering the shift wrap and subsequent out-of-bounds access inside rtw89_core_mlsr_switch(). The realistic impact is kernel information disclosure or a kernel oops leading to denial of service on systems using the Realtek Wi-Fi hardware supported by rtw89.
No synthetic exploitation code is provided. Refer to the upstream commits for the exact call path and fix implementation: kernel.org commit 417cfa9c and kernel.org commit 53cf4889.
Detection Methods for CVE-2025-38657
Indicators of Compromise
- Kernel oops or panic messages referencing rtw89_core_mlsr_switch or the rtw89 module in dmesg or /var/log/kern.log
- Unexpected process writes to rtw89 debugfs entries under /sys/kernel/debug/
- KASAN (Kernel Address Sanitizer) reports flagging out-of-bounds reads originating in the rtw89 MLSR code path
Detection Strategies
- Audit filesystem writes to /sys/kernel/debug/rtw89/ paths using Linux audit rules on debugfs
- Query kernel version inventory to identify hosts running vulnerable Linux 6.16 builds with the rtw89 driver loaded
- Correlate kernel crash telemetry with recent debugfs write activity from root-owned processes
Monitoring Recommendations
- Monitor uid 0 activity that opens or writes files under debugfs mount points, which is unusual on production hosts
- Alert on Wi-Fi driver module crashes and unexpected rtw89 module reloads across the fleet
- Track patch state of the Linux kernel using package inventory data and flag hosts that have not received the fixed build
How to Mitigate CVE-2025-38657
Immediate Actions Required
- Update the Linux kernel to a version containing commits 417cfa9c and 53cf4889, or apply the vendor-backported fix supplied by your distribution
- Restrict or unmount debugfs on production systems that do not require it for troubleshooting
- Unload the rtw89 driver on servers or fixed-function systems that do not use Realtek Wi-Fi hardware
Patch Information
The fix limits the user-supplied link_id to IEEE80211_MLD_MAX_NUM_LINKS (15) before it is used in the bit shift operation. See the upstream commits 417cfa9cc44fbe6bceab786f9a4ee5a210f1288e and 53cf488927a0f79968f9c03c4d1e00d2a79731c3. Consult your distribution's security tracker for the specific package version containing the backport.
Workarounds
- Mount debugfs with restrictive permissions or leave it unmounted where it is not required, since only root can trigger the flaw through the debugfs interface
- Blacklist the rtw89 kernel module on hosts that do not use Realtek Wi-Fi 6/7 hardware
- Enforce least privilege for root-equivalent operations and gate manual driver tuning behind change control
# Blacklist the rtw89 driver until the kernel is patched
echo "blacklist rtw89_core" | sudo tee /etc/modprobe.d/rtw89.conf
echo "blacklist rtw89_pci" | sudo tee -a /etc/modprobe.d/rtw89.conf
sudo update-initramfs -u
# Optionally restrict debugfs access
sudo umount /sys/kernel/debug 2>/dev/null || true
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

