Reader small image

You're reading from  Mastering Kali Linux Wireless Pentesting

Product typeBook
Published inFeb 2016
Publisher
ISBN-139781785285561
Edition1st Edition
Right arrow
Authors (2):
Brian Sak
Brian Sak
author image
Brian Sak

Brian Sak, CCIE #14441 (Security), is a 20-year information security veteran who currently works as a technical solutions architect for Cisco Systems. At Cisco Systems, he is engaged in solution development, and he consults with Cisco partners to help them build and improve their processes and services in the areas of big data analytics and digitization. Prior to joining Cisco Systems, Brian performed security consulting, penetration testing, and security assessment services for large financial institutions, US government agencies, and enterprises in the Fortune 500. In addition to numerous security and industry certifications, he has a bachelor's of science degree in information technology, with an emphasis on information security, and a master's of science degree in information security and assurance. He is also a contributor to The Center for Internet Security and other publications by Packt and Cisco Press.
Read more about Brian Sak

Jilumudi Raghu Ram
Jilumudi Raghu Ram
author image
Jilumudi Raghu Ram

Jilumudi Raghu Ram is a security analyst with over 5 years of experience in the information security domain, with a strong knowledge of incident response, digital forensics, network security, infrastructure penetration testing, and Secure configuration audits. He has conducted security audits for more than 70 networks, both internal and external, re-audits, secure configuration reviews, and server audits (Linux and Windows) for various organizations. One of his major clients has been the Government of India, where his team was responsible for conducting penetration testing assignments for various government bodies, as well as preparing vulnerability assessment and penetration testing reports, and supporting the clients to fix those vulnerabilities. Raghu Ram's areas of expertise include incident response, digital forensics, threat research, penetration testing, vulnerability assessment, dynamic malware analysis, intrusion detection systems, and security operations monitoring. Raghu Ram has written various articles related to information security in the Hindu Group magazine Frontline. He also maintains his own website dedicated to Penetration Testing - www.wirelesspentest.com
Read more about Jilumudi Raghu Ram

View More author details
Right arrow

Chapter 5. Man-in-the-Middle Attacks

Man in the middle attacks are a class of attacks where a third party can intercept, capture, or alter the communication between two entities. Abbreviated as MITM, these attacks exploit the open nature of wireless networks that allow an attacker to see all wireless traffic being transmitted from clients to the access point. If the communication is sent in the clear or in a way that can be decrypted by the attacker, the information gleaned from a successful MITM attack could lead to a successful compromise of the target client and potentially the network infrastructure.

On wireless networks, capturing the traffic sent between two devices is relatively easy; anyone within range of the wireless signal can capture the traffic. Open networks, such as those found in public hotspots, are notoriously easy to manipulate. Though it is slightly more difficult when the target network is encrypted, it is not impractical. As we have seen in previous chapters, it is possible...

MAC address Spoofing/ARP poisoning


The goal of any Man-in-the Middle attack is to be able to redirect traffic, not intended for you, through a device that you control. If an attacker is connected to the same wireless network as a targeted client, they can utilize various techniques to accomplish this. Kali provides many of the tools required to manipulate network services that will modify the destination of where legitimate clients are sending traffic. Once the modifications are in place, the clients will rely on the attacker's computer for doing things like name resolution or as the next hop for their IP traffic. Having this position in the network allows the attacker to spoof replies to the client or capture any traffic normally destined for the network gateway.

The following diagram depicts the typical state of the network where the normal communication traffic flows between the client computer and the default gateway:

On any IP-based network, wireless or otherwise, address resolution is...

Rogue DHCP server


Another effective attack that is possible once an attacker and victim share the same wireless network is the deployment of a rogue DHCP server to service clients. The attacker will attempt to get their targets to acquire an address from them rather than the legitimate DHCP server on the network. DHCP, or Dynamic Host Configuration Protocol, is a popular method to hand out IP addresses from a pool of addresses to clients that connect to the network. It eliminates the need to statically configure IP addresses on all clients where it is impractical, such as client segments where clients come on and go off the network frequently, or impossible, such as public hotspots or other guest wireless scenarios.

DHCP works in a broadcast, response fashion where a client connecting to a network sends a request for an IP address via DHCPDISCOVER and DHCPREQUEST and the DHCP server will respond with the addressing information via DHCPOFFER and DHCPACK (or acknowledgement). This process is...

Name resolution spoofing


When a client is looking to access a resource either via a web browser or from a command-line tool, they most often rely upon some sort of name resolution service to map the name of the host, domain, or resource to an IP address rather than specifying it directly. It is impractical to type in http://216.58.216.196 every time you want to access https://google.com, since it is much easier to remember the name rather than the IP address. Furthermore, it is unlikely that an individual will know what IP addresses each hostname maps to since DNS and NBNS have been set up to eliminate this requirement. An attacker can use this to their advantage by manipulating the results that these name resolution services provide to users and then redirecting their requests to resources that he controls and trick them into divulging sensitive information or to sites that can exploit various host or browser vulnerabilities.

DNS spoofing


As mentioned before, DNS, or Domain Name Services, maps a name to an IP address. This process is very similar to the process described earlier with reference to DHCP. When the client supplies a DNS name when making a request for a resource, such as in the URL bar in a browser or when Telnetting or SSHing to a host via the command line, the operating system will first look to its local hosts file to see if a mapping is available there. In most cases, this fails to return a result and the operating system next asks the DNS server to provide the mapping. Where this is similar to DHCP is that when a DNS request is initiated, the client will listen for the first response it hears, with the appropriate sequence number used to test the validity of responses, and then will disregard any DNS replies that come after the initial one. This creates a race condition to return a response back to the client that the attacker wants instead of the legitimate response from the local DNS server...

Configuring Ettercap for DNS spoofing


To use Ettercap in order to carry out DNS spoofing, we need to give Ettercap some additional privileges. Follow these steps:

  1. Use a text editor and edit the /etc/ettercap/etter.conf file.

    #nano /etc/ettercap/etter.conf
    
  2. Change the gid and uid that Ettercap uses to 0. This will allow the process to run as root and manipulating interface or operating settings to accomplish our goals will not be an issue.

  3. Edit the configuration for dns_spoof plugin for Ettercap. Again, use a text editor and edit the file at /etc/ettercap/etter.dns.

  4. In the redirection section of the file titled microsoft sucks ;), you will be adding in the domain names you would like to redirect to your local server. In this example, we will be adding the gateway.local DNS name. You can also add other hostnames, domain names, or wildcard domain names such as the given *.microsoft.com example. When the user attempts to access anything at the domain name microsoft.com, they will be redirected to...

NBNS spoofing


NetBIOS Name Service (NBNS) is a protocol that exists to resolve names on the network without the requirement for using local hosts files or DNS. It is part of the NetBIOS-over-TCP protocol suite enabling to run on top of an IP network; however, NetBIOS itself is not restricted to only IP. It was developed to essentially serve the same purpose of DNS in that it allows users to access resources using a name and it will in turn resolve that name to an IPv4 IP address. It varies from DNS in that NBNS is a flat name service whereas DNS is hierarchical, meaning that it can have a TLD (Top Level Domain), sub-domains, and hostnames while NBNS is similar to a hosts file where a single name resolves to an IP address. NBNS also varies from DNS in that requests are issued to either broadcast or multicast address, meaning that anyone who is connected to the same broadcast domain will hear this request if they are listening.

NBNS has been around since the early days of Windows to provide...

Summary


In this chapter, we covered many options available to an attacker if they share the same wireless network with their intended targets. MAC spoofing and ARP poisoning are two attacks that go hand in hand to get between a client and the router on a wireless network. The victim is tricked into sending their outbound traffic through the attacker and the router is also tricked into sending traffic destined for the victim through the attacker in kind. This attack can be very effective for clients that are already connected to a wireless network that an attacker also has access to, such as a public hotspot or after an attacker has defeated a pre-shared key authentication technique on WPA-personal or WPA2-personal networks. DHCP and DNS were also demonstrated as services that can be manipulated by an attacker to either redirect traffic through your attacking workstation to capture sensitive traffic or to unwittingly redirect a target's browser or command-line tools to where you may be able...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering Kali Linux Wireless Pentesting
Published in: Feb 2016Publisher: ISBN-13: 9781785285561
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Brian Sak

Brian Sak, CCIE #14441 (Security), is a 20-year information security veteran who currently works as a technical solutions architect for Cisco Systems. At Cisco Systems, he is engaged in solution development, and he consults with Cisco partners to help them build and improve their processes and services in the areas of big data analytics and digitization. Prior to joining Cisco Systems, Brian performed security consulting, penetration testing, and security assessment services for large financial institutions, US government agencies, and enterprises in the Fortune 500. In addition to numerous security and industry certifications, he has a bachelor's of science degree in information technology, with an emphasis on information security, and a master's of science degree in information security and assurance. He is also a contributor to The Center for Internet Security and other publications by Packt and Cisco Press.
Read more about Brian Sak

author image
Jilumudi Raghu Ram

Jilumudi Raghu Ram is a security analyst with over 5 years of experience in the information security domain, with a strong knowledge of incident response, digital forensics, network security, infrastructure penetration testing, and Secure configuration audits. He has conducted security audits for more than 70 networks, both internal and external, re-audits, secure configuration reviews, and server audits (Linux and Windows) for various organizations. One of his major clients has been the Government of India, where his team was responsible for conducting penetration testing assignments for various government bodies, as well as preparing vulnerability assessment and penetration testing reports, and supporting the clients to fix those vulnerabilities. Raghu Ram's areas of expertise include incident response, digital forensics, threat research, penetration testing, vulnerability assessment, dynamic malware analysis, intrusion detection systems, and security operations monitoring. Raghu Ram has written various articles related to information security in the Hindu Group magazine Frontline. He also maintains his own website dedicated to Penetration Testing - www.wirelesspentest.com
Read more about Jilumudi Raghu Ram