Air Crack
Air Crack
To use aircrack-ng you’ll need a wireless network adapter that has monitor mode and packet
injection capabilities. Feel free to do some research about your particular card and it’s
compatibility. There’s a good guide on the aircrack-ng site that can help you with research. You
can also do what I did and buy a cheap USB wireless adapter with these capabilities. I have
the Panda Wireless N600 and it works perfectly fine on my Macbook Pro.
Installation
If you’re not on Kali Linux, aircrack-ng is most likely available through your preferred
package manager. For Windows users, refer to the official aircrack-ng site to download the suite.
To set the network adapter to monitor mode, first find the name of the interface as your system
detects it. You can see this using ifconfig. In my case, the interface name of my USB wireless
adapter is wlan0. I can set it to monitor mode using the following commands:
$ ifconfig wlan0 up
Now, we need to check that no processes interfere with the airmon-ng tool, which is part of
the aircrack-ng suite. To do this, run:
a short period of time, you may want to run 'airmon-ng check kill'
PID Name
1229 NetworkManager
1329 wpa_supplicant
3383 dhclient
We’ll need to kill all those processes to prevent any issues. Simply issue kill commands for
each process ID. Run airmon-ng check once again to be sure that all is well. We are now ready
to scan for access points.
$ airodump-ng wlan0
51:EF:63:2E:47:72 -55 0 0 0 3 -1
<length: 0>
You’ll see a list of access points and devices associated with each access point. You’ll notice
there are acronyms above each column. Here’s a list of the ones we care about and what they
mean:
Now lets select an access point and run a scan on only that particular device. We’ll capture
traffic and save it to a file. You’ll need to make note of the BSSID and channel of the access
point. In my case, my router’s ESSID is “Lower The Rent”. We’ll scan it using the following
command formula:
You’ll be able to see the access point and associated devices. This provides a much cleaner look
instead of your terminal screen being full of information. We can see that there is a single device
associated with the access point.
While leaving the previous airodump-ng command running in a separate tab or window, open
another tab to run the deauthentication command. The command is as follows:
The BSSID we specify is that of the access point. It is possible to limit the amount of
deauthentication frames to send, but in this case we are sending an infinite amount specified
with -0 0.
The output for the aireplay-ng command will look like this:
Your terminal screen will continue to fill with these messages. Keep the command running until
you see a WPA handshake: XX:XX:XX:XX:XX:XX message on the upper right of the first window
running the airodump-ng command. That window will look as follows (notice the message on
the upper right):
If you see the message, you have successfully captured the handshake. The last step left to do
now is to crack this handshake and reveal the password in plaintext.
First, we’ll go over the approach using a wordlist. The command to begin cracking using a
wordlist is as follows:
In my case, I used a short wordlist of 4800 passwords to try and crack the handshake. I was not
able to find the key, but this is what the output will look like:
Aircrack-ng 1.5.2
[00:00:00] 4800/4799 keys tested (5047.82 k/s)
Master Key : 8B BB 3C 7A 08 50 43 73 73 BC 27 A0 A0 20 C2 C4
F8 82 0E 55 32 29 28 4C 93 CD 4D C0 3E E3 9C 4C
Transient Key : DE 14 79 DB 14 3B ED 7A 0D 80 FC DA 67 77 5C 09
C7 95 27 0C AC 2A 3B 2B 08 5F B5 22 B5 F6 F7 0F
C5 50 68 68 85 00 1E 80 33 1B F8 D9 FE E2 5B F4
71 EE D0 87 E4 57 ED 21 2D 66 CC 0B A7 A7 0D 1D
EAPOL HMAC : 35 D8 56 95 03 0B DF 6B 48 C4 DE 21 DB 01 7F E7
The tool will go through every password in the wordlist and try to crack the acess point’s
password. Wordlists are convenient and can be fast, but if the password is not in the wordlist
itself, we’ll need to try bruteforcing.
There are likely several tools out there that can generate password combinations, but I
used crunch. The formula to feed passwords generated by crunch into aircrack-ng is as
follows (notice we need to specify the ESSID this time):
I already know the length of the passowrd to my own router. My full command looks like this:
This will be very slow, as the program will attempt every 14-character letter and number
combination possible.
In my case, my router has the default password of pinkcoconut165. With this knowledge, I can
specify further. Instead of attempting a random mix of letters and numbers, I can test for a
specific arrangement of letters/numbers. Obviously, this would not be known if we were
attacking a completely unknown access point, but I want to demonstrate what a successful crack
looks like. Using the -t option we can specify a pattern. Here’s the description from
the man page:
-t @,%^
Specifies a pattern, eg: @@god@@@@ where the only the @'s, ,'s, %'s,
and ^'s will change.
This will still take long, however, due to the length of the password. Let’s cheat a little bit just to
show the success screen. Here’s the new command where we will type in the letters of the
password and only try to guess the remaining digits:
Aircrack-ng 1.5.2
6A 02 A6 A3 82 E8 19 D8 34 12 E2 62 A6 79 8B C7
Transient Key : C1 FA BC A8 1E 15 B9 3F 7C 59 AA 00 8D 6F 9A C1
F8 D6 F2 A1 BB 8A 0F 71 05 D1 C0 89 88 34 04 CC
5A 10 EF FF 77 08 13 EF CA 8B 10 53 31 5E 65 20
A9 A8 25 7A 37 AA A8 A4 BD 67 6F E4 F9 36 14 C4
EAPOL HMAC : 92 FB C9 F7 B9 1B 60 B1 82 9B 90 BA 03 EF E4 83
Additional Tips
If you want to stay as anonymous as possible, you can change your MAC Address before
attempting any of this. You can easily do this using a tool like macchanger. The following
command will assign a randomized MAC address to the wlan0 interface:
$ macchanger -r wlan0
We can be more clever and use a MAC address from a known company. The first 3 bytes of a
MAC address are known as the Organizationally Unique Identifier (OUI) and can identify the
manufacturer. For example, some of Dell’s devices have the first 3 bytes as F8:DB:88. The last 3
bytes can be anything, as long as it is within the range of A-F and 0-9 (hexadecimal values).
On MacOS you can change the MAC address of an interface to one of your choosing with the
following command:
Using this knowledge of MAC Addresses, we can also determine the manufacturers of the access
points we scan. We can look up the MAC addresses, figure out the manufacturer, and see if there
are other vulnerabilities with specific device models. Maybe we’ll discover their formula for
default passwords (which lots of people never change) to be, say, a combination of 5 letters and
5 numbers, which can help us crack the password. Any hint helps. Additionally, default ESSID
names, such as “NETGEAR23-2G”, could mean that the user never changed the default
password either ;).
Password Lists
Password lists are often used in password cracking to speed up the process. Instead of trying
every possible combination of characters, we can try our luck using leaked passwords from one
of these lists. A good place to find passwords lists and more is the SecLists GitHub repo. To start
off, I suggest trying one of the “Common Credentials” lists.
Password lists can be used along with the crunch tool we used earlier. crunch has much more
functionality that I did not dive into. I encourage you to read through the man pages and learn
more about it. It’s versatile but still easy to pick up.
Conclusions
In this post I covered how to use aircrack-ng to scan for nearby access points, capture the 4-
way handshake by sending spoofed deauthentication packets, and crack the hash using crunch.
Once again, only try this on devices you own!
Scanning for wifi networks and acquiring handshakes is not too difficult. Anyone with some
command line experience can achieve this. The hardest part will be cracking the password itself
due to processing power required.
This is an example of why long passwords are important. It is not enough to add symbols to a
short password. In fact, it is better to get into the habit of creating pass-phrases as opposed to
pass-words. A combination of words with lowercase and capital letters in addition so symbols
will be more secure than a single word with symbols. In other words, !
ThisIsALongPassword123? is much harder to crack than Password123?
There are other tools that we could have used to crack the password, such as hashcat. If I’m not
mistaken, hashcat can take advantage of a GPU which will allow you to crack passwords much
faster. However, I wanted to focus on the tools that come with the aircrack-ng suite.
Where:
Enabling monitor
First of all, set shut down the interface by doing; ip set link
wlan0 down
And FINALLY, we are going to use the first program from
the Aircrack-ng suite, the airodump-ng
You can also shut down the monitor interface using the stop
command, just like this:
We just finished our setup, we have the WiFi card ready for
start sniffing
So, by using:
airodump-ng wlan0mon
The program will start sniffing and will display a network
listing table and connected devices with the following
information:
BSSID -> MAC address for the access point (Network device)
PWR -> Power (the distance of the access point vs the Wifi Card)
The closer the network - the fastest is the attack
BEACON -> heartbeat kind of packet -
#DATA -> useful packets sniffed
#/s -> number of packets collected en 10 segs
CH -> broadcast channel (no interference)
MB -> Speed
ENC -> Encryption
CIPHER -> Decrypt packages (CCMP, TKIP)
AUTH -> Auth type
This will display all the networks and all the peripherals
connected to the networks filtered by their MAC Address.
But we can filter it in a certain way by targeting the sniffer to
one or many specific networks
Targeted Sniffing
davidfile.txt wlan0mon
This will segment the network into the specified with the
MAC Address. Also will create and write a file with the —
write command using the Monitor mode Interface. For this
scan, I use the output .txt file extension, but in case you
don’t specify it, the program will show a bunch of files with
some not so familiar extensions like .cap or .netxml
We can analyze this data using Wireshark, take fact that the
collected data will not be much of use if the target network
uses encryption
DeAuthentication Attacks
It’s easy.
To this point
Once we got the Key, the sniffing process should stop and
we will have an Encrypted WEP Key for authenticating in
the target network.
wlan0mon
Where:
This method will wait for an ARP packet, will capture it and
inject it into the traffic
Where:
2. -b = target BSSID
Fragmentation Attack
WPA Cracking
For this, we are going to use a tool called “ reaver”, this tool
can recover the WPA/WPA2 key from the pin.
wash -i wlan0mon
Resulting:
BSSID - Mac Address
Channel - Wifi channel
WPS version - 1.0
RSSI - distance
WPS Locked - No => Sometimes can be locked - if yes - you can't do
this attack
ESSID - [network name]
And then, we can use reaver like this:
Damn …
Again, for cracking WPA/WPA2 we need to capture the
handshake and after brute force it through a Word List or
a text dictionary
PRO TIP: While you are doing this, pay attention to the right
corner message, this packet should say: WPA Handshake or
something like this [WPA Handshake:
00:10:18:90:2D:EE]
./crunch [min][max][characters=lower|upper|numbers|smbols] -t
I’m pretty sure there are more common attacks for this
vulnerable encryption with more sophisticated ways of
performing it. Let’s keep this Gist updated.
Happy coding.
2
Sign up for Top Stories
By Level Up Coding
A monthly summary of the best stories shared in Level Up Coding Take a look.
By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more
information about our privacy practices.
Coding tutorials and news. The developer homepage gitconnected.com && skilled.dev &&
levelup.dev
Read more from Level Up Coding
Golda Ellynn
Olimpia Ruberta
Kate Belson
GSoC with OpenMRS — Week 9 Update
Aariya Rathi
John P. Gormally, SR
Jeff Cunningham
The first thing that we need to have to successfully attack, audit a network is
a Wi-Fi adapter that has monitor mode and allows packet injection. The
reason we have to use an external adapter is that the inbuilt adapter that
comes along with the PC doesn’t support monitor mode and packet
injection. Monitor mode allows the adapter to view and monitor all the
traffic received from the wireless network. This mode enables packets to be
captured without having to connect or link with an access point.
Cracking WEP
WEP(Wired Equivalent Privacy) is a Wi-Fi security protocol, its intention was
to provide data confidentiality comparable to that of a traditional wired
network. The flaw that we are targeting is Initialisation Vectors(IV), these
IVs are 24 bits long. For encryption, Wired Equivalent Privacy (WEP) can use
only a 64-bit or 128-bit number, which is made up of a 24-bit Initialization
Vector (IV) and a 40-bit or 104-bit default key. The use of short keys reduces
the encryption strength because short keys are easy to break, Also it uses an
algorithm called RC4 that is deprecated. The Wired Equivalent Privacy (WEP)
also creates a detectable pattern for attackers.
The catch here is that the IVs are repeated in a busy network. And this is the
vulnerability we are going to use, Repeated IVs can be used to determine the
keystream, and ultimately break the encryption.
To have aircrack-ng conduct a WEP key attack on a capture file, pass it the
filename, either in .ivs or .cap/.pcap format.
aircrack-ng filename.pcap
Cracking WPA/WPA2
Wi-Fi Protected Access2- Pre Shared Key is a method of securing one’s
network using the option of Pre-Shared key authentication. This kind of
mechanism is generally designed for a home environment and not for an
enterprise network. The network in this case is encrypted using a plaintext
passphrase between 8-63 characters. The passphrase along with the network
SSID is used to generate unique encryption keys for each client. Which are
constantly changed, thus it is near impossible that the keys are repeated and
we can get hold of it. Hacking into a network using WPA/WPA2 protocol is
difficult due to the complex algorithm it uses.
WPS method
WPS is a feature that can be used with WPA & WPA2. This allows clients to
connect to the network without a password. The authentication is done using
an 8 digit pin. This is a vulnerability that exists in routers that ship with this
feature enabled by default. Many routers have a specific button dedicated to
WPS service. Although this feature can be made redundant by disabling the
WPS service using the Configure Router page, unfortunately, most people
don’t care about disabling it.
Generally, WPS forces devices to use an 8-digit numerical PIN system that
bypasses the passphrase. As 8 digits pins are comparatively smaller, all the
possible combinations can be tried in a shorter time period. This PIN is
always checked in groups of two 4-digit codes, and the connecting device is
informed whether the four-digit section is correct.
Wordlist method
Unlike in the case of WEP, the WPA/WPA2 packet contains no useful data.
The only packet that contains data of our interest is the handshake packet.
These are 4 packets that are sent to the client to connect to the network.
The handshake doesn’t any data that helps to retrieve the key. Rather it
helps to verify whether a key is valid or not.
packet here.
Finally, we use the handshake to verify our key. We create a wordlist and/or
download some popular ones from the internet like the rockyou.txt. This
method is known as the Dictionary Bruteforce attack. If the wordlist contains
the password, it outputs the password.
Requirements
Autoconf
Automake
Libtool
shtool
OpenSSL development package or libgcrypt development package.
pkg-config
Linux
Airmon-ng requires ethtool and rfkill
If USB bus is present, lsusb
If PCI/PCIe bus is present, lspci
LibNetlink 1 (libnl-dev) or 3 (libnl-3-dev and libnl-genl-3-dev) development packages. It can be
disabled by passing –disable-libnl to configure.
Kernel headers and gcc as well as make have to be installed on your system (build-essential on
Debian based distributions)
make and Standard C++ Library development package (Debian: libstdc++-dev)
Windows (Cygwin)
w32api is required
if using clang, libiconv and libiconv-devel
make and Standard C++ Library development package
MacOS
Install the following via Homebrew (brew):
autoconf
automake
libtool
openssl
shtool
pkg-config
hwloc
pcre
sqlite3
libpcap
cmocka (optional)
FreeBSD, OpenBSD, NetBSD, Solaris
Install the following via pkg:
gmake
pkgconf
pcre
sqlite3
gcc9 (or better)
Optional stuff
If you want SSID filtering with regular expression in airodump-ng (-essid-regex) pcre
development package is required.
If you want to use airolib-ng and '-r' option in aircrack-ng, SQLite development package >=
3.3.17 (3.6.X version or better is recommended)
If you want to use Airpcap, the 'developer' directory from the CD is required. It can be
downloaded here.
For best performance on FreeBSD (50-70% more), install gcc5 via: pkg install gcc5 Then
compile with: gmake CC=gcc5 CXX=g++5
rfkill
CMocka
hwloc: strongly recommended, especially on high core count systems where it may give a
serious performance boost
Compiling and installing
Notes:
wget https://download.aircrack-ng.org/aircrack-ng-1.7.tar.gz
cd aircrack-ng-1.7
autoreconf -i
./configure --with-experimental
make
make install
ldconfig
Compiling with AirPcap support (cygwin only)
1. Copy 'developer' directory from the AirPcap CD at the same level as 'Aircrack-ng' directory
2. Append '- -with-airpcap=../developer' parameter to configure:
Compiling on *BSD
Commands are exactly the same as Linux but instead of make, use gmake (with CC=gcc5 CXX=g+
+5 or any more recent gcc version installed).
Compiling on MacOS
Commands are exactly the same as Linux
cd aircrack-ng
autoreconf -i
./configure --with-experimental
make
make install
ldconfig
./configure flags
When configuring, the following flags can be used and combined to adjust the suite to your
choosing:
with-airpcap=DIR: needed for supporting airpcap devices on windows (cygwin or msys2 only)
Replace DIR above with the absolute location to the root of the extracted source code from the
Airpcap CD or downloaded SDK available online. Required on Windows to build besside-ng,
besside-ng-crawler, easside-ng, tkiptun-ng and wesside-ng when building experimental tools.
The developer pack (Compatible with version 4.1.1 and 4.1.3) can be downloaded
at https://support.riverbed.com/content/support/software/steelcentral-npm/airpcap.html
with-experimental: needed to compile tkiptun-ng, easside-ng, buddy-ng, buddy-ng-crawler,
airventriloquist and wesside-ng. libpcap development package is also required to compile most
of the tools. If not present, not all experimental tools will be built. On Cygwin, libpcap is not
present and the Airpcap SDK replaces it. See –with-airpcap option above. On debian based
distro, install libpcap-dev
with-ext-scripts: needed to build airoscript-ng, versuck-ng, airgraph-ng and airdrop-ng. Note:
Each script has its own dependencies. Note: It's only required in install phase.
with-gcrypt: Use libgcrypt crypto library instead of the default OpenSSL. And also use internal
fast sha1 implementation (borrowed from GIT) Dependency (Debian): libgcrypt20-dev
with-duma: Compile with DUMA support. DUMA is a library to detect buffer overruns and under-
runs. Dependencies (debian): duma
with-xcode: Set this flag to true to compile on OS X with Xcode 7+.
disable-libnl: Set-up the project to be compiled without libnl (1 or 3). Linux option only.
without-opt: Do not enable stack protector (on GCC 4.9 and above).
enable-shared: Make OSdep a shared library.
disable-shared: When combined with enable-static, it will statically compile Aircrack-ng.
with-avx512: On x86, add support for AVX512 instructions in aircrack-ng. Only use it when the
current CPU supports AVX512.
with-static-simd=: Compile a single optimization in aircrack-ng binary. Useful when compiling
statically and/or for space-constrained devices. Valid SIMD options: x86-sse2, x86-avx, x86-
avx2, x86-avx512, ppc-altivec, ppc-power8, arm-neon, arm-asimd. Must be used with –enable-
static –disable-shared. When using those 2 options, the default is to compile the generic
optimization in the binary. –with-static-simd merely allows to choose another one.
enable-maintainer-mode: It is important to enable this flag when developing with Aircrack-ng.
This flag enables additional compile warnings and safety features.
Troubleshooting Tips
error while loading shared libraries: libaircrack-ng.so.0
Run ldconfig as root or with “sudo” to solve the issue.
Normally, the Aircrack-ng suite programs and man pages are placed in:
/usr/local/bin
/usr/local/sbin
/usr/local/man
On your system, to determine which directories have the Aircrack-ng programs enter the following. If
using “locate” be sure to first run “updatedb”.
locate aircrack-ng
locate airmon-ng
or
Once you know the directories (exclude the source directories) then determine which directories are
in your PATH. To see which directories are included in PATH on your particular system enter:
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
At this point compare the actual locations with the directories in your PATH. If the directories are
missing from your PATH then you have a few options:
Add the directories to your PATH. See the one or more of the following web sites for details of
how to do this:
https://www.cyberciti.biz/faq/howto-print-path-variable/
http://www.troubleshooters.com/linux/prepostpath.htm
Change to the particular directory with “cd” and then run the commands from within the directory.
Don't forget to add “./” in front of each command.
Specify the full path for each command. So if Aircrack-ng is located in the “/usr/local/bin”
directory then run the command as “/usr/local/bin/aircrack-ng”.
Installing pre-compiled binaries
Linux/BSD/OSX
With the exception of Linux penetration testing distributions, packages are usually out of date
(MacOS is the exception). In this case, uninstalling the package and installing from sources is the
recommended way to go.
We offer packages (statically compiled binaries) for any distribution that supports .deb or .rpm
packages thanks to PackageCloud.io so you can use your distro's package manager to install and
keep Aircrack-ng up to date:
Debian
Ubuntu
Mint
SLES
OpenSuse
Fedora
RHEL
CentOS
Amazon Linux
Elementary OS
While most folks want to use our “release” packages, “git” packages are available too for those who
decide to use bleeding edge.
On MacOS, install it is via Macports or brew. Simply do “brew install aircrack-ng” or “sudo ports
install aircrack-ng”
Windows
The Windows version of the Aircrack-ng suite does not have an install program. You must manually
install (unzipping archive) the software.
Download the latest version of the Aircrack-ng suite for Windows to your computer. The link for
the zip file can be found on the Wiki home page.
Unzip the contents of the Aircrack-ng zip file into “C:\”. This will create a directory called
“aircrack-ng-1.6-win”. This directory name will vary based on the exact version that you
downloaded. This main directory contains three subdirectories - “bin”, “src” and “test”.
Prior to using the software, make sure to install the drivers for your particular wireless card. See
this link for the instructions. We currently only support Airpcap; other adapters may be supported but
require development of your own DLL so the different tools can interact with it.
To now use the Aircrack-ng suite, start Windows Explorer and double click on Aircrack-
ng GUI.exe inside “bin” subdirectory. The GUI requires .NET version 4.6.1 to run.
Alternatively, open a command prompt (Start menu → Execute → cmd.exe) and change to the “C:\
aircrack-ng-1.6-win\bin” directory and execute the individual commands.
Important notes: