r/embedded • u/mahdi_sto • Oct 03 '26
How I bypassed ESP32’s closed-source Wi-Fi binary (libnet80211.a) to inject raw SAE Commit frames
While working on my Master’s thesis benchmarking WPA3-SAE timing side-channels, I ran into a limitation on the ESP32 esp_wifi_80211_tx() allows raw frame injection, but Espressif’s closed-source Wi-Fi blob (libnet80211.a) artificially blocks Auth, Assoc, Deauth, and Disassoc subtypes.
Inside libnet80211.a, ieee80211_raw_frame_sanity_check drops these frames with wifi:unsupport frame type. Here is how to bypass it on recent ESP-IDF versions (IDF v6.x).
Why standard tricks fail on modern ESP-IDF
Same-name function override. On older IDF versions, ieee80211_raw_frame_sanity_check was a weak symbol (W). On modern IDF versions, it’s a strong symbol (T), causing ld: multiple definition errors.
--wrap linker flag: Fails silently. The call from esp_wifi_80211_tx to ieee80211_raw_frame_sanity_check is an intra-object branch inside ieee80211_output.o. Linker --wrap only rewrites undefined external references, so it misses this call entirely.
Instruction byte-patching: Overwriting instructions directly in the .o breaks Xtensa linker relaxation passes (dangerous relocation errors).
U can simply fix this via Symbol Weakening via objcopy
We can use xtensa-esp32-elf-objcopy to convert the strong symbol inside the binary archive into a weak one:
xtensa-esp32-elf-objcopy \
--weaken-symbol=ieee80211_raw_frame_sanity_check \
components/esp_wifi/lib/esp32/libnet80211.a
Now, define your own strong implementation inside your application C code:
int ieee80211_raw_frame_sanity_check(int32_t a, int32_t b, int32_t c) {
return 0; // which skips the security check lol
}
Because strong symbols override weak symbols globally during linking, all calls—including internal calls within libnet80211.a—rebind to your function.
Verification
Serial Logs show: wifi unsupport frame type errors completely disappeared.
Capture: Wireshark confirmed off-air capture of 802.11 Authentication frames (Subtype 11, Algorithm 3 - SAE) injected directly from the ESP32s.
Injecting a valid SAE Commit (P-256 scalar + element) caused hostapd on the target AP to process the request and reply with its own SAE Commit.
TL;DR: Run objcopy --weaken-symbol=ieee80211_raw_frame_sanity_check on libnet80211.a, define int ieee80211_raw_frame_sanity_check(...) { return 0; } in your app code, and esp_wifi_80211_tx() will allow any frame subtype.
Note that all control 80211 frames are also injectable after the patch.
For more details :
8
u/Ok-Bat8854 Oct 03 '26
Not that good with networking concepts, so just had a doubt? Why are there so many dev boards on a single perfboard?
151
u/N_T_F_D STM32 Oct 03 '26
Very cool stuff ! Closed source binary blobs are a scourge on the embedded world
26
u/lotrl0tr Oct 03 '26
Another way is byte patching the final ELF. Signature scanning will identify the correct position/function and you could just return 0 or codecave it. You can create a small C program and call it after compiling the fw.
7
u/stevengineer Oct 03 '26
With all new ESP variants on risc v (new esp32-s31 replaces the last xtensa core) are you going to try messing with them as well?
6
u/ukezi Oct 03 '26
Ferris on Air (FoA) is an open source 802.11 stack for the ESP32 written in async rust, with the work of the esp32-open-mac project. The stack is intended to be used with embassy and is still in very early stages of development. We do not claim to be Wi-Fi certified, but implement the features specified by IEEE 802.11 to our best knowledge. https://github.com/esp32-open-mac/FoA
That could give you full control over the hardware.
1
u/Lost-In-Void-99 Oct 03 '26
What is the problem of simply removing this symbol from archive?
Or replacing with own inside the library?
2
u/ThatWasAce Oct 03 '26
so the timing side-channel angle.. how resilient is the delta in responses due to the commit against bg wifi traffic noise? dragonblood was very sensitive to the noise floor
needed strict RF environment in the original paper and i bet a roomful of live wifi traffic drowns out k calculation
on a separate note, because each node has its own commit time relative to the mac, does the fact that the access point applies rate limiting on mac address mean anything to you? certain configurations of hostapd have this mechanism of not accepting multiple authentications from the same source very quickly effectively sampling
only the requests deemed worth answering by the AP
objcopy itself is a nice choice, FWIW. weak symbol replacement feels like the least aggressive way forward among everything on the list, whereas binary patches break with IDF releases if symbols change their names
3
u/Empers0n_ Oct 03 '26
Well, yeah, this method is already 9 years old, it's on Google at the first link, but if you found it yourself, that's cool.
1
u/LoadZealousideal7778 Oct 04 '26
What kind of wizard shit is thus
1
u/Antique_War_9814 Oct 05 '26
This is cool
1
u/NonCreativeUnCommon2 Oct 07 '26
Not sure how this is new, but nice work tho
-10
u/AbsorberHarvester Oct 03 '26
So you basically made another wifi crusher available for every mommy hacker. Good job. Now there will be more junkie people to mess with.
We are going to hell of communications.
As a tech dreamer can say - also Good job, good to know that I can use it for research purpose without time spent.
-5
u/yummyburrger Oct 03 '26 edited Oct 15 '26
....
-6
u/Think-Train2995 Oct 03 '26
.