Wanted to download an ISO, ended up writing a kernel exploit
The TP-Link EAP770 access point corrupts large downloads over Wi-Fi because a DMA cache coherency bug in Qualcomm's driver causes stale cache lines to overwrite received packets, and the checksum is recalculated over the corrupted data. An attacker cannot directly exploit this, but the author wrote a kernel exploit to gain root and disable the offload, which stops the corruption.
blog.dfb.sh
Published on blog.dfb.sh
In August 2023 I bought a shiny new Wi-Fi 7 access point, a TP-Link EAP770. The connection was a bit janky, a video would occasionally start buffering, but it didn't bother me much.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely a DMA cache coherency bug in Qualcomm's qca-nss-dp driver: packet buffers are recycled without invalidating the CPU cache for the whole receive buffer, so dirty cache lines can be written back after the NIC has received a new packet.
Impact
The corruption causes large downloads over Wi-Fi to fail with TLS and SSH errors, and the author had to exploit the kernel to gain root and disable the offload, which reduced download speed by about 8%.
What the attacker needed
TP-Link EAP770 v1 access point; LAN-to-Wi-Fi traffic; Several concurrent TCP streams; Root access to disable offload
The fix
The corruption was stopped by disabling the SFE/PPE offload, but the settings reset after a reboot and the author uses a watcher to rerun the exploit; a proper fix would be for Qualcomm to correct the DMA cache maintenance in their driver.
How it was found
- Capture a failing HTTPS download with tcpdump and observe a TCP segment with wrong bytes but a valid checksum.
- Switch to raw TCP between a wired machine and the Wi-Fi laptop, sending known data to compare byte for byte.
- Confirm the corruption only appears with several TCP streams at once, in the LAN-to-Wi-Fi direction.
- Rule out the laptop by swapping the Wi-Fi card, and rule out the cable and air by checking wired clients and CCMP MIC.
- Identify the bridge between Ethernet and Wi-Fi inside the AP as the likely culprit, pointing at Qualcomm's SFE/PPE offload.
- Disable SFE/PPE by writing zeros to two sysfs files, which requires root, so build a kernel exploit to gain root.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This is a bug in a Wi-Fi access point that causes large downloads to fail with errors like 'bad record mac'. The access point's network chip sometimes writes old data over new data because it doesn't properly synchronise its memory caches, and then it recalculates the checksum so the corrupted data looks valid. The author had to exploit the device's kernel to get root access and turn off the buggy feature.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.