Phishing Education

Pharming Attacks: How DNS Hijacking Redirects You to Fake Sites

By AntiPhishers Published · Updated

Pharming Attacks: How DNS Hijacking Redirects You to Fake Sites

Security Education: This article describes cyber threats for defensive awareness and education purposes only. Understanding how attacks work helps organizations and individuals protect themselves. Never use this information for unauthorized access or malicious purposes.

Pharming is a particularly insidious form of cyber attack because it can redirect you to a fraudulent website even when you type the correct address into your browser. Unlike conventional phishing, which relies on tricking you into clicking a malicious link, pharming manipulates the underlying internet infrastructure that translates domain names into IP addresses, silently sending you to an attacker-controlled server without any visible indication that something is wrong.

How DNS Resolution Works

Every time you type a web address into your browser, your device contacts a Domain Name System server to translate that human-readable name into a numerical IP address. This lookup happens invisibly in milliseconds. Your device first checks its local DNS cache, then queries your router, and finally reaches out to your internet service provider’s DNS servers or other upstream resolvers.

Pharming attacks corrupt this resolution process at one or more of these stages. By inserting fraudulent DNS records, attackers ensure that legitimate domain names resolve to IP addresses hosting malicious websites. The victim sees the correct URL in their browser’s address bar but is actually communicating with the attacker’s server.

Types of Pharming Attacks

Local pharming targets individual devices by modifying the hosts file, a local text file that takes precedence over DNS lookups. Malware installed on the victim’s computer can silently add entries that redirect banking domains, email providers, or other sensitive services to attacker-controlled IP addresses.

Router-based pharming compromises home or office routers, often by exploiting default credentials that were never changed. Once the attacker controls the router, they modify its DNS settings to point all connected devices to a rogue DNS server. Every device on the network is then vulnerable without any device-level infection.

DNS server poisoning targets the servers themselves. By injecting fraudulent records into a DNS resolver’s cache, attackers can redirect thousands or millions of users simultaneously. This approach is technically more complex but produces large-scale impact, as every user relying on the compromised resolver receives the fraudulent mapping.

Why Pharming Is Hard to Detect

Traditional phishing awareness training teaches people to check the URL before entering credentials. Pharming defeats this advice because the URL appears correct. The browser displays the expected domain name while the underlying connection goes to a completely different server. Only careful inspection of SSL certificates or unusual browser security warnings might reveal the deception.

Sophisticated pharming operations even install valid-looking SSL certificates on their fraudulent servers. While these certificates will not perfectly match the legitimate site’s certificate details, most users never inspect certificate information closely enough to notice discrepancies.

Defending Against Pharming

Use DNS over HTTPS or DNS over TLS, which encrypt DNS queries and prevent interception or modification in transit. Configure your devices to use reputable DNS providers that implement DNSSEC validation, which cryptographically verifies that DNS responses have not been tampered with.

Keep your router firmware updated and change default administrative credentials immediately after setup. Disable remote management features unless they are specifically needed. Regularly check your device’s hosts file and DNS settings for unauthorized modifications.

Pay close attention to SSL certificate warnings in your browser. If you receive an unexpected certificate error for a site you visit regularly, do not proceed. This warning may indicate that you are being redirected to a pharming server that cannot present the legitimate site’s certificate.

For a foundational understanding of phishing threats, read our complete phishing guide. You can also learn about related defensive strategies in our article on Browser Security Settings: Hardening Chrome, Firefox, and Edge.

Responding to a Suspected Pharming Attack

If you suspect you have been redirected to a fraudulent site through pharming, disconnect from the network immediately and switch to a trusted connection such as mobile data. Change passwords for any accounts you may have accessed during the compromised session. Run a full malware scan on your device to check for hosts file modifications or DNS-changing malware. Reset your router to factory defaults and reconfigure it with strong credentials and updated firmware. Report the incident to your internet service provider, as they may need to flush poisoned DNS cache entries that could be affecting other customers on their network.

Sources

  1. ICANN DNS Security Resources — accessed March 26, 2026
  2. NIST Cybersecurity Framework — accessed March 26, 2026