#2917·firmware

Off-by-one out-of-bounds read in RSN information element parser

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

extractRSNInfo()'s bounds check only guarantees enough bytes for the RSN version field, not for the group-cipher byte read immediately after it. With tagLen == 2 positioned so the tag's declared bytes are exactly the last two bytes of the frame, the check passes but the read lands one byte past the buffer.

Location: src/modules/wifi/karma_attack.cpp, extractRSNInfo()

cpp
if (tag == 0x30 && tagLen >= 2) {                    // should be tagLen >= 3
    if (pos + 2 + tagLen <= len) {
        rsn.version = (frame[pos + 2] << 8) | frame[pos + 3];
        uint8_t groupCipher = frame[pos + 4];        // reads one byte the check doesn't cover

Confirmed under AddressSanitizer with a 28-byte crafted 802.11 frame; also independently rediscovered by fuzzing within seconds.

Suggested fix: change the guard to tagLen >= 3, matching the margin already used two lines below for pairwiseCipher (tagLen > 6) and akmSuite (tagLen > 12).