Module 08 explores network sniffing, a fundamental technique for capturing and analyzing data packets traversing a network. Understanding sniffing is crucial for identifying insecure protocols transmitting cleartext data, performing Man-in-the-Middle (MITM) attacks, and detecting malicious network activity.
- Passive Sniffing: Capturing traffic on a network segment without interacting with it directly (e.g., on a hub or via a monitoring port on a switch). Limited effectiveness on modern switched networks.
- Active Sniffing: Injecting traffic or manipulating network protocols (like ARP) to intercept traffic between other hosts. Required on switched networks for MITM attacks.
- Goals: Capture credentials (FTP, Telnet, HTTP Basic Auth), analyze protocols, identify hosts, monitor network usage, facilitate MITM attacks.
I. Packet Capturing and Analysis with Wireshark
Wireshark is the world's foremost network protocol analyzer, essential for capturing and inspecting network traffic in detail.
A powerful GUI tool available for Linux, Windows, and macOS. It allows capturing live traffic and analyzing previously saved capture files (
.pcap, .pcapng).
This demonstrates capturing data from your own machine or on a network segment you can directly monitor (e.g., connected to a hub or network tap).
1. Start Capture (Attacker Machine - e.g., Win 2016):
- Launch Wireshark. - Select the primary network interface (e.g., Ethernet, Wi-Fi) that has network traffic. - Click the "Start capturing packets" button (often a shark fin icon).
2. Trigger Traffic (Target Action - e.g., on Win 10 on same network):
- On a separate machine (or your own, if testing local traffic), log in to a website that uses unencrypted HTTP for login (e.g., the hypothetical www.moviescope.com from the notes, or a deliberately vulnerable test site like DVWA).
3. Stop Capture & Filter (Attacker Machine):
- In Wireshark, click the "Stop capturing packets" button (red square).
- In the "Apply a display filter" bar, type http.request.method == "POST" and press Enter.
4. Analyze Results:
- Wireshark will filter the captured packets to show only HTTP POST requests. - Find the POST request sent to the login page. - In the packet details pane below, expand the "HTML Form URL Encoded" (or similar, like JSON/XML depending on the site) section. - Look for fields corresponding to username and password – if sent over HTTP, they will be in cleartext.
This allows capturing traffic directly on a remote Windows machine without installing Wireshark fully on it, using the RPCAP (Remote Packet Capture) protocol.
Prerequisites: WinPcap or Npcap (which includes rpcapd service) must be installed on the *remote* Windows machine.
1. Start Remote Capture Service (Target Windows Machine - e.g., Win 10):
- Open "Services" (run services.msc).
- Find the "Remote Packet Capture Protocol v.0 (experimental)" service.
- Start the service. (Note: This requires administrative privileges).
- Ensure the Windows Firewall allows incoming connections on TCP port 2002 (default rpcapd port).
2. Configure Remote Interface (Attacker Machine - e.g., Win 2016):
- Launch Wireshark.
- Go to Capture > Options....
- Click Manage Interfaces....
- Go to the Remote Interfaces tab.
- Click Add (+).
- **Host:** Enter the IP address of the target Windows machine (e.g., 10.10.10.10).
- **Port:** Use the default 2002 (unless changed on the target).
- **Authentication:** Select "Password authentication" and enter the *Windows login credentials* for an account on the target machine with sufficient privileges to capture packets (likely an Administrator).
- Click OK.
3. Start Remote Capture (Attacker Machine):
- Back in the Capture Options window, the newly added remote interface should appear (e.g., rpcap://[10.10.10.10]:2002/Ethernet0).
- Select the remote interface.
- Click Start.
4. Trigger & Analyze Traffic:
- Trigger traffic on the target machine (e.g., perform the HTTP login again). - Observe the packets arriving in Wireshark on your attacker machine. - Stop the capture and apply filters as in Scenario 1.
Capsa is a commercial network analyzer often used for network monitoring, troubleshooting, and security analysis. While Wireshark excels at deep packet inspection, Capsa provides more high-level statistical analysis and visualization features out-of-the-box.
Key Features (from notes): - **IP Endpoint Analysis:** Quickly identifies hosts generating/receiving the most traffic. - **Traffic Volume Monitoring:** Helps spot anomalies like broadcast/multicast storms or unusually high traffic from specific hosts. - **Protocol Analysis:** Breaks down traffic by protocol. - **Security Analysis:** Modules for detecting potential attacks like ARP poisoning, port scanning, DoS attempts (depending on version).
II. Active Sniffing & Man-in-the-Middle (MITM)
On modern switched networks, simply listening isn't enough to see traffic between other hosts. Active techniques are needed to redirect traffic.
Changing your network interface's MAC (Media Access Control) address – the unique hardware address.
Why? Can be used to bypass MAC address filtering on switches or wireless networks, impersonate another device, or cause network disruption. Sometimes used as a preliminary step or component in other attacks. Tools like macchanger (Linux) or graphical tools like SMAC (Windows - mentioned in notes) facilitate this.
Cain & Abel is a once-popular Windows tool renowned for its sniffing, ARP poisoning (MITM), and password cracking capabilities. However, it is very old, flagged by almost all AV solutions, and may not function correctly on modern Windows versions. It's primarily useful now for understanding the historical integration of these attack techniques in a single tool.
This demonstrates using Cain & Abel to perform an ARP poisoning MITM attack to capture FTP credentials.
1. Configure Cain (Attacker - e.g., Win 2016):
- Launch Cain & Abel (requires Admin privileges).
- Go to the Configure menu (often a gear icon).
- Select your network adapter under the Sniffer tab.
- Click OK.
2. Start Sniffer & Scan Network:
- Click the Start/Stop Sniffer button (network card icon) in the toolbar to start sniffing.
- Click the Sniffer tab at the bottom.
- Click the + (plus) icon in the toolbar.
- Choose to scan "All hosts in my subnet" (or specify a range). Click OK. Cain will discover hosts on the network.
3. Configure ARP Poisoning (APR):
- Click the APR tab at the bottom.
- Click anywhere in the *top-left* white area (where hosts will be listed) to activate the + icon again.
- Click the + icon.
- In the new window, select the target machine (e.g., 10.10.10.10) in the *left* list.
- Select the gateway machine (e.g., 10.10.10.12) in the *right* list.
- Click OK. This defines the two targets for the MITM.
4. Start ARP Poisoning:
- In the APR tab, click the entry you just created (showing the target and gateway IPs).
- Click the Start/Stop APR button (often a biohazard symbol) in the toolbar.
5. Trigger Traffic (Target Action - e.g., Win 2012):
- On the *target machine* (10.10.10.10 in this example), initiate an FTP connection to the *gateway* (10.10.10.12) using cleartext FTP. Log in with a username and password.
ftp 10.10.10.12 (then enter user/pass)
6. View Captured Credentials (Attacker):
- In Cain & Abel, click the Passwords tab at the bottom.
- In the left pane, select FTP.
- The captured FTP username and password should appear in the right pane.
7. Stop Poisoning:
Click the Start/Stop APR button again to stop the ARP poisoning when finished.
III. Detecting Sniffing & ARP Poisoning
Defenders need tools and techniques to identify when sniffing or ARP poisoning attacks are occurring on their network.
Wireshark can identify anomalies often associated with ARP storms or duplicate IP address configurations, which can be indicators of ARP poisoning.
1. Setup ARP Poisoning (Attacker):
Initiate an ARP poisoning attack between two other machines on the network (e.g., using Cain & Abel as described above, or arpspoof on Kali).
Optional (Noise Generation from notes): The notes suggest running `hping3` from Kali towards one target (`hping3 10.10.10.16 -c 100000`). This simply generates network traffic; it doesn't directly relate to ARP detection itself but ensures there's traffic to analyze.
2. Configure Wireshark Preferences (Detector Machine - e.g., Win 10):
- Launch Wireshark.
- Go to Edit > Preferences.
- Expand Protocols -> Select ARP/RARP.
- Check the boxes for: Detect ARP request storms and Detect duplicate IP address configuration.
- Click OK.
3. Capture Traffic (Detector Machine):
- Select the appropriate network interface and start capturing traffic. - Let it run for a period while the ARP poisoning attack is active. - Stop the capture.
4. Analyze Expert Information:
- Go to Analyze > Expert Information.
- Look in the "Warnings" or "Notes" tabs for messages related to "Duplicate use of IP address detected" or "ARP request storm detected". These messages strongly suggest an ARP poisoning attack is underway, as the attacker's MAC address is claiming multiple IP addresses.
XArp is a security tool specifically designed to detect ARP-based attacks on Windows.
Usage (from notes): - Install and run XArp on a potential victim machine (e.g., Win 2016). - Set the "Security Level" to a higher setting like "Aggressive" for more sensitivity. - Initiate an ARP poisoning attack targeting the machine running XArp (e.g., using Cain & Abel or `arpspoof`). - Observe XArp. It should generate alerts when it detects the malicious ARP packets associated with the poisoning attempt.
Conclusion
Network sniffing, whether passive or active, is a cornerstone of network reconnaissance and attack. Tools like Wireshark provide deep visibility, while active techniques involving ARP poisoning (facilitated by tools like Cain & Abel or arpspoof) enable MITM attacks. Understanding how to perform these techniques ethically, and crucially, how to detect them using tools like Wireshark's expert analysis or dedicated software like XArp, is vital for both offensive and defensive security professionals.