Blog / How the internet works /

DNS hijacking and how to prevent it

Your website loads, but it’s not your website. The design is identical, the address looks right, yet the login page asks for a password and sends it somewhere else. Or visitors get redirected to a casino ad.

That’s DNS hijacking: someone changes where a name points, so people typing your address end up at theirs.

What DNS hijacking is

DNS translates names into addresses. If an attacker can change that translation, they control where visitors go, without touching your actual server. The site hasn’t been “hacked” in the usual sense; the signposts were moved.

If DNS is new to you, DNS explained for people who just want their site to work is a good starting point, and DNS records explained: A, AAAA, CNAME, MX and TXT shows what the pieces look like.

Where it can happen

There are several different attack points. Naming them helps, because the defences differ.

1. Your domain registrar account

If an attacker takes over your registrar login (a stolen or reused password, a phishing email, a compromised email address), they can change your nameservers or records, or even transfer the domain. This is the most serious, because they control everything.

2. Your DNS host

If your DNS is managed at a separate provider (a CDN, your host, a DNS service), the same applies: someone with access can change records. Weak passwords and no two-factor authentication are the usual cause.

3. Your email account

Registrars send password resets to the email address on the account. Whoever controls that mailbox can often reset the registrar password. Your domain is only as safe as the email behind it.

4. Expired or dangling records

When a domain lapses and someone else registers it, or when a DNS record still points to a service you no longer use (a “dangling” record), attackers can claim the old target and use your subdomain. This is often called subdomain takeover. Domain expiry and DNS hijacking: protecting client domains discusses the expiry side.

5. Your home or office router

Malware or a weak router password can change the DNS servers your router uses, so everyone on that network is sent to fake sites for banks or shops. The attacker isn’t changing your domain’s records; they’re changing what your network believes.

6. Local malware or rogue Wi-Fi

Software on a device, or a malicious public hotspot, can alter the DNS settings or intercept lookups. Encrypted DNS limits some of this; see DNS over HTTPS explained.

7. Attacks on DNS servers or protocols

Cache poisoning and attacks on resolvers exist, but they’re rarer, and larger providers defend against them. Most real-world hijacks come from stolen credentials, not clever protocol tricks.

Warning signs

  • Visitors report being sent to odd pages, or seeing certificate warnings.
  • Your site works for some people and not others.
  • Email suddenly stops arriving, or bounces (MX records changed).
  • A DNS or registrar change notification you didn’t make.
  • Unexpected new records, or nameservers that you don’t recognise.
  • Search results show spammy titles on your domain.
  • Your browser warns that a certificate doesn’t match.

How to prevent it

Most of this is basic account hygiene. That’s good news: it’s cheap.

Protect the registrar account

  • Use a long unique password from a password manager.
  • Turn on two-factor authentication, ideally with an authenticator app or a security key rather than SMS.
  • Enable registrar lock, which blocks unauthorised transfers.
  • Keep contact details current, so you receive alerts.

Protect the email behind it

Give the registrar account an email address that is itself strongly secured, with two-factor authentication. Don’t use an address on the domain it protects, because if the domain breaks, you can’t receive the reset. Use a separate trusted mailbox.

Secure the DNS host the same way

Two-factor, unique password, and as few people with access as possible. Use named accounts rather than a shared login; shared passwords in a team: doing it safely helps if you must share.

Never let domains lapse

Turn on auto-renew, keep a valid payment method and renew early for important domains. Remember the scam angle too: domain scams: fake renewal letters and emails.

Audit your records

Review DNS records periodically. Remove records pointing to services you’ve cancelled. Check subdomains you’ve forgotten. Keep a record of what each is for. A tidy zone is harder to abuse.

Use DNSSEC where it’s supported and sensible

DNSSEC signs DNS data so resolvers can verify it wasn’t tampered with. It protects against forged answers, though not against stolen account credentials. It adds complexity, so enable it where your DNS host handles it cleanly.

Lower the blast radius of mistakes

Keep a copy of your DNS records somewhere safe so you can restore them quickly. Set up an uptime monitor that checks the page content, not just that the site responds; see uptime isn’t enough: monitoring forms, checkout and email.

Secure the home and office network

Change the router’s default admin password, turn off remote management you don’t use, and update the firmware. Consider setting the router’s DNS to a trusted provider and checking it after any odd behaviour. See router settings worth changing on day one.

What to do if you suspect a hijack

  1. Log into the registrar by typing its address yourself. Check nameservers, records and contact email.
  2. Change passwords and enable two-factor on the registrar, DNS host and email.
  3. Revert any changes you didn’t make, and lock the domain.
  4. Contact the registrar’s support and tell them clearly it’s a possible unauthorised change.
  5. Check email, hosting and CDN accounts for access you didn’t grant.
  6. Review certificates: an attacker may have issued one for your domain.
  7. Tell your users if there’s any chance they entered details on a fake page, and consider asking them to reset passwords.
  8. Allow for caching. Even after you fix the records, resolvers may keep the bad answers until the TTL expires; see TTL: why DNS changes take time.

Myths

  • “Only big companies get hijacked.” Small sites are easier targets, because they have weaker protection.
  • “HTTPS stops it.” It helps, because a fake site can’t easily present a valid certificate, but an attacker who controls DNS may be able to obtain one.
  • “My host handles all of this.” Your host manages servers; your domain account is probably yours.

Key takeaways

  • DNS hijacking changes where your name points, mostly through stolen account access.
  • The weak points are the registrar, the DNS host, the email behind them and the home router.
  • Unique passwords, two-factor, registrar lock and auto-renew prevent most attacks.
  • Clean up old records and monitor for unexpected changes.
  • Act fast and change credentials first if you suspect a problem.

Which email address could reset your domain password, and is it protected with two-factor? Check that one this week.