Cracking WPA
Aus Wardriving-Forum.de Enzyklopädie
Inhaltsverzeichnis |
[Bearbeiten] Tutorial: Wie knackt man WPA/WPA2
Version: 1.15.1 9. Mai 2008\\ Von: darkAudax
[Bearbeiten] Einleitung
Dieses Tutorial erklärt wie man ein WPA/WPA2 Netz mit Pre-Shared Key entschlüsseln kann. Damit du besser verstehst was du machst empfehle ich dir dich ein bisschen über WPA/WPA2 zu informieren.
Die [[1]] links page hat eine WPA/WPA2 section. Die beste Erklärung für WPA findest du hier:[Security - WEP, WPA and WPA2]. Dies ist der [[2]] um das PDF direkt zu downloaden. The WPA Packet Capture Explained tutorial is a companion to this tutorial.
WPA/WPA2 unterstützt viele Authentifizierungarten. Aircrack-ng kann NUR Pre-Shared Keys entschlüsseln. Also überzeug dich mit airodump-ng ob das Netzwerk Pre-Shared Keys benutzt. Ein weiterer wichtiger Untschied zwischen WPA/WPA2 und WEP ist die Herrangehensweise.
Bei WEP kann durch eine statische Berechung der Key ermittelt werden. Bei WPA/WPA2 wird der Key durch Brute Force ermittelt.
Deshalb bechleunigt es die WPA/WPA2 Entschlüsselung nicht, wenn man IVs sammelt, wie bei der WEP Methode, da der verwendete Schlüssel nicht statisch ist. Das einzige was einem die Information zum Starten einer WPA/WPA2 Attacke ermöglicht, ist der sog. "handshake" zwischen einem Client und dem AP. Ein "handshake" geschieht, wenn sich ein Client mit dem AP verbindet.
Obwohl es nicht absolut richtig ist, nehmen wir für unser tutorial an, dess es so ist, denn seit der "pre-shared key" eine Länge zwischen 8 bis zu 63 Zeichen haben kann, ist es effektiv unmöglich geworden Ihn zu knacken.
Die einzige Möglichkeit den "pre-shared key" zu knacken hat man, wenn der key aus einem einfachen Wort besteht oder er nur relativ wenige Zeichen hat. Umgekehrt, wenn du ein unknackbares kabelloses Netzwerk zu Hause haben möchtest, verwende WPA/WPA2 verschlüsselung und ein 63 Zeichen langes Passwort, das aus zufälligen Zeichen und Spezialsymbolen besteht.
Die Wahrscheinlichkeit mit einer "bruteforce"-Attacke Erfolg zu haben ist sehr gering, da Sie sehr hohe Rechenleistung erfordert. Ein Computer kann grade mal 50 bis 300 mögliche "keys" pro Sekunde testen, je nach CPU. Es kann Stunden, wenn nicht Tage dauern, sich durch ein großes Passwort-File zu arbeiten. Wenn du darüber nachdenkst, ein eigenes Passwort-File zu erstellen, das dann alle Kombinationen aus Zahlen, Zeichen und Spezialsymbolen beinhaltet, guck zuerst einmal hier [force zeit rechner]. Du wirst sehr überrascht sein, wieviel Zeit man braucht.
Grundsätzlich gibt es beim Knacken keine Unterschiede zwischen WPA und WPA2 Netzwerken. Die Authentifizierungsmethode ist generell die Selbe. Also sind auch die Techniken, die du Anwenden musst, identisch.
Es ist erforderlich, dass du dich mit deinem WLAN auseinandersetzt, um so die Technik, die dahinter steckt zu verstehen. Solltest du keinen eigenen AP besitzen, frage vorher den Eigentümer um Erlaubnis!
I would like to acknowledge and thank the [team] for producing such a great robust tool.
Ich würde mich über Feedback, Kritik, Lob, usw. sehr freuen!
[Bearbeiten] Voraussetzung
Die folgenden Voraussetzungen müssen gegeben sein:
* Die Karte muss Injektion unterstützen. Kontrolliere das mit dem Injektion Test. * Du musst nahe genug am Access Point und dem Client sein um senden und empfangen können * Du benutzt Aircrack v0.9.1 oder höher. Bei andern Version können die Befehle unterschiedlich sein.
Wenn diese Vorrausetzungen nicht gegeben sind wird das Tutorial nicht funktionieren.
[Bearbeiten] Benutze Hardware
Folgende Hardware wird in dem Tutorial benutzt.
*MAC Adresse des PC auf dem die Aircrack-ng Suite läuft: 00:0F:B5:88:AC:82 *MAC Adresse des Clients: 00:0F:B5:FD:FB:C2 *BSSID (MAC Adresse des Access Point): 00:14:6C:7E:40:80 *ESSID (Wireless network name): teddy *Access Point Kanal: 9 *W-Lan Karte: ath0
Dies sind nur Beispiel Daten. Die Daten musst du für dein Netzwerk natürlich anpassen. Wichtig: Der Name der Karte muss angepasst werden also statt „ath0“ zum Beispiel „rausb0“. Wie der Name deiner Karte ist kannst du mit „iwconfig“ nach schauen.
[Bearbeiten] Solution
[Bearbeiten] Vorgehensweise Übersicht
Ziel ist es den WPA/WPA2 Authentifizierung Handshake zu sniffen und dann mit Aircrack-ng zu entschlüsseln. Dies kann „Aktiv“ oder „Passiv“ passieren. Bei der aktiven Vorgehensweise wird der Client mit gefälschten Paketen abgemeldet(deauthenticated) und man kann den Handshake mit sniffen. Bei der passiven Vorgehensweise wartet man einfach bis sich ein Client anmeldet.
Hier sind die Schritte in der Übersicht:
- Starten des Monitor Mode auf dem Kanal des APs - Starten von Airodump-ng mit einem Filter für den Handshake - Mit Aireplay-ng den Client Deauthenfizieren - Mit Aircrack-ng den Handshake entschlüsseln
[Bearbeiten] Step 1 – Die W-Lan Karte in den Monitor Mode versetzen
Als erstes wird die Karte in den Monitor Mode versetzt. Im Monitor Mode „hört“ die Karte alle Pakete die in der Luft gesendet werden. Im Manage Mode in dem die Karte für gewöhnlich ist „hört“ die Karte nur die Pakete die an sie adressiert ist.
Als erstes wird die Karte gestoppt:
airmon-ng stop ath0
Das Sytem gibt das wieder:
Interface Chipset Driver wifi0 Atheros madwifi-ng ath0 Atheros madwifi-ng VAP (parent: wifi0) (VAP destroyed)
Dann wird mit „iwconfig“ überprüft ob alle athX aus sind. Wenn das der Fall ist sollte es so aussehen:
lo no wireless extensions. eth0 no wireless extensions. wifi0 no wireless extensions.
Wenn weiter athX Device vorhanden sind sollten die auch ausgeschaltet werden.
Danach wird die Karte in den Monitor Mode auf Kanal 9 gestartet:
airmon-ng start wifi0 9
Note: In diesem Kommando wird "wifi0" statt "ath0" benutzt, weil der Madwifi-ng Treiber so die Karte erzeugt . Das sollte dann so aussehen:
Interface Chipset Driver wifi0 Atheros madwifi-ng ath0 Atheros madwifi-ng VAP (parent: wifi0) (monitor mode enabled)
Jetzt sollte mit „iwconfig“ überprüft werden das alles funktioniert.
Das sollte dann so aussehen:
lo no wireless extensions.
wifi0 no wireless extensions.
eth0 no wireless extensions.
ath0 IEEE 802.11g ESSID:"" Nickname:""
Mode:Monitor Frequency:2.452 GHz Access Point: 00:0F:B5:88:AC:82
Bit Rate:0 kb/s Tx-Power:18 dBm Sensitivity=0/3
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=0/94 Signal level=-95 dBm Noise level=-95 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
In der oberen Antwort kann man sehen, dass ath0 im monitor mode, auf der frequenz 2.452GHz, welche channel 9 ist. "Access Point" zeigt die MAC Addresse deiner WLAN-Karte. Nur die madwifi-ng Treiber zeigen die MAC Addresse der Karte im AP Feld, andere Treiber werden das nicht tuen. Also ist alles ok. Es ist wichtig, alle diese Informationen zu überprüfen, ansonsten werden die folgenden Schritte nicht richtig funktionieren. Um die frequenz der channel zu überprüfen, siehe hier: http://www.rflinx.com/help/calculations/#2.4ghz_wifi_channels . Wähle nun den "Channel Selection and Channel Overlap" tab. Dort werden die Frequenzen mit entsprechenden channels gezeigt.
[Bearbeiten] Step 2 - Starten von airodump-ng um authentication handshakes zu sammeln
Mit airodump-ng wird nun versucht den 4-way authentication handshake zu sniffen. Eingabe:
airodump-ng -c 9 --bssid 00:14:6C:7E:40:80 -w psk ath0
Begriffserklärung:
*-c 9 ist der Kanal auf dem der AP läuft (um einen WPA-handshake abfangen zu können, sollte immer ein channel definiert sein) *-'-bssid 00:14:6C:7E:40:80 ist die MAC Adresse des AP, damit mit nicht unnötiger Traffic gespeichert wird.. *-w psk ist der Name der Datei in der die Pakete gespeichert wird. *ath0 ist der Name der Karte.
_WICHTIG_: Benutze NICHT die"-'-ivs" option. Es müssen alle Pakete gespeichert werden. Unten ein Screenshot von airodump-ng, wenn ein 4-Way Handshake erfolgreich abgefangen wurde.
CH 9 ][ Elapsed: 4 s ][ 2007-03-24 16:58 ][ WPA handshake: 00:14:6C:7E:40:80
BSSID PWR RXQ Beacons #Data, #/s CH MB ENC CIPHER AUTH ESSID
00:14:6C:7E:40:80 39 100 51 116 14 9 54 WPA2 CCMP PSK teddy
BSSID STATION PWR Lost Packets Probes
00:14:6C:7E:40:80 00:0F:B5:FD:FB:C2 35 0 116
In dem Obrigen Screenshot ist rechts oben deutlich zu erkennen, dass hier von der MAC-adresse 00:14:6C:7E:40:80 ein WPA handshake aufgezeichnet wurde.
Im unteren Bild ist der selbe AP zu sehen, nur ohne WPA-handshake
CH 9 ][ Elapsed: 4 s ][ 2007-03-24 17:51
BSSID PWR RXQ Beacons #Data, #/s CH MB ENC CIPHER AUTH ESSID
00:14:6C:7E:40:80 39 100 51 0 0 9 54 WPA2 CCMP PSK teddy
BSSID STATION PWR Lost Packets Probes
[Bearbeiten] Fehlersuche
See the Troubleshooting Tips section below for ideas.
Es gibt zwei Wege, wie du feststellst, ob du ein Handshake-Paket mitgesnifft hast. Watch the airodump-ng screen for " WPA handshake: 00:14:6C:7E:40:80" in the top right-hand corner. This means a four-way handshake was successfully captured. See just above for an example screenshot.
use Wireshark and apply a filter of "eapol". This displays only eapol packets you are interested in. Thus you can see if capture contains 0,1,2,3 or 4 eapol packets.
[Bearbeiten] Step 3 - Use aireplay-ng to deauthenticate the wireless client
This step is optional. You only perform this step if you opted to actively speed up the process. The other constraint is that there must be a wireless client currently associated with the AP. If there is no wireless client currently associated with the AP, then move onto the next step and be patient. Needless to say, if a wireless client shows up later, you can backtrack and perform this step.
What this step does is send a message to the wireless client saying that that it is no longer associated with the AP. The wireless client will then hopefully reauthenticate with the AP. The reauthentication is what generates the 4-way authentication handshake we are interested in collecting. This what we use to break the WPA/WPA2 pre-shared key.
Based on the output of airodump-ng in the previous step, you determine a client which is currently connected. You need the MAC address for the following. Open another console session and enter:
aireplay-ng -0 1 -a 00:14:6C:7E:40:80 -c 00:0F:B5:FD:FB:C2 ath0
Where:
* -0 means deauthentication * 1 is the number of deauths to send (you can send multiple if you wish) * -a 00:14:6C:7E:40:80 is the MAC address of the access point * -c 00:0F:B5:FD:FB:C2 is the MAC address of the client you are deauthing *ath0 is the interface name
Here is what the output looks like:
11:09:28 Sending DeAuth to station -- STMAC: [00:0F:B5:34:30:30]
With luck this causes the client to reauthenticate and yield the 4-way handshake.
[Bearbeiten] Troubleshooting Tips
* The deauthentication packets are sent directly from your PC to the clients. So you must be physically close enough to the clients for your wireless card transmissions to reach them.
[Bearbeiten]
The purpose of this step is to actually crack the WPA/WPA2 pre-shared key. To do this, you need a dictionary of words as input. Basically, aircrack-ng takes each word and tests to see if this is in fact the pre-shared key.
There is a small dictionary that comes with aircrack-ng - "password.lst". This file can be found in the "test" directory of the aircrack-ng source code. The Wiki FAQ has an extensive list of dictionary sources. You can use [the Ripper] (JTR) to generate your own list and pipe them into aircrack-ng. Using JTR in conjunction with aircrack-ng is beyond the scope of this tutorial.
Open another console session and enter:
aircrack-ng -w password.lst -b 00:14:6C:7E:40:80 psk*.cap
Where:
*-w password.lst is the name of the dictionary file. Remember to specify the full path if the file is not located in the same directory. **.cap is name of group of files containing the captured packets. Notice in this case that we used the wildcard * to include multiple files.
Here is typical output when there are no handshakes found:
Opening psk-01.cap Opening psk-02.cap Opening psk-03.cap Opening psk-04.cap Read 1827 packets. No valid WPA handshakes found.
When this happens you either have to redo step 3 (deauthenticating the wireless client) or wait longer if you are using the passive approach. When using the passive approach, you have to wait until a wireless client authenticates to the AP.
Here is typical output when handshakes are found:
Opening psk-01.cap Opening psk-02.cap Opening psk-03.cap Opening psk-04.cap Read 1827 packets. # BSSID ESSID Encryption 1 00:14:6C:7E:40:80 teddy WPA (1 handshake) Choosing first network as target.
Now at this point, aircrack-ng will start attempting to crack the pre-shared key. Depending on the speed of your CPU and the size of the dictionary, this could take a long time, even days.
Here is what successfully cracking the pre-shared key looks like:
Aircrack-ng 0.8
[00:00:00] 2 keys tested (37.20 k/s)
KEY FOUND! [ 12345678 ]
Master Key : CD 69 0D 11 8E AC AA C5 C5 EC BB 59 85 7D 49 3E
B8 A6 13 C5 4A 72 82 38 ED C3 7E 2C 59 5E AB FD
Transcient Key : 06 F8 BB F3 B1 55 AE EE 1F 66 AE 51 1F F8 12 98
CE 8A 9D A0 FC ED A6 DE 70 84 BA 90 83 7E CD 40
FF 1D 41 E1 65 17 93 0E 64 32 BF 25 50 D5 4A 5E
2B 20 90 8C EA 32 15 A6 26 62 93 27 66 66 E0 71
EAPOL HMAC : 4E 27 D9 5B 00 91 53 57 88 9C 66 C8 B1 29 D1 CB
[Bearbeiten] Troubleshooting Tips
[Bearbeiten] I Cannot Capture the Four-way Handshake!
It can sometimes be tricky to capture the four-way handshake. Here are some troubleshooting tips to address this:
* Your monitor card must be in the same mode as the both the client and Access Point. So, for example, if your card was in "B" mode and the client/AP were using "G" mode, then you would not capture the handshake. This is especially important for new APs and clients which may be "turbo" mode and/or other new standards. Some drivers allow you to specify the mode. Also, iwconfig has an option "modulation" that can sometimes be used. Do "man iwconfig" to see the options for "modulation". For information, 1, 2, 5.5 and 11Mbit are 'b', 6, 9, 12, 18, 24, 36, 48, 54Mbit are 'g'. * Sometimes you also need to set the monitor-mode card to the same speed. IE auto, 1MB, 2MB, 11MB, 54MB, etc. * Be sure that your capture card is locked to the same channel as the AP. You can do this by specifying "-c <channel of AP>" when you start airodump-ng. * Be sure there are no connection managers running on your system. This can change channels and/or change mode without your knowledge. * You are physically close enough to receive both access point and wireless client packets. The wireless card strength is typically less then the AP strength. * Conversely, if you are too close then the received packets can be corrupted and discarded. So you cannot be too close. * Make sure to use the drivers specified on the wiki. Depending on the driver, some old versions do not capture all packets. * Ideally, connect and disconnect a wireless client normally to generate the handshake. * If you use the deauth technique, send the absolute minimum of packets to cause the client to reauthenticate. Normally this is a single deauth packet. Sending an excessive amount may cause the client to fail to reconnect and thus does not generate the four-way handshake. As well, use directed deauths, not broadcast. * Try stopping the radio on the client station then restarting it. * Make sure you are not running any other program/process that could interfere such as connection managers, Kismet, etc. * Review your captured data using the WPA Packet Capture Explained tutorial to see if you can identify the problem. Such as missing AP packets, missing client packets, etc.
Unfortunately, you sometimes need to experiment a bit to get your card to properly capture the four-way handshake. The point is, if you don't get it the first time, have patience and experiment a bit. It can be done!
Another approach is to use Wireshark to review and analyze your packet capture. This can sometimes give you clues as to what is wrong and thus some ideas on how to correct it. The WPA Packet Capture Explained tutorial is a companion to this tutorial and walks you through what a "normal" WPA connection looks like. As well, see the FAQ for detailed information on how to use Wireshark.
In an ideal world, you should use a wireless device dedicated to capturing the packets. This is because some drivers such as the RTL8187L driver do not capture packets the card itself sends. Also, always use the driver versions specified on the wiki. This is because some older versions of the drivers such as the RT73 driver did not capture client packets.
When using Wireshark, the filter "eapol" will quickly display only the EAPOL packets. Based on what EAPOL packets are actually in the capture, determine your correction plan. For example, if you are missing the client packets then try to determine why and how to collect client packets.
To dig deep into the packet analysis, you must start airodump-ng without a BSSID filter and specify the capture of the full packet, not just IVs. Needless to say, it must be locked to the AP channel. The reason for eliminating the BSSID filter is to ensure all packets including acknowledgements are capture. With a BSSID filter, certain packets are dropped from the capture.
Every packet sent by client or AP must be acknowledged. This is done with an "acknowledgement" packet which has a destination MAC of the device which sent the original packet. If you are trying to deauthenticate a client, one thing to check is that you receive the "ack" packet. This confirms the client received the deauth packet. Failure to receive the "ack" packet likely means that the client is out of transmission range. Thus failure.
When it comes to analyzing packet captures, it is impossible to provide detailed instructions. I have touched on some techniques and areas to look at. This is an area which requires effort to build your skills on both WPA/WPA2 plus how to use Wireshark.
[Bearbeiten] aircrack-ng says "0 handshakes"
Check the "I Cannot Capture the Four-way Handshake!" troubleshooting tip.
[Bearbeiten] aircrack-ng says "No valid WPA handshakes found"
Check the "I Cannot Capture the Four-way Handshake!" troubleshooting tip.