Caloogy Article
中文

DNS and Domain Hijacking

Date
Apr 30, 2025
Series
Infra
Reading
4 min
Topics
InfraDnsDomain hijackingRegistrar

The one-sentence version

When a user visits a website, the first step is to translate the domain name into a server address via DNS. Whoever controls this step can lead the user anywhere: even if the server, code, and certificates remain uncompromised, the user ends up on a fake website. There are three types of hijacking: compromising the domain registrar account (changing the name servers), compromising the DNS provider account (changing the resolution records), and subdomain takeover (one of your records points to a cloud resource that no longer belongs to you). For DeFi websites, this means users sign malicious transactions on what appears to be the "official URL."

This article has three layers:

  1. Layer 1: The Intuition: Changing the road signs
  2. Layer 2: Real-World Use: DeFi frontend hijacking incidents, subdomain takeover
  3. Layer 3: Principles and Engineering details

Layer 1: The Intuition

1.1 Changing the road signs

You drive to the same bank every day. One day, someone changes the road sign at the intersection to point toward another building that looks exactly like the original. You walk in as usual and deposit your money.

The bank itself is perfectly intact, but your money is gone. DNS is the road sign of the internet.

1.2 Who can change the road signs

Layer Who controls it Consequence of compromise
Domain Registrar Where you bought the domain Can replace the entire domain's DNS servers with the attacker's
DNS Provider The platform hosting resolution records Can modify any individual record
The resolution record itself The records you configured If the pointed-to resource no longer belongs to you, others can "claim" it

Layer 2: Real-World Use

The particular danger of DNS hijacking is that: attackers can also apply for legitimate HTTPS certificates for the hijacked domain (Certificate Authorities verify domain control via DNS or HTTP), so the small padlock in the browser address bar will still be displayed.


Layer 3: Principles and Engineering

3.1 Protecting Registrar Accounts

Measure Description
Strong 2FA Preferably passkeys or hardware keys (see "Passkeys and Anti-phishing")
Registrar Lock Prevents domain transfers and changes to name servers
Registry Lock A higher level: any modification requires manual verification by the registry; suitable for high-value domains
Contact Email Do not use an email address from the same domain for domain management (otherwise, if the domain is lost, the email is also lost)
Auto-renewal Enable auto-renewal to avoid domain squatting after expiration

3.2 Protecting DNS Records

3.3 Preventing Subdomain Takeover

3.4 Monitoring

What to monitor Why
Domain NS records and critical A / CNAME records Alert immediately upon any change
Certificate Transparency logs To discover unexpectedly issued certificates
Periodic external access to the website and comparison of content hashes Even if DNS is changed, you can detect that the content seen by users is incorrect (see "Bybit Incident and Frontend Integrity")

3.5 Advice for Users


Summary

Layer Key points
Intuition The road sign is changed; the bank is intact, but the person walks into a fake building
Three types Registrar account, DNS provider account, Subdomain takeover
Protection Strong 2FA + Registrar / Registry Lock; CAA; Certificate Transparency monitoring
Limitations DNSSEC cannot prevent account compromise; attackers can still obtain legitimate certificates after hijacking