#2918·firmware

extractMAC() reads out of bounds; leaked bytes get broadcast over the air

Author: TheOnionJrCreated Sep 21, 2026Updated Sep 21, 2026

extractMAC() reads 6 fixed bytes (frame[10..15]) with no length check. Its first call site in probe_sniffer() is gated only by a one-bit subtype check on frame[0], never on length.

Location: src/modules/wifi/karma_attack.cpp

cpp
uint8_t frameSubType = (frame[0] & 0xF0) >> 4;
if (frameSubType == 0x00 && karmaConfig.enableDeauth) {
    String clientMAC = extractMAC(pkt);   // no length check anywhere before this
    sendDeauth(clientMAC, ...);

Confirmed under AddressSanitizer with a 2-byte input. Worse: sendDeauth() sscanfs clientMAC straight into the destination-address field of an outgoing deauth frame, sent unencrypted, so anyone sniffing nearby can read the leaked heap bytes back out.

Suggested fix:

cpp
if (frameSubType == 0x00 && karmaConfig.enableDeauth && pkt->rx_ctrl.sig_len >= 16) {

More durably, move the length check inside extractMAC() itself.