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

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).

The Fix: 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: 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.

Full Exchange: 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.

u/mahdi_sto — 12 days ago

Found thecarrier wasn't the only signal accidentally caught a harmonic on a completely different receiver

Pulled a cheap analog wireless transmitter board out of an old headphone set (the bulk Shenzhen wireless-earpiece kind glob-top IC, single crystal, hand-wound antenna coil, no markings on the actual RF chip because of course not).

Board has a crystal can silkscreened "XTAL" and marked 25.200 on the case. Swept it with the RTL-SDR and got a clean, strong signal at 75.2 MHz. Cool, that's ≈ 25.2 × 3 makes sense, cheap VHF transmitters often just run a crystal into a tripler stage instead of a proper PLL.

Then just messing around, I grabbed an old Sony SW100 (yeah, the little world-band shirt-pocket radio) and swept the FM broadcast band on it for fun. Picked up the same audio, fainter and noisier, at 100.8 MHz.

Took a sec, then realized: 100.8 = 25.2 × 4. Same crystal, same multiplier chain, just the next harmonic up leaking past the output filtering. The tripler stage isn't a clean multiplier in practice it also spits out weaker energy at other integer multiples, and this board apparently doesn't filter well enough to kill the 4th harmonic before the antenna.

So the "carrier frequency" printed nowhere on the datasheet (there is no datasheet, RIP) turned out to have a whole family of harmonics riding along, one of which happens to land right in the commercial FM band where a generic receiver could stumble onto it.

Kind of a fun reminder that these cheap analog boards leak way more than their "spec" frequency if you go looking with an SDR. Anyone else run into spurious harmonics like this being audibly receivable rather than just showing up as a small blip in a waterfall?

u/mahdi_sto — 3 months ago

Loyalty system that reads national ID cards and stores nothing off them

Offline POS going into a coffee shop soon. The shop issues no cards of its own , it reads whatever ISO 7816 card the customer already has (national ID, health card, driving licence) and takes one value: the chip serial. That serial keys a row in a local SQLite file. Nothing is written to the card. No name, no photo, no ID number is read or stored.

Balance lives in the DB, not on the card, so a lost card isn't a lost balance , you tap a new one to the same account.

Clone problem: a serial is public, anyone with a $15 reader can lift one. So each account is bound to the card family it enrolled with. Everyday accounts are document-only, a blank white card carrying the right serial gets refused before the balance is touched, and the document itself has a photo on it that the cashier is looking at.

I'll be upfront that ATR isn't authenticated and an emulator can spoof a family. The check isn't the control , it's what tells the cashier to actually look at the card. The security is the human comparison.

Top tier is the inverse: blank JavaCards only, because blanks are the one family you can load an applet onto. No face there, so they do challenge-response instead, fresh nonce every tap, key never leaves the chip, DB holds only public keys.

Interested if anyone's done card-family binding differently. CPLC vs ATR for family fingerprinting, mostly.

u/mahdi_sto — 3 months ago

Barcode scanner is a mouse in disguise on Kali Linux

I have been able to generate some code 128 barcode samples (because it suppors the full ASCII characters )that made this barcode scanner of the mark Raptor to just perform some serious actions given it is defined as an HID specifically on Kali Linux OS scrolling on the desktop, entering specific files/folders and selecting items which is in my eyes quite dangerous given that this is a new model barcode scanner that is commonly used here where I live.

From what I know there should some sort of a lookup table in the firmware that prevents actionable keystrokes via filtering out and letting only write+only characters.

The scanner is borrowed from my friend, it is already used in the store for validating purchases.

u/mahdi_sto — 3 months ago
▲ 423 r/embedded+1 crossposts

Barcode scanner can access the terminal !

So I have I've got this barcode scanner from someone, the brand ss called Captor with reference number S-80. So I'm looking if it is possible to construct a barcode sample with some specific encoding that makes it possible to to type (Win+R). Given that the barcode scanner is as an HID device. So it's just behaving like a keyboard. So I think if I just figure that the lookup table in the firmware allows special charcters mapping it to some special string of characters then it will be possible to enter the terminal which is a critical vulnerability already.

The encoding/decoding capabilities are

EAN-13, EAN-8, UPC-A, UPC-E, ISBN/ISSN, UCC/EAN 128, Code 11, Code 39, Code 93, Code 128, Codabar, Industrial 2 of 5, Interleaved 2 of 5, Matrix 2 of 5, MSI-Plessey, UK/PLESSEY, China Postal Code.

u/mahdi_sto — 3 months ago
▲ 237 r/embedded

Car Key fob reverse engineering

Lately I've been trying to recover the key fob protocol of my bmw 320d 2005 car till I discovered that the key fob operates on 868.35mhz with what is called Frequency Shift Keying (transmitting a significant via modulating the msg bits as frequency shift instead of amplitude shift since noise rarely affects the frequency) to lock/unlock or trunk, everytime I capture something using the RTL sdr with gqrx on Kali I get different signals for pressing same button which indicates that this is not a trivial On Off Keying but some proprietary protocol is being implemented, from the amplitude to time plot I can clearly see the preamble alternating bits then a fixed and indow of bits across all button pressings which suggests some sort of an identifier.

Any one has experience on such project feel free to leave a comment.

Or if u know some sort of tip that helps me recover the binary representation of the msg being transmitted you are welcomed.

u/mahdi_sto — 3 months ago
▲ 154 r/masterhacker+1 crossposts

FSK/OOK based layer-2 protocol reverse engineering

Lately I've been trying to recove the key fob protocol of my bmw 320d 2005 car till I discovered that the key fob operates on 868.35mhz with what is called Frequency Shift Keying to lock/unlock or trunk, everytime I capture something using the RTL sdr with gqrx on Kali I get different signals for pressing same button which indicates that this is not a trivial On Off Keying but some proprietary protocol is being implemented, from the amplitude to time plot I can clearly see the preamble alternating bits then a fixed and indow of bits across all button pressings which suggests some sort of an identifier.

Any one has experience on such project feel free to leave a comment.

Or if u know some sort of tip that helps me recover the binary representation of the msg being transmitted you are welcomed.

u/Sufficient-Pair-1856 — 3 months ago

FDK/OOK Based layer-2 protocol reverse engineering

Lately I've been trying to recove the key fob protocol of my bmw 320d 2005 car till I discovered that the key fob operates on 868.35mhz with what is called Frequency Shift Keying to lock/unlock or trunk, everytime I capture something using the RTL sdr with gqrx on Kali I get different signals for pressing same button which indicates that this is not a trivial On Off Keying but some proprietary protocol is being implemented, from the amplitude to time plot I can clearly see the preamble alternating bits then a fixed and indow of bits across all button pressings which suggests some sort of an identifier.

Any one has experience on such project feel free to leave a comment.

Or if u know some sort of tip that helps me recover the binary representation of the msg being transmitted you are welcomed.

u/mahdi_sto — 3 months ago
▲ 2.3k r/hardwarehacking+2 crossposts

DDoS on WPA3!

Been spending a couple of lonths tinkering with a DIY multi-node wireless security rig, and I finally got the hardware coordination working smoothly.

The project uses a mix of ESP32 boards to look at how modern networks handle disconnections and roaming. I'm using an ESP32-S3 (with 8MB RAM / 16MB Flash) to spin up a clone access point, while an ESP32-CAM(Master) handles the orchestration alongside a couple of standard dev boards(Slaves).

The interesting part was tackling WPA3. Since WPA3 mandates Protected Management Frames (PMF), traditional layer-2 deauth frames don't really cut it anymore. To work around this and test client reconnection behaviors, I integrated two NRF24L01 modules to introduce a highly localized, 1-second burst of 2.4GHz RF disruption. The goal is to see how the WPA3 handshake and roaming mechanisms react when forced to re-authenticate under sudden signal loss just after triggering the SA query mechanism causing clients to be kicked out from the network by the Ap itself and never connecting back thanks to the evil twin Ap.

u/mahdi_sto — 4 months ago
▲ 33 r/masterhacker+1 crossposts

I Spent a Day Hacking My Own Security Camera. It Gave Up Its Secrets by Midnight.

Long-ish, but if you run Dahua (or any IP cam) at home, this might matter.

Bought a DH-F2C-PV. Audited it properly before trusting it. Expected dumpster fire. Instead: firmware is patched against the big old CVEs, cloud path uses QUIC+TLS, ARP spoofing blocked by the router. Solid… mostly.

Then I forced local LAN mode (blocked outbound internet → app still streams instantly). That's when it falls apart.

Quick surface scan:

- 80/tcp — HTTP admin, plaintext creds 😬

- 554/tcp — RTSP Digest auth, defaults rejected

- 37777/tcp — Dahua DHIP/SDK, auth works, old CVEs patched but port still open

- No 443, 8080, etc.

Cloud path (P2P relays in China/Alibaba/US) is encrypted end-to-end. Couldn’t MITM it from LAN.

**The vuln: local fallback stream**

Same-LAN → app switches to direct PTCP/DHIP → raw DHAV over UDP. No TLS, no SRTP, nothing. Plaintext video+audio frames across Wi-Fi.

How I intercepted it (passive + PSK) :

  1. Monitor mode + channel lock

  2. tshark capture with WPA-PSK pre-loaded

  3. aireplay-ng deauth phone → forces fresh 4-way handshake

  4. Open app, stream ~90s

  5. airdecap-ng decrypts → ~12 MB plaintext pcap

  6. Filter camera→phone UDP → extract DHAV payload

  7. Custom python script carves audio frames (0xf0 type)

  8. ffmpeg -f alaw -ar 8000 → clean room audio playback

DHAV structure (reverse-engineered, zero public docs):

0–3 DHAV magic

4 frame type (fd=I, fc=P, f0=audio)

8–11 timestamp LE

12–15 payload size LE

32+ payload (proprietary HEVC for video, G.711 A-law audio)

Video is non-standard HEVC — won’t render in ffmpeg/vlc without Dahua SDK. Audio decodes fine.

Fix (actually works);

- VLAN the camera — kills local path completely, forces encrypted cloud

- Disable port 37777 if you don’t need it

- Enable HTTPS admin panel (if the option exists)

Full annotated packet captures + DHAV frame map in the Medium writeup (link in first comment).

What cams are you running? Seen this plaintext-local-stream trick in other brands (Reolink, Hikvision, etc.)?

Thoughts?

Link to full publication:

https://medium.com/@mahdicxx/i-spent-a-day-hacking-my-own-security-camera-it-gave-up-its-secrets-by-midnight-e982be933d89

u/mahdi_sto — 4 months ago

Captive Portal on a single ESP32

Fit a WifiPumpkin3's rogue AP inside an ESP32s3 supporting APSTA, DNS spoofing, NAPT tunneling

Been digging into what the ESP32 WiFi stack is actually capable of for wireless security research and honestly it's way more powerful than people give it credit for.

The idea was to port the core concepts of WiFiPumpkin3 onto the chip itself. No Kali, no wifi interfaces, just a 5 bucks microcontroller powered from a USB bank.

The interesting part architecturally is running APSTA mode, the chip acts as an AP for clients while simultaneously connecting upstream as a STA to the real router. DNS spoofing handles captive portal redirection until the portal interaction is done, lets queries pass through to the real upstream. NAPT takes care of the internet tunneling so connected clients get actual internet access while causing traffic reorientation and thus sniffing it, which makes the whole thing behave like a legitimate hotspot. I tried to serve HTTPS directly from the chip with a cert generated for the spoofed domain but it didn't work, note that there's also a separate admin interface for scanning, cloning APs, monitoring traffic and managing everything in real time.

The main challenge was keeping DNS, HTTPS and NAPT tasks running concurrently on FreeRTOS without race conditions on a single radio doing two jobs at once.

Repo: github.com/mahdamin/ESP32-WiFiPumpkin

Happy to talk through the APSTA or NAPT implementation if anyone's done similar stuff.

reddit.com
u/mahdi_sto — 5 months ago
▲ 2 r/wifi

Captive Portal on a single ESP32!

Fit a WifiPumpkin3's rogue AP inside an ESP32s3 supporting APSTA, DNS spoofing, NAPT tunneling

Been digging into what the ESP32 WiFi stack is actually capable of for wireless security research and honestly it's way more powerful than people give it credit for.

The idea was to port the core concepts of WiFiPumpkin3 onto the chip itself. No Kali, no wifi interfaces, just a 5 bucks microcontroller powered from a USB bank.

The interesting part architecturally is running APSTA mode, the chip acts as an AP for clients while simultaneously connecting upstream as a STA to the real router. DNS spoofing handles captive portal redirection until the portal interaction is done, lets queries pass through to the real upstream. NAPT takes care of the internet tunneling so connected clients get actual internet access while causing traffic reorientation and thus sniffing it, which makes the whole thing behave like a legitimate hotspot. I tried to serve HTTPS directly from the chip with a cert generated for the spoofed domain but it didn't work, note that there's also a separate admin interface for scanning, cloning APs, monitoring traffic and managing everything in real time.

The main challenge was keeping DNS, HTTPS and NAPT tasks running concurrently on FreeRTOS without race conditions on a single radio doing two jobs at once.

Repo: github.com/mahdamin/ESP32-WiFiPumpkin

Happy to talk through the APSTA or NAPT implementation if anyone's done similar stuff.

reddit.com
u/mahdi_sto — 5 months ago
▲ 6 r/esp32projects+1 crossposts

Captive Portal on a single ESP32!

Fit a WifiPumpkin3's rogue AP inside an ESP32s3 supporting APSTA, DNS spoofing, NAPT tunneling

Been digging into what the ESP32 WiFi stack is actually capable of for wireless security research and honestly it's way more powerful than people give it credit for.

The idea was to port the core concepts of WiFiPumpkin3 onto the chip itself. No Kali, no wifi interfaces, just a 5 bucks microcontroller powered from a USB bank.

The interesting part architecturally is running APSTA mode, the chip acts as an AP for clients while simultaneously connecting upstream as a STA to the real router. DNS spoofing handles captive portal redirection until the portal interaction is done, lets queries pass through to the real upstream. NAPT takes care of the internet tunneling so connected clients get actual internet access while causing traffic reorientation and thus sniffing it, which makes the whole thing behave like a legitimate hotspot. I tried to serve HTTPS directly from the chip with a cert generated for the spoofed domain but it didn't work, note that there's also a separate admin interface for scanning, cloning APs, monitoring traffic and managing everything in real time.

The main challenge was keeping DNS, HTTPS and NAPT tasks running concurrently on FreeRTOS without race conditions on a single radio doing two jobs at once.

Repo: github.com/mahdamin/ESP32-WiFiPumpkin

Happy to talk through the APSTA or NAPT implementation if anyone's done similar stuff.

reddit.com
u/mahdi_sto — 4 months ago

WifiPumkin on a single ESP32!

Fit a WifiPumpkin3's rogue AP inside an ESP32s3 supporting APSTA, DNS spoofing, NAPT tunneling

Been digging into what the ESP32 WiFi stack is actually capable of for wireless security research and honestly it's way more powerful than people give it credit for.

The idea was to port the core concepts of WiFiPumpkin3 onto the chip itself. No Kali, no wifi interfaces, just a 5 bucks microcontroller powered from a USB bank.

The interesting part architecturally is running APSTA mode, the chip acts as an AP for clients while simultaneously connecting upstream as a STA to the real router. DNS spoofing handles captive portal redirection until the portal interaction is done, lets queries pass through to the real upstream. NAPT takes care of the internet tunneling so connected clients get actual internet access while causing traffic reorientation and thus sniffing it, which makes the whole thing behave like a legitimate hotspot. I tried to serve HTTPS directly from the chip with a cert generated for the spoofed domain but it didn't work, note that there's also a separate admin interface for scanning, cloning APs, monitoring traffic and managing everything in real time.

The main challenge was keeping DNS, HTTPS and NAPT tasks running concurrently on FreeRTOS without race conditions on a single radio doing two jobs at once.

Repo: github.com/mahdamin/ESP32-WiFiPumpkin

Happy to talk through the APSTA or NAPT implementation if anyone's done similar stuff.

reddit.com
u/mahdi_sto — 5 months ago