D~DIDI~DIDIDI!!!!

0%

WifiFragattacks部署

WIFI测试漏洞验证工具

Fragattacks

1.完整环境部署流程

系统要求

​ Ubuntu 20.04

​ kernel 5.8

安装流程

  • 替换内核为5.8
1
sudo apt install linux-image-5.8.0-63-generic linux-headers-5.8.0-63-generic linux-hwe-5.8-headers-5.8.0-63 linux-modules-5.8.0-63-generic linux-modules-extra-5.8.0-63-generic
  • 安装好后重启后使用uname -a验证内核版本,为5.8即可成功;

  • 安装编译需要的组件

1
sudo apt-get install libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libssl-dev libdbus-1-dev git pkg-config build-essential macchanger net-tools python3-venv aircrack-ng rfkill firmware-ath9k-htc
  • clone并编译项目,并安装python库

    1
    2
    3
    4
    git clone https://github.com/vanhoefm/fragattacks.git fragattacks
    cd fragattacks/research
    ./build.sh
    pip install -r requirment.txt
  • 替换wifi网卡驱动为修改版

    1
    2
    3
    4
    5
    6
    sudo apt-get install bison flex linux-headers-$(uname -r)
    git clone https://github.com/vanhoefm/fragattacks-drivers58.git fragattacks-drivers58
    cd fragattacks-drivers58
    make defconfig-wifi
    make -j 4
    sudo make install
  • 安装ath9k-firmware

    1
    2
    3
    cd research/ath9k-firmware/
    ./install.sh
    sudo reboot

2.简易环境部署流程

​ 使用该方式部署能够满足漏洞检测需求,但可能受系统版本与wifi usb网卡型号影响,无法正常驱动USB网卡,需要单独安装驱动,需要部署时进行确认,但相对完整部署,难度较低;

  • 安装编译需要的组件
1
sudo apt-get install libnl-3-dev libnl-genl-3-dev libnl-route-3-dev libssl-dev libdbus-1-dev git pkg-config build-essential macchanger net-tools python3-venv aircrack-ng rfkill firmware-ath9k-htc
  • clone并编译项目,并安装python库

    1
    2
    3
    4
    git clone https://github.com/vanhoefm/fragattacks.git fragattacks
    cd fragattacks/research
    ./build.sh
    pip install -r requirment.txt
  • 安装ath9k-firmware

    1
    2
    3
    cd research/ath9k-firmware/
    ./install.sh
    sudo reboot

3.使用与验证标准

使用该工具时需要接入WiFi网卡,并获得wifi网卡接口名字,可以使用ifconfig查看,如下例,wifi网卡接口名称为:wlx10634b1dff26

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
➜  research git:(master) ifconfig

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 400628 bytes 232337699 (232.3 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 400628 bytes 232337699 (232.3 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlx10634b1dff26: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 10:63:4b:1d:ff:26 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

​ 进入search目录,执行相关命令,此处有两种运行方式,一种是作为AP测试终端设备,另一种时作为终端设备测试WIFI热点,使用前需要使用root用户执行,并加载python 虚拟环境;

  • 作为热点测试客户端

    1
    sudo ./fragattacks.py <wifi网卡接口名称> --ap <command>

    此处例如 wifi网卡接口名称为:wlx10634b1dff26;

    对于此处演示,command 使用 ping,用于检测环境搭建是否成功,具体检测对应CVE漏洞请参考第四章节:CVE与command对照表;

    具体例如:

    1
    sudo ./fragattacks.py wlx10634b1dff26 --ap ping

​ 运行该命令后,若出现以下字符AP-ENABLED 及证明wifi测试热点已经建立,可以使用待测终端进行接入

1
2
3
4
5
6
7
8
skygo@ubuntu:~/workspace/fragattacks/research$ sudo ./fragattack.py wlx10634b1dff26 --ap ping
[18:32:22] This is FragAttack version 1.3.
[18:32:22] You are not running patched drivers, meaning this tool may give incorrect results!
[18:32:22] To ignore this warning and timeout add the parameter --no-drivercheck
[18:32:28] Using interface monwlx10634b1df (mt76x2u) to inject frames.
[18:32:28] Starting hostapd using: ../hostapd/hostapd -i wlx10634b1dff26 hostapd.conf -K
wlx10634b1dff26: interface state UNINITIALIZED->ENABLED
wlx10634b1dff26: AP-ENABLED

​ 测试热点名称为 testnetwork,密码为:abcdefgh,使用待测终端去连接即可;

​ 若出现:TEST COMPLETED SUCCESSFULLY及证明设备存在漏洞;

​ 若出现:Test timed out! Retry to be sure, or manually check result及证明不存在漏洞

​ 若上述两种情况都不存在,则表明测试失败,可以尝试重试;

  • 作为客户端测试热点
1
sudo ./fragattacks.py <wifi网卡接口名称>  <command>

此处例如 wifi网卡接口名称为:wlx10634b1dff26;

对于仅检测漏洞,command 使用 ping即可;

具体例如:

1
sudo ./fragattacks.py wlx10634b1dff26  ping

​ 运行该命令后,程序会去加载以当前路径client.conf配置文件中的WiFi热点账户密码数据,去连接改热点,配置格式如下(以testnetwork热点,密码abcdefgh为例)

1
2
3
4
5
sae_pwe=2
network={
ssid="testnetwork"
psk="abcdefgh"
}

​ 若出现:TEST COMPLETED SUCCESSFULLY及证明设备存在漏洞;

​ 若出现:Test timed out! Retry to be sure, or manually check result及证明不存在漏洞

​ 若上述两种情况都不存在,则表明测试失败,可以尝试重试;

4.CVE与command对照表

ID CVE command 备注
1 CVE-2020-24588 amsdu-inject A-MSDU攻击测试
2 CVE-2020-24587 ping I,F,BE,AE –pn-per-qos 混合密码攻击测试,测试AP不稳定,建议测试客户端
3 CVE-2020-24586 ping I,E,R,AE –full-recon 缓存攻击测试
4 CVE-2020-26146 ping I,E,E –inc-pn 2 非连续PN攻击
5 CVE-2020-26147 ping I,E,P 混合明文/加密攻击
6 CVE-2022-26140 ping I,P 混合明文/加密攻击
7 CVE-2020-26143 ping I,P,P 混合明文/加密攻击
8 CVE-2020-26145 ping I,D,P –bcast-ra 广播碎片攻击测试,主要测试客户端
9 CVE-2020-26144 eapol-amsdu I,P A-MSDU EAPOL攻击测试