Network and Perimeter Hacking · Topic 2 of 9

Spoofing, DNS Poisoning and Sniffing Defense

Spoofing and DNS poisoning attacks, the sniffing tools the exam names, and the countermeasures and detection techniques that find a sniffer on a network.

  • 5 min
In a nutshell
  • IP spoofing suits floods and reflection, because replies do not return to the attacker.
  • DNS poisoning relies on a forged response matching the query, so random ports and IDs help.
  • DNSSEC provides origin authentication and integrity of DNS data, not encryption.

What it is

Spoofing means forging an identity: a MAC address, an IP address, a DNS answer or a name. DNS poisoning forges the answer to a name lookup so victims reach the wrong server.

The page then closes the sniffing topic: the tools used to capture traffic, the controls that make capture useless, and the techniques that detect a sniffer on the network.

Forged identityMAC, IP or DNSVictim trusts the forgeryTraffic or logon goes to attackerDefensefiltering, DNSSEC, encryption

How it works

Spoofing attacks

SpoofIdeaCountermeasure
MAC spoofingCopy another device's MAC to receive its frames or defeat MAC filtersPort security, 802.1X
IP spoofingPut a false source address in packets, for anonymity, reflection or to abuse IP based trustIngress and egress filtering, unicast reverse path forwarding, no trust based on IP alone
Email and caller ID spoofingA forged sender appears legitimateSPF, DKIM and DMARC for email

IP spoofing cannot easily complete a normal TCP connection because the replies go to the forged address, so it suits one way attacks such as floods and reflection. Ingress filtering drops packets arriving from outside with internal source addresses, and egress filtering drops outgoing packets whose source is not yours.

DNS poisoning

DNS poisoning (cache poisoning) places false records in a resolver's cache or in a client's lookup path. Every user of that resolver is then sent to the attacker's address until the record expires.

VariantWhere the false answer is placed
Intranet DNS spoofingOn a local network, by an attacker in a position to answer lookups first, often combined with ARP poisoning
Internet DNS spoofingBy forging responses to a resolver or changing a client's DNS settings, for example through malware
Proxy server DNS poisoningReplacing the DNS settings a proxy or client uses so requests go to a fake site
DNS cache poisoningA forged response that the resolver accepts and caches

A forged response is accepted only if it matches the query, which is why unpredictable transaction IDs and random source ports make cache poisoning much harder. The usual goal is a fake login page or malware download served under a trusted name.

Countermeasures:

  • DNSSEC, which signs records so a resolver can verify them.
  • Randomized source ports and transaction IDs, patched resolvers and limiting recursion to your own clients.
  • DNS filtering, and certificate warnings that users do not click through.
  • Secure the local network (DAI, DHCP snooping), since many intranet attacks begin with ARP poisoning.

Sniffing tools

ToolWhat it is
WiresharkGraphical packet analyzer with capture and display filters
tcpdumpCommand line capture on Linux and Unix
WinDumpWindows port of tcpdump
EttercapActive sniffing and on-path attacks, including ARP poisoning
BettercapModular framework for network attacks and monitoring
dsniff suiteIncludes macof, arpspoof and tools that capture passwords from cleartext protocols
KismetWireless sniffer and detector

In Wireshark, capture filters (applied before capture) and display filters (applied afterwards) are different. A display filter such as tcp.port == 80 shows only traffic on port 80, and arp shows ARP packets. Wireshark also reassembles streams so a whole conversation can be read.

Sniffing countermeasures

  • Use encrypted protocols: HTTPS, SSH, SFTP, IMAPS, SNMPv3, and VPNs or IPsec across untrusted links.
  • Use switches rather than hubs, and enable port security, DHCP snooping and DAI.
  • Use static ARP entries for critical hosts, and disable unused ports.
  • Restrict physical access and use network access control (802.1X).
  • Use strong wireless encryption, and encrypt email and chat.

Sniffing detection techniques

A sniffer in promiscuous mode behaves slightly differently from a normal host, and that can be tested.

  • Ping method: send a ping to the suspect IP with a wrong MAC address. Only a card in promiscuous mode may answer, because the stack accepts the frame.
  • ARP method: send an ARP request to the suspect with an unusual non broadcast destination. A promiscuous card may respond.
  • DNS method: a sniffer that resolves addresses to names generates reverse DNS lookups, which can be monitored.
  • Latency method: a host that processes all traffic may respond more slowly under load.
  • Nmap: the sniffer-detect script (run with --script=sniffer-detect) checks for promiscuous mode on the local network.
  • Network monitoring: watch for MAC addresses changing, many ARP replies and unexpected switch port mirroring.

A worked example

Users reach a bank page that looks right, but the certificate warning appears and the DNS answer for the bank name points to an unexpected address. The resolver cache was poisoned. DNSSEC validation, patched resolvers with random ports, and refusing the certificate prevent damage.

How the exam asks about this

  • "Which technology signs DNS records to prevent forged answers?" -> DNSSEC.
  • "Which filtering drops packets that arrive from outside carrying an internal source address?" -> Ingress filtering.
  • "Which tool is a graphical packet analyzer using capture and display filters?" -> Wireshark.

What to remember for the exam

  • IP spoofing suits floods and reflection, because replies do not return to the attacker.
  • DNS poisoning relies on a forged response matching the query, so random ports and IDs help.
  • DNSSEC provides origin authentication and integrity of DNS data, not encryption.
  • Wireshark has capture filters and display filters. tcpdump is the command line equivalent.
  • Detection methods exploit promiscuous mode behavior: ping, ARP, DNS and latency checks.
Watch out

DNSSEC does not hide queries. It proves the answer is genuine. Hiding queries is the job of DNS over TLS or HTTPS.

Common mistakes

Assuming spoofed packets complete a TCP session. The reply goes to the real owner of the forged address.

Treating DNSSEC as encryption. It signs data. It does not keep it secret.

Calling Wireshark display filters capture filters. They use different syntax and apply at different times.

Check yourself

  • Which control drops outgoing packets whose source address is not in your own network?

    Egress filtering.

  • Why does a randomized source port protect a resolver?

    An attacker must guess the port and transaction ID to make a forged response match the query.

  • Name two ways to detect a sniffer.

    The ping or ARP method with a wrong destination address, and the Nmap sniffer-detect script, among others.

Topic 2 of 9 in Network and Perimeter Hacking

Test yourself on Network and Perimeter Hacking

The full EC-Council 312-50 question bank has 1,000 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by EC-Council. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.