CEH Module 8
CEH Module 8
Windows needs the WinPcap driver to be able to put a NIC in promiscuous mode
Many organizations do not put any restrictions on unused switchports
Someone can plug in any device using an Ethernet cable
Network tap
Purpose-built hardware device that sits in a network segment between two appliances
(router, switch or firewall)
Allows you to capture all traffic passing through it
Moo connects to the hotel’s wireless network to send emails to some of his clients.
The next day, Moo notices that additional emails have been sent out from his
account without consent.
So what happened?
If Moo used HTTP instead of HTTPS to sign into his webmail, an attacker could have
sniffed it and logged in as him.
If Moo used Outlook or some email app, if he sent in clear text his SMTP login could
have been compromised.
It is also possible that the additional emails had a spoofed source address.
We would have to investigate the email headers to see if Moo was the actual sender or
not.
Legal interception of data communication between end-points
Some jurisdictions, like the US, require a court order
For surveillance on traditional phone, VoIP, data, multi-service networks
PRISM - System used by NSA to collect internet communications from various U.S.
internet companies
Process of third-party monitoring of phone/Internet conversations
Attacker connects a listening device to a circuit between two hosts/phones
Often covert
Attack can monitor, access, intercept, and record information
Types of Wiretapping:
Active Wiretapping – Monitors/reads and injects something into communication/traffic
Passive Wiretapping – Only monitors/reads/records data
Secretly listening to private conversations or
communications
Capture speech or telephone conversations
Plant a sniffer on a network
Secretly place a camera or microphone in a room
Capture VoIP packets off the network and replay them
Use a phone to record someone entering a password or
PIN from across a room
Use a Wi-Fi Pineapple or other man-in-the-middle
device to capture wireless traffic
Use an IMSI-catcher man-in-the-middle
device to intercept cell phone calls
Many protocols are transmitted in clear text (unencrypted)
Vulnerabilities include:
Disclosure of usernames, passwords, host names, IP addresses, sensitive data
Keystrokes that provide user names/passwords
Reconstructing/capturing files including documents, images, voice, video
ARP
IGMP
ICMP
TCP shows sequence numbers (usable in session hijacking)
TCP and UDP show open ports
IP (both versions) shows source and destination addresses
All six of the core TCP/IP protocols are clear text and vulnerable to sniffing.
Clear Version TCP Port Encrypted TCP Port
Replacement
FTP 21 SFTP (part of SSH) 22
FTPS 990
Telnet 23 SSH 22
SMTP 25 SMTP/SSL or TLS 587, 465 (previous)
DNS (zone transfer) 53 -- --
HTTP 80 HTTPS 443
SHTTP (obsolete)
POP3 110 POP/SSL or TLS 995
NNTP 119 NNTP/SSL or TLS 563, 443
SMBv1 139 SMBv3 445
IMAP4 143 IMAP/SSL or TLS 993
LDAP 389 LDAPS 683
SQL 1433 SQL/SSL or TLS 1433
Clear Version UDP Port Encrypted Replacement UDP Port
TFTP 69 -- --
SNMP v1-2c 161, 162 SNMP v3 161, 162
NTP 123 (Best practices recommend adding --
authentication, and encryption)
DNS 53 (DNSSEC recommended to add --
integrity to records)
IKE 500 -- --
SIP 5060, 2000 Cisco SIP-TLS 5061
Call Manager
RTSP (SIP competitor 554 -- --
for CCTV)
RTP 5004, 9000, 6970- SRTP 5004+
6999 IETF, 16384-
32767 )
RTCP SRTCP 5005
Wireshark
8.2 SNIFFING TCPDump
Has extensive filtering and search capabilities, and packet analysis features
Can save, export and import packet captures (pcap files)
With the correct driver, can capture radio and management headers from Wi-Fi
tcp.port == 23
Look for specific ports using tcp.port
ip.addr == 10.0.0.165
Look for specific IP address
ip.addr == 172.17.15.12 && tcp.port == 23
Display telnet packets for a particular IP
http.request
Display HTTP GET requests
tcp.port==21
Display FTP packets (unencrypted file transfers)
tcp.flags==0x16
Filters TCP requests with ACK flag set
Tcpdump is a command-line tool for sniffing traffic
Similar to Wireshark, but Linux command-line only
It captures and displays traffic
Good for:
Passive fingerprinting
Sniffing passwords
Intercepting any clear text transmissions
Syntax
tcpdump flag(s) interface
tcpdump -i eth1
Puts the specified interface in listening mode
Note:
Wireshark will capture Wi-Fi packets from any interface, including wireless
Wireshark presents Wi-Fi packets as if they are Ethernet
802.11 LLC header was designed to be directly interoperable with Ethernet
Used to:
Impersonate another machine
Bypass MAC-based access control restrictions
Spoof (fool) a switch
A common attack on a network switch
The goal is to force a switch to behave like a hub
Forward all frames out all ports
The attacker can sniff any traffic
The switch will enter the spoofed MAC addresses into its MAC table
The MAC table fills and cannot take in any new MAC addresses
Vulnerable switches will then change into hub mode
They repeat any incoming frame out all ports
This allows the attacker to sniff traffic from all nodes on the switch
Most modern switches are not vulnerable
bbbb cccc
aaaa
dddd
ffff
eeee
bbbb cccc
aaaa
dddd
ffff
eeee
My MAC
table is
full!
bbbb cccc
aaaa
dddd
ffff
eeee
A core TCP/IP protocol
Maps MAC addresses to IP addresses
In Ethernet and Wi-Fi, you cannot transmit a packet until the Layer 2 header contains the source
and destination MAC addresses
ARP process:
Sender transmits an ARP request
Layer 2 broadcast (FFFFFFFFFFFF)
Asks which MAC “owns” the specified IP address
All nodes on the same segment receive and process the request
The “owner” sends an ARP reply
Layer 2 unicast
Affirms it owns the IP address
The sender updates its ARP cache, mapping MAC to IP
Mappings must be refreshed periodically
Used for sniffing someone else’s traffic
Transmit spoofed ARP frames into the switch
Pretend to have the same MAC as the node(s) you want to eavesdrop on
The IP address is irrelevant, because the switch only deals in MAC addresses
The switch will add the spoofed MAC to its table, associating it with your port
The switch will actually have the same MAC associated with two switchports
Any traffic destined for the other node will also be forwarded out your port
MAC xxxx
MAC aaaa “I’m MAC xxxx MAC bbbb
and MAC aaaa
and MAC bbbb”
MAC xxxx
MAC aaaa MAC bbbb
MAC xxxx
• The deliberate effort to corrupt another device’s ARP cache
• Send fake ARP replies that associate attacker’s MAC with target’s IP
You use your own MAC address, but associate it with the
target’s IP address, to fool other devices
To send to
To send to IP 10.1.1.1,
IP 10.1.1.2, deliver to
deliver to MAC aaaa
MAC bbbb NORMAL
10.1.1.1 10.1.1.2
MAC aaaa MAC bbbb
To send to
To send to IP 10.1.1.1,
IP 10.1.1.2, deliver to
deliver to MAC xxxx
MAC xxxx MITM
10.1.1.1 10.1.1.2
MAC xxxx
MAC aaaa MAC bbbb
Name Resolution Process
POISONING NBNS
LLMNR
1. Check if the destination is self
2. Check if the name is currently in the DNS resolver cache
3. Check if the name is in the %systemroot%\system32\drivers\etc\hosts file
4. Query the DNS server
5. Send an LLMNR multicast to 224.0.0.252 (IPv6 FF02::1:3), UDP port 5355
6. Send a NetBIOS name query broadcast to 255.255.255.255, UDP port 137
Most DNS servers allow dynamic updates
Attacker updates a DNS server with a fake A record
Destination name is the same
IP address has been changed to the attacker’s IP
Mitigation:
Switchport security (restricting the port to only allow one MAC address) may not help
Switches monitor nodes on their ports by examining source MAC addresses
The DHCP protocol does not use source MAC addresses to identify clients
It uses the DHCP DISCOVER CHADDR field in the payload
You can configure DHCP snooping on the switch
Will block rogue DHCP servers
The verify mac-address parameter will also only allow client requests whose payload matches the
actual source MAC in the frame
ip dhcp snooping verify mac-address
Switching loops are caused by uncontrolled redundant links
Switching loops will almost instantly bring the network segment to a standstill
Links will be flooded with endlessly looping and repeating frames
The switch CPU utilization will shoot up to near 100%
The switch MAC table will become unstable by constant rapid changes
Attacker
Tools:
Scapy
Yersinia
Various GitHub projects
Mitigation:
Enable Root Guard on the switchports
spanning-tree guard root
A logical grouping of switch ports
Used to segregate end devices and their traffic based on various business criteria:
Location
Device type
Security level
Double-tagging
A frame header is specially crafted with two VLAN tags, one embedded inside another
The outside tag must belong to the native (default) VLAN of the switch
The switch accepts the frame, discards the outer tag, reads the second tag, and then
forwards the frame to that target VLAN
Patch/update switch operating system
Shut down unused ports and put them in an unused VLAN
Explicitly configure ports for end devices as “access ports”
switchport mode access
Disable Dynamic Trunking Protocol
An attacker will not be able to trick a switchport into establishing a trunk link with them
Change the switch’s native VLAN and ensure no port directly uses the native VLAN
This prevents a switch from accepting double-tagged frames
8.6 SNIFFING
COUNTER- Countermeasures
Tools & Techniques
MEASURES
Use encrypted versions of protocols
Require HTTP Strict Transport Security (HSTS) to prevent MITM downgrade attacks
Prefer switches over hubs
Configure port security on switches
Consider using host-to-host (transport mode) VPNs
Use strong encryption WPA3/2 for Wi-Fi
Scan for NICs in promiscuous mode.
Avoid public Wi-Fi spots
Check DNS logs for Reverse DNS lookups
By default, sniffers will attempt to resolve IP addresses to names
Ping suspected clients with the their correct IP but the wrong MAC address
If suspect accepts the packet, its interface is in promiscuous mode
A good indication of sniffing
Best option:
MAC address reporting from a source device like a router or a switch
You would need a management system or inventory process to capture these addresses
You then identify the rogue devices, and the switchports they were discovered on
REVIEW
INTRO TO
Sniffing allows you to capture passwords, private messages, voice and video calls, files
and other sensitive data from the network
ETHICAL
A good sniffer can capture any protocol from a variety of media types
Should also be able to use multiple filters, follow TCP sessions, recreate captured files from raw
HACKING
hex data, provide packet analysis, and save and load captures files
Sniffing is successful when desired traffic passes a NIC in promiscuous mode
REVIEW
ARP poisoning redirects local LAN segment traffic to the attacker’s MAC address
INTRO TO
Sniffing allows you to capture passwords, private messages, voice and video calls, files
and other sensitive data from the network
ETHICAL
A good sniffer can capture any protocol from a variety of media types
Should also be able to use multiple filters, follow TCP sessions, recreate captured files from raw
HACKING
hex data, provide packet analysis, and save and load captures files
Sniffing is successful when desired traffic passes a NIC in promiscuous mode
REVIEW
ARP poisoning redirects local LAN segment traffic to the attacker’s MAC address