Cybersecurity 101 Categories
What is DNS Spoofing?
DNS Spoofing, also known as DNS cache poisoning, is a cyberattack in which a malicious actor corrupts the Domain Name System (DNS) cache with false information. This causes users attempting to access a legitimate website to be redirected to a fraudulent or malicious site instead.
How DNS Works (Briefly)
- When you type a domain like www.bank.com into your browser, your computer asks a DNS server for the IP address associated with that name.
- The DNS server responds with the correct IP, and your browser connects to that server.
What Is DNS Spoofing?
In a DNS spoofing attack, an attacker inserts or alters DNS records to redirect legitimate traffic to malicious destinations, such as:
- Phishing sites that steal credentials.
- Malware-infected servers.
- Intercepted traffic for spying or manipulation.
Example Scenario
- You try to visit www.mybank.com.
- The attacker has poisoned your DNS server’s cache to associate that domain with their own IP.
- You’re unknowingly redirected to a fake version of the bank’s site.
- You enter your credentials — and the attacker captures them.
Techniques Used in DNS Spoofing
- Cache Poisoning: Injecting false entries into the DNS resolver’s cache.
- Man-in-the-Middle (MitM): Intercepting DNS requests on the network and returning fake responses.
- Compromised DNS Servers: Gaining control of or exploiting vulnerabilities in legitimate DNS infrastructure.
How to Protect Against DNS Spoofing
- DNSSEC (DNS Security Extensions): Adds cryptographic signatures to DNS records to verify authenticity.
- Use Encrypted DNS:
- DNS over HTTPS (DoH)
- DNS over TLS (DoT)
- Patch and update DNS software to close known vulnerabilities.
- Use reputable DNS providers that monitor and secure their infrastructure.
- Avoid public Wi-Fi or use a VPN when necessary.
Summary
DNS spoofing is a dangerous attack that undermines the trust in domain resolution, allowing attackers to redirect users to malicious sites. It’s a key technique used in phishing, malware delivery, and surveillance.
What are the signs of DNS spoofing?
Detecting DNS spoofing can be difficult because it often works silently in the background. However, there are telltale signs and symptoms that may indicate DNS spoofing is occurring on your network or device.
Common Signs of DNS Spoofing
1. Unexpected Redirects
- You enter a familiar URL (e.g., www.google.com) but are taken to:
- A different site entirely
- A site with a different design or branding
- A page that asks for login credentials unexpectedly
2. Browser Security Warnings
- Messages like:
- “The site’s security certificate is not trusted.”
- “Your connection is not private.”
- SSL/TLS mismatches may suggest you’re being routed to an impostor site.
3. Slow or Suspicious Network Behavior
- Sudden lag in DNS resolution.
- Websites that take longer to load or time out unexpectedly.
- Apps or services behaving erratically (e.g., failed updates, connection drops).
4. Incorrect IP Address Resolution
- Use command-line tools (nslookup, dig) to check IPs returned by DNS.
- If your DNS returns unexpected or known-malicious IPs, it may be poisoned.
5. Mismatch Between URL and Site Content
- Domain name looks right, but the content appears:
- Outdated
- Poorly designed
- Loaded with pop-ups or ads
- Asking for unusual information (like banking credentials)
6. Unauthorized DNS Changes
- DNS settings on your device or router were changed without your knowledge.
- Especially common if your router was compromised.
How to Investigate Further
- Compare DNS responses using a trusted external DNS resolver (e.g., Google 8.8.8.8) to check for consistency.
- Scan for malware that may be altering DNS on your machine.
- Review your router’s DNS configuration — attackers often target home routers for DNS redirection.
What to Do if You Suspect DNS Spoofing
- Switch to a trusted DNS provider (Google, Cloudflare, etc.).
- Clear your DNS cache:
- On Windows: ipconfig /flushdns
- On macOS: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- Update router firmware and change the admin password.
- Use DNSSEC-capable resolvers for added integrity verification.
- Enable HTTPS-only mode in your browser or use a browser that warns against certificate errors.
How do I protect against DNS spoofing?
Protecting against DNS spoofing requires a combination of technical controls, network hygiene, and user awareness. Here’s a comprehensive breakdown of how to defend yourself and your organization from this attack.
1. Use Trusted DNS Servers
- Switch to reputable DNS providers known for security and reliability:
- Google DNS: 8.8.8.8, 8.8.4.4
- Cloudflare DNS: 1.1.1.1, 1.0.0.1
- Quad9: 9.9.9.9 (includes malware filtering)
These providers often implement DNSSEC and other anti-spoofing mechanisms.
2. Enable DNSSEC (DNS Security Extensions)
- DNSSEC adds cryptographic signatures to DNS records, ensuring that DNS responses are authentic and unaltered.
- Your DNS resolver and domain registrar both need to support DNSSEC for full protection.
- Businesses and domain owners should:
- Enable DNSSEC on their domains.
- Use DNS resolvers that validate DNSSEC.
3. Use Encrypted DNS: DoH or DoT
DNS over HTTPS (DoH)
- Encrypts DNS queries inside HTTPS.
- Prevents snooping or tampering by ISPs, attackers, or rogue routers.
DNS over TLS (DoT)
- Encrypts DNS at the transport layer (TCP).
Supported by browsers and operating systems:
- Firefox and Chrome support DoH.
- Android 9+ supports DoT system-wide.
4. Clear and Monitor DNS Caches
- Flush DNS caches regularly:
- Windows: ipconfig /flushdns
- macOS: sudo killall -HUP mDNSResponder
- Helps prevent use of poisoned records.
- Use cache snooping detection tools on DNS servers.
5. Keep Systems and Firmware Updated
- Patch vulnerabilities in:
- DNS server software (e.g., BIND, Unbound, dnsmasq)
- Routers and firewalls
- Operating systems
- Many DNS spoofing attacks exploit outdated software.
6. Secure Network Infrastructure
- Change default router/admin credentials.
- Disable remote management on home/office routers.
- Configure firewalls to allow DNS only to approved resolvers.
- Use network segmentation to isolate critical systems.
7. Monitor for Suspicious Behavior
- Use tools like:
- nslookup or dig to verify DNS responses.
- Intrusion detection systems (IDS) for anomalous DNS traffic.
- Compare responses from multiple DNS servers to detect tampering.
8. Train Users to Spot Spoofing
- Teach employees or family members to:
- Look for HTTPS and valid certificates.
- Be suspicious of unexpected redirects or login prompts.
- Report unusual website behavior.
Best Practices Checklist
- Use DNSSEC and encrypted DNS (DoH/DoT)
- Choose trusted DNS providers
- Regularly update DNS software and devices
- Flush caches when suspicious activity is detected
- Monitor DNS traffic for anomalies
- Educate users on phishing and spoofed websites
What is a real-world example of DNS spoofing?
A real-world example of DNS spoofing is the 2008 Kaminsky attack, which exposed a critical flaw in the DNS protocol and demonstrated how cache poisoning could be exploited at scale.
🔍 The Kaminsky DNS Spoofing Attack (2008)
What Happened:
Security researcher Dan Kaminsky discovered a serious vulnerability in how DNS resolvers handled requests. The flaw made it possible for an attacker to inject fake DNS records into a server’s cache, effectively redirecting traffic for any domain to malicious IP addresses.
How the Attack Worked:
- The attacker sent multiple DNS queries to a vulnerable resolver, trying to resolve a subdomain like 123.fake.bank.com.
- The resolver, not knowing the subdomain, forwarded the request upstream.
- Simultaneously, the attacker flooded the resolver with spoofed responses, trying to guess the correct transaction ID and port.
- If successful, the attacker’s fake response was accepted and cached.
- Any future requests to bank.com would be silently redirected to a malicious server.
The Danger:
- The victim would see www.bank.com in their browser, but be talking to a hacker-controlled IP.
- The fake site could:
Kaminsky’s responsible disclosure led to:
- Immediate patches by DNS vendors
- Widespread adoption of source port randomization
- Renewed urgency to deploy DNSSEC to cryptographically validate DNS records
Other Notable DNS Spoofing Incidents
Great Firewall of China (Ongoing)
- DNS spoofing is regularly used to block access to sites like Google, Wikipedia, and Facebook.
- Chinese DNS resolvers inject fake “non-existent” responses for restricted domains.
Phishing Campaigns
- DNS spoofing is used to redirect victims to fake banking or login pages.
- For example, infected home routers with altered DNS settings have redirected users to fake PayPal or Gmail login pages.
Router Hijacking in Brazil (2014)
- Attackers exploited default credentials on home routers to change their DNS settings.
- Result: users were silently redirected to phishing sites for banks, harvesting financial data from thousands.
Lessons Learned
- DNS isn’t inherently secure — without additional protections, it can be easily subverted.
- DNS spoofing can have nation-state, criminal, and individual-scale impact.
- The Kaminsky attack helped usher in stronger DNS security practices like:
- DNSSEC
- Source port and transaction ID randomization
- Increased DNS provider scrutiny