In the modern IT landscape, Domain Name System (DNS) reliability is critical for network availability. When users cannot resolve domain names to IP addresses, it often signals a configuration error, a server outage, or a sophisticated security breach. Among the most dangerous threats targeting DNS infrastructure are cache poisoning attacks, where malicious data is injected into a resolver’s cache to redirect traffic to fraudulent sites. This guide provides a practical workflow for using Wireshark to distinguish between benign query timeouts and active cache poisoning attempts. By leveraging specific display filters and deep packet inspection, network engineers can secure their DNS infrastructure against these evolving threats.
Understanding the Threat Landscape: Timeouts vs. Poisoning
Before diving into packet analysis, it is essential to differentiate between a simple connectivity issue and a targeted attack. A DNS query timeout typically occurs when a client sends a request to a nameserver but receives no response within the expected timeframe (usually 2–5 seconds). This could result from network congestion, firewall blocking UDP port 53, or the remote server being down.
In contrast, a cache poisoning attack involves an attacker spoofing the source IP address of a legitimate DNS server in a reply packet. If the client validates the response based on the spoofed IP, the malicious record is stored in the local resolver’s cache. Identifying this requires observing anomalies in the Transaction ID (TXID) matching and the consistency of the response data relative to known authoritative records.
Prerequisites and Lab Environment Setup
To safely practice these skills without risking production data, you should establish a controlled lab environment. This scenario assumes a standard Linux or Windows workstation with Wireshark installed. For educational purposes using Cisco Packet Tracer, you can simulate a client-hosting a local DNS server (e.g., BIND or CoreDNS) and inject traffic manually.
Required Tools:
* Wireshark: Version 4.x or later is recommended for improved display filter syntax support.
* Network Interface: Ensure your network adapter is set to “Promiscuous Mode” if running on a managed switch, though standard monitoring ports usually suffice.
* Test Domain: Use a public test domain like example.com or a local private zone if available.
Safety Warning: Always perform these tests in an isolated VLAN or virtual environment. Do not run Wireshark captures on production networks without explicit authorization, as capturing DNS traffic can reveal sensitive internal hostnames and IP addresses.
Step 1: Capturing Baseline DNS Traffic
The first step is to establish a baseline of normal DNS behavior. Start Wireshark and apply a capture filter to listen only for DNS traffic, reducing noise from unrelated protocols.
udp.port == 53 or tcp.port == 53
Alternatively, you can use the display filter within the interface to see all packets but focus analysis on DNS:
dns.qry.name contains "example.com"
Send a standard query from your client for www.example.com. In a healthy network, you should observe a UDP packet from the client with a specific Transaction ID (e.g., 0x1234) followed shortly by a response packet containing the same Transaction ID and an AA bit set to 0 (indicating it is not an authoritative answer but a successful referral or direct answer).
Step 2: Identifying Query Timeouts with Filters
To identify timeouts, look for unanswered queries. In Wireshark, apply the following display filter to isolate queries that have not yet received a response:
dns.flags.response == 0 and dns.qry.name contains "example.com"
If you leave this filter active while waiting, the packet remains highlighted. A timeout is confirmed if the query persists in the capture for longer than the configured retry interval (typically 5 seconds) without a corresponding response packet appearing in the stream.
Common Cause: Firewall Blocking UDP
A frequent cause of these timeouts is an intermediate firewall dropping unsolicited UDP responses. To verify this, check for ICMP “Port Unreachable” messages or TCP RST packets related to port 53. If the query times out and no error message appears, the packet may have been silently dropped (blackholed).
Step 3: Detecting Cache Poisoning Indicators
Cache poisoning is harder to detect without a baseline of expected answers. However, several indicators suggest an attack is underway:
- Transaction ID Mismatch: The response Transaction ID does not match the original query’s ID.
- IP Address Spoofing: The source IP in the response packet claims to be a legitimate nameserver (e.g.,
8.8.8.8) but the packet arrives from a different, suspicious IP address. - Data Anomalies: The returned MX record or A record contains an unexpected hostname or IP that differs from public knowledge.
Use this filter to find responses that claim to be authoritative but might be spoofed:
dns.flags.response == 1 and dns.flags.rcode != 0
While rcode != 0 shows errors, a successful poison often looks like a valid success (rcode == 0). To inspect the source integrity, expand the IP layer details in Wireshark. Look for the “Source Address” field in the TCP/UDP header. If a response from 203.0.113.50 (a known bad actor) arrives with headers claiming to be from 8.8.8.8, this is a strong indicator of spoofing.
Step 4: Verifying Response Integrity
To confirm poisoning, cross-reference the returned IP address against a trusted source like the WHOIS database or a public DNS resolver (e.g., Cloudflare 1.1.1.1). If your local cache returns an IP for malicious-site.com that does not match the current authoritative record, your cache has been poisoned.
Step 5: Clearing Cache and Resetting State
Once an attack is identified or a timeout issue is resolved, clearing the local cache is necessary. On Linux systems using BIND, you can reload the resolver configuration. For client-side caches (like Windows DNS Client Service), restarting the dnscache service clears the memory.
# Example for Linux named daemon
rndc flush
For students practicing in Packet Tracer or GNS3, simply clearing the “DNS Server” cache table in the simulation tool is the equivalent step.
Student Practice Task: Simulating a Poisoning Attack
Objective: Identify a spoofed response in a simulated environment.
- Setup: Configure a virtual machine as a DNS client and another as a legitimate nameserver.
- Action: Use a second VM to send a forged UDP packet to the client. Set the source IP of the forged packet to match the legitimate nameserver’s IP but change the payload to return an incorrect IP address for
test.example.com. - Analysis: Open Wireshark on the client. Apply the filter:
dns.flags.response == 1. - Verification: Inspect the “Internet Protocol” details of the response packet. Does the source IP match the destination IP’s expectation? If the payload data differs from what a legitimate lookup would return, you have confirmed a poisoning attempt.
Industry Application and Best Practices
In professional environments, relying solely on Wireshark is reactive. Proactive defense involves implementing DNSSEC (Domain Name System Security Extensions). DNSSEC adds digital signatures to DNS records, allowing resolvers to cryptographically verify that the data has not been altered in transit. If a response fails validation, the resolver will discard it regardless of what the packet claims.
Additionally, organizations should configure their recursive resolvers to use trusted upstream providers and enable “DNS over TLS” (DoT) or “DNS over HTTPS” (DoH) to encrypt queries, preventing eavesdropping and spoofing at the network layer. Regularly auditing DNS logs for unusual query volumes or rare domain lookups can also reveal early signs of cache poisoning campaigns.
Conclusion
Mastering Wireshark filters is a vital skill for any network engineer tasked with maintaining DNS integrity. By distinguishing between benign timeouts and malicious cache poisoning attempts, you can respond quickly to incidents that could compromise user trust and data security. Remember that while tools like Wireshark provide powerful visibility, they must be used within the context of broader security strategies, including DNSSEC adoption and strict network segmentation. Always verify your findings against authoritative sources and consult your organization’s specific security policies before taking remedial actions on production systems.
Educational-use notice: This tutorial is for learning and controlled lab use only. Test carefully, use backups, and obtain authorization before making changes. Do not run unfamiliar commands on production systems. We accept no responsibility for misuse, damage, data loss, or production issues.

