Linux Format

Kali Linux: Security testing

Mayank Sharma tests his network defences with this pen testing distro.

- Mayank Sharma is not working as a sysadmin – he’s too busy writing about how to set up and manage Linux for all kinds of tasks on many systems for LXF’s loyal readers.

Kali Linux is the Swiss Army knife for ethical hackers. The distro is loaded with tools for penetratio­n testing that you can use to compromise yourown network in order to identify the weak points of entry that can be exploited by crackers. The Kali Linux menu is arranged in the order in which a network is usually infiltrate­d. It begins with tools for infiltrati­on testing and moves on to vulnerabil­ity analysis, wireless attacks and exploitati­on. Kali Linux is available in multiple flavours and can be used as a Live distro or inside a virtual environmen­t. Here we’ll use some of the common tools in Kali Linux to expose the weak points in our network.

First let’s find out what devices are logged on to the network using netdiscove­r, which can be used for reconnaiss­ance on those Wi-Fi networks that aren’t using DHCP. Fire up a terminal inside Kali and type netdiscove­r -i wlan0 This sends out ARP requests over the network and then displays the results on the screen. The process is live, and as soon as new machines come on the network they’ll pop up on the screen. Once you have a list of hosts, press Ctrl+c to stop the scan. With a list of hosts and their MAC addresses, you can begin the process of exploiting them.

You will probably need to see what ports are open on these hosts, and the OS they are running. One of the best apps for the job is nmap, which can be easily used via its graphical interface, Zenmap, which lets you run various types of scans on any host within your network. Zenmap ships with 10 common scanning profiles and you can define your own using its extensive options.

Break into Wi-Fi

Wi-Fi Protected Access (WPA) and Wi-Fi Protected Access 2 (WPA2) are wireless security protocols that were intended to address the security shortcomin­gs of WEP. Because the WPA protocols dynamicall­y generate a new key for each packet, they prevent the statistica­l analysis that caused WEP to fail. Neverthele­ss, they are vulnerable to some attack techniques. WPA and WPA2 are frequently deployed with a pre-shared key (PSK) to secure communicat­ions between the access point and the wireless clients. The PSK should be a random passphrase of at least 13 characters in length; if not, it is possible to determine the PSK using a brute-force attack by comparing the PSK to a known dictionary. This is the most common attack.

The best way to check whether your wireless network is impervious to attacks or not is to break into it. However, be advised: breaking into a wireless network that isn’t under your charge is illegal and shouldn’t be attempted.

We’ll use the airmon-ng set of tools to crack open the faults in our network. To start, we need to be able to intercept or monitor wireless transmissi­ons; therefore, we need to set the Kali communicat­ion interface with wireless capabiliti­es to monitor mode with: airmon-ng start wlan0 If the command tells you that there might be some processes that could cause trouble, kill those processes using airmon-ng check kill Now reissue the airmon-ng start wlan0 command. The command creates a monitoring interface such as wlan0mon.

When the monitoring interface is up, use airodump-ng wlan0mon to view the local wireless environmen­t. This command lists all networks it can find within range of the wireless adaptor at that moment. The output includes several key details including the BSSID of each network along with its MAC address, bandwidth informatio­n including the channel used, informatio­n on the encryption used, and the ESSID, which provides the name of the wireless network. Locate your network from the list, and make a note of its BSSID and the

channel it’s on. Then use the informatio­n you get to fire up

airodump, eg: airodump-ng -c 11 --bssid 28:03:7C:51:10:31 -w /root/ Documents/my-network wlan0mon . The command will create a bunch of files under the /root/

Documents directory. We’ll now force one of the devices to reconnect with the router and capture the handshake between them. Make a note of the BSSID of any station and launch a new terminal while leaving Airodump running. In the new terminal window we’ll launch what’s known as a deauthenti­cation attack, where a device is forced to reauthenti­cate to the access point and re-exchange the secure encrypted WPA2 keys. In the new terminal window enter: aireplay-ng -0 2 –a 28:03:7C:51:10:31 -c 00:1C:50:7D:44:5C wlan0mon Here the -a switch points to the BSSID of the network and the -c switch points to the MAC address of a station. You might have to repeat this command several times with different stations until you see a bunch of ACKs in the terminal window which indicate that the access point has acknowledg­ed the deauthenti­cation command that was sent.

Now switch to the original terminal window, still running the Airodump command. If the handshake has been captured you’ll notice a number next to the WPA Handshake in the top right-corner of the window. You now have the router’s password in encrypted form. We’ll now use aircrack to bruteforce our way through this encrypted password using a wordlist. Kali Linux ships with several wordlists and we’ll cycle through all until we find a match. The handshake is captured inside a file under the /root/Documents directory with the

-01.cap extension. To start cracking the password, type: aircrack-ng /root/Documents/*-01.cap -w /usr/share/ wordlists/fern-wifi/common.txt This is a time-consuming process and you might have to use the other wordlists until one finds your password.

Strengthen your network

As you can see, breaking through a wireless network’s security key doesn’t take much effort. Depending on the complexity of your password, the process can take anywhere from ten minutes to ten hours. Your only defence against such attacks is a complicate­d password with various special characters, numbers and mixed cases.

Furthermor­e, there are a few more things you can do to make the attackers work to gain access to your network. While these won’t stand against a determined attacker, they are enough to dissuade the average wardriver looking for free Wi-Fi. You should enable MAC address filtering and if possible add the MAC addresses of all your devices to your wireless router’s settings so that only the specified devices can connect to your Wi-Fi network. But know that MAC addresses can be easily spoofed.

You should also disable unnecessar­y services and protocols, particular­ly those that are notoriousl­y used for gaining unauthoris­ed access such as SNMP, SSDP and uPnP. If intruders do gain access to your network, you can limit the damage they can do by disabling administra­tion over Wi-Fi and instead forcing it over a wired connection only.

It’s also pretty easy to spoof a network address and trick people into signing into the wrong network. This is easily done with a tool called Airbase which essentiall­y turns your Wi-Fi adapter on Kali Linux into an access point with the same name as another network. Once signed in, the attackers can capture all traffic over the spoofed network including usernames, passwords and all sorts of transactio­nal informatio­n. To avoid falling prey to spoofed networks, never log into a network that doesn’t require a password, and also turn off your distro’s ability to automatica­lly connect to Wi-Fi.

Lastly, you might also want to disable WPS. Kali Linux includes the reaver tool, which can exploit a vulnerabil­ity in the WPS implementa­tion on many routers and brute-force its way to the wireless password. Using the tool is simple. Use airodump and make note of your router’s BSSID and channel. Then use the following to figure out your router’s WPS PIN: reaver -i wlan0mon -b 8D:AE:9D:65:1F:B2 -c 9 -vv

One possible option to circumvent this type of attack is to turn off the WPS function, though it’s been reported that this isn’t always effective. A better option is to switch to an open source firmware like DD-WRT that doesn’t have the WPS functional­ity in the first place. Also, many new routers can resist brute-force attacks by limiting the number of times you can access it. However, this too can be circumvent­ed.

All said and done, the best solution to securing a wireless network is to deploy a RADIUS authentica­tion server that’s used in conjunctio­n with the WPA2 protocol.

 ??  ?? Kali Linux is a Debian-based distro with more than 300 tools and utilities, arranged in a categorise­d and structured menu.
Kali Linux is a Debian-based distro with more than 300 tools and utilities, arranged in a categorise­d and structured menu.
 ??  ??
 ??  ?? The Social Engineerin­g Toolkit is a collection of scripts to help you cook up various makebeliev­e attacks to exploit the human element.
The Social Engineerin­g Toolkit is a collection of scripts to help you cook up various makebeliev­e attacks to exploit the human element.

Newspapers in English

Newspapers from Australia