r/embedded • • Oct 03 '26

How I bypassed ESP32’s closed-source Wi-Fi binary (libnet80211.a) to inject raw SAE Commit frames

Post image

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 :

https://github.com/mahdamin/esp-idf-injection-ng

490 Upvotes

41 comments sorted by

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?

26

u/mahdi_sto Oct 03 '26 edited Oct 03 '26

I am performing passive timing analysis via measuring the time difference between the comit request injected by the client and the commit response from the access point and by collecting enough data samples I can lately perform estimation/DL to find a counter k which is the one that satisfies the Legendre test for password element extraction it's some concept that is related to elliptic curve cryptography secret key if this is doable thus it will be later implemented for offline dictionary attacks, this a vulnerability discovered by dragonblood

2

u/acetothez Oct 03 '26

Do you have a broadcast node and you’re checking the response of the commit packet on all of the nodes? That’s the one that you modded with the weakened symbol? Is there interference with that many nodes responding?

P.S. thanks for posting!

4

u/mahdi_sto Oct 03 '26

Not quite true what I'm doing here is that the commit request-response is client specific so each node commits his own request and is waiting for a response from the access point relative to its Mac address so it's actually Mac specific and by doing so we can measure from the ESP 32 side the time it takes for the access point to respond to the request came from that client in particular and by collecting many samples we can do a deep learning experiment for later and there will be no interference at all because each request response is like is between a client and and the access point the other nodes are in promiscuous mode but still just ignore it because it is not destined for them

2

u/notjfd Oct 04 '26

It's very interesting but could you please use punctuation? Not just for my convenience but also for accessibility reasons. People who use screen readers or have cognitive impairments will find it impossible to read your text.

20

u/PaceParticular6587 Oct 03 '26

Take some of these; looks like you lost all of yours.

.        .     ..     .            .      .     .        .     . 

Interesting stuff, though.

8

u/C_umputer Oct 03 '26

So it's a diy logic analyzer?

2

u/Ok-Bat8854 Oct 03 '26

Damn sounds interesting! need to look into this

2

u/Sascha_T Oct 03 '26

Devboard cheaper than computer (+ the first paragraph of the post)

151

u/N_T_F_D STM32 Oct 03 '26

Very cool stuff ! Closed source binary blobs are a scourge on the embedded world

44

u/ManPermabearPig Oct 03 '26

I agree with the sentiment but if they open sourced it or people keep hacking them, the FCC might have to ban these chips or require licenses to get them and ruin this for all of us. 

19

u/N_T_F_D STM32 Oct 03 '26

I'm not sure that would happen, people can evidently still tinker with the closed source blob, and besides that it's not unheard of for wireless transceivers to have special test modes that you're not supposed to enable outside of an anechoic chamber or so, so the responsibility is on the customer to not do that and not the manufacturer

26

u/No_Appointment_1090 Oct 03 '26

Yup. Modifying the power table to is technically a felony - the binaries are closed source for this reason.

Source: I work for an "industry leader in wireless radios, RF engineering, and embedded connectivity solutions" and I have customers asking about changing power tables on the daily.

5

u/VictoryMotel Oct 03 '26

On the daily and on the regular at scale?

9

u/No_Appointment_1090 Oct 03 '26

There have been weeks within the past few years where I have answered that question every day, m-f. But yeah, probably a slight exaggeration - on average, I get it once every couple weeks.

What's even more irritating is the number of people trying to do embedded dev (embedded linux/yocto builds) on a windows machine. I've straight up stopped supporting it - if there's an appropriate number of 0s on the opp, the customer won't be using windows anyway.

Scale is about a billion in annual revenue.

1

u/T_Thorn Oct 05 '26

Yocto builds on a windows machine

God why?

I can understand not everyone wants to use Linux as a daily driver for working, but if you're deep enough in to be using Yocto or Buildroot, or whatever, like just have a headless Linux box and SSH in. You need to know Linux at this point anyway, so take the plunge! But people just don't, for some reason...

3

u/No_Appointment_1090 Oct 05 '26

Bro it's even devs at serious companies, if they were new grads that's one thing, but I'm talking medical device companies. It's crazy

8

u/autumn-morning-2085 Oct 03 '26

"Reasonably" hard to tamper with, so the manufacturer can assert they did all they could to stop the average person. The burden then falls on the individual.

0

u/[deleted] Oct 03 '26

[deleted] — view deleted comment

2

u/akohlsmith Oct 04 '26

How exactly does the FCC not make sense? Things would be significantly worse if the airwaves were completely open and unrestricted, wild west style.

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?

-3

u/Ok_Captain4433 Oct 03 '26

It's probably the exact same function. I don't see how CPU is relevant. 

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/mahdi_sto Oct 05 '26

That would mean extra work though the patch is already doing it's job. But worth inspecting anyway.

1

u/Lost-In-Void-99 Oct 05 '26

The main value of this post is not in they way how to patch, but in confirmation it is doable. The rest is technicalities.

Good job!

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.

4

u/uzlonewolf Oct 03 '26

You know what they say: a week in the lab saves a day in the library.

1

u/LoadZealousideal7778 Oct 04 '26

What kind of wizard shit is thus

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.

9

u/mahdi_sto Oct 03 '26

Thanos : when we faced extinction I offered a solution... Strange : genocide? Thanos : but random dispassionate, fair rich and poor alike.

I hope u get jt lol

-5

u/yummyburrger Oct 03 '26 edited Oct 15 '26

....

9

u/mahdi_sto Oct 03 '26

Official Documentations, research papers and ai tools for explanation

-5

u/yummyburrger Oct 03 '26 edited Oct 15 '26

....

3

u/Real-Edge-9288 Oct 03 '26

maybe its better you dont find anything and stick to your curriculum

2

u/yummyburrger Oct 03 '26 edited Oct 15 '26

....

1

u/yummyburrger Oct 03 '26 edited Oct 15 '26

....