惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

雷峰网
雷峰网
B
Blog
博客园_首页
云风的 BLOG
云风的 BLOG
S
SegmentFault 最新的问题
罗磊的独立博客
Jina AI
Jina AI
C
Check Point Blog
Martin Fowler
Martin Fowler
J
Java Code Geeks
博客园 - 司徒正美
美团技术团队
MongoDB | Blog
MongoDB | Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
有赞技术团队
有赞技术团队
U
Unit 42
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
小众软件
小众软件

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
DNS hijacking: when someone else answers in your domain's...
Regő Botond · 2026-05-09 · via DEV Community

Your users type your domain into their browser. They get a login page that looks exactly like yours. They enter their credentials. You never see any of it.

That's DNS hijacking. No one broke into your servers. No one touched your code. They just changed where your domain points.


How DNS actually works (the part that matters)

When someone visits yourapp.com, their browser asks a DNS resolver: "what IP address is this?" The resolver checks its cache, and if it doesn't have an answer, it walks up the DNS hierarchy until it finds one. Your authoritative nameserver, the one you control through your registrar, gives the final answer.

The whole process takes milliseconds and happens invisibly. It's also built on a foundation of trust. DNS was designed in 1983, when the internet was a handful of universities sharing files. Authentication was an afterthought added decades later, and most of the internet still doesn't use it.

That gap is where hijacking lives.


The three ways it actually happens

Registrar account compromise

This is the most common and the most damaging. Your domain registrar account gets compromised, and the attacker changes your nameservers to ones they control. Every DNS query for your domain now goes to their server. They answer however they want.

From the outside, nothing looks wrong. The domain name is yours. The WHOIS still shows your company. Users have no way of knowing they're talking to the wrong server.

The 2019 Sea Turtle campaign, attributed to a nation-state actor, used exactly this method to target government and military domains across the Middle East and North Africa. They didn't attack the targets directly. They compromised registrars and DNS providers upstream, then redirected traffic to collect credentials. Some victims went months without noticing.

DNS cache poisoning

Resolvers cache DNS responses to avoid asking the same question twice. Cache poisoning tricks a resolver into storing a fake answer, so every user who asks that resolver for your domain gets sent to the wrong IP.

The classic attack exploits the fact that DNS uses UDP, which has no built-in verification. An attacker who can guess the query ID (a 16-bit number, so 65,536 possibilities) can inject a fake response before the real one arrives. Kaminsky's 2008 disclosure showed this was practical at scale. The patch was randomizing the source port on top of the query ID, which raised the guessing space to around 2 billion. Better, but not foolproof.

BGP hijacking with DNS as a side effect

Border Gateway Protocol is how internet routers know which paths to use. It's also almost entirely based on trust between autonomous systems. When a network announces that it owns an IP range it doesn't, traffic for those IPs can get rerouted through the attacker's infrastructure.

In 2018, attackers briefly hijacked the BGP routes for Amazon's Route 53 DNS service. They redirected DNS queries for MyEtherWallet to a server they controlled, which served a fake version of the site and collected around $150,000 in cryptocurrency in two hours. The DNS records themselves were never touched.


What attackers do with it

Credential harvesting is the obvious one. Serve a convincing copy of your login page, collect usernames and passwords, pass the credentials through to the real site so users don't notice anything is off.

But it goes further than that. If your domain is used for email (MX records), an attacker who controls your DNS controls where your email goes. Password reset links, internal notifications, customer data, all of it can be redirected.

HTTPS doesn't save you here. An attacker who controls your DNS can request a valid TLS certificate for your domain from any CA using HTTP-01 or DNS-01 validation. The padlock in the browser will be green. The certificate will show your domain name. It will be completely legitimate from the browser's perspective.


Signs something is wrong

Most teams find out from users. "Your site looks weird" or "my password stopped working" are common first signals, by which point the damage is done.

What to actually watch:

Your NS records should never change unless you're deliberately migrating DNS providers. Set up monitoring for them. If your authoritative nameservers change without a ticket in your system, something is wrong.

TTL spikes are suspicious. Attackers sometimes lower TTLs before a hijacking to make the switch propagate faster and to make rollback harder. A sudden drop in TTL across your zone is worth investigating.

Response time changes. If your DNS responses start coming from unexpected geographic locations or taking longer than usual, a resolver somewhere is getting wrong answers.

Certificate transparency logs, which we covered in the previous post on CT logs, will show you if a certificate was issued for your domain from an unexpected CA. This is often one of the first visible signs of an active hijack.

Tools like ZeroHook monitor your DNS records continuously and alert you when something changes, NS records, A records, MX records, anything. The window between a hijack starting and you noticing it manually is often days. Automated monitoring closes that window considerably. Worth setting up: zerohook.org.


How to actually protect yourself

Lock your domain at the registrar. Most registrars offer a "registrar lock" or "transfer lock" that prevents nameserver changes without an additional out-of-band confirmation. Enable it. Some registrars also offer registry lock, which requires a phone call or signed document to make changes. For critical domains, that friction is worth it.

Enable DNSSEC on your zone. DNSSEC adds cryptographic signatures to DNS records, so resolvers can verify that the answer they received came from your authoritative server and wasn't tampered with in transit. Adoption is still patchy, but it defends against cache poisoning and some man-in-the-middle attacks.

Harden your registrar account. Use a strong unique password, enable MFA, and restrict access to the minimum number of people who actually need it. The Sea Turtle campaign worked because registrar accounts are often treated as low-value administrative accounts rather than the critical infrastructure they are.

Use CAA records to restrict which certificate authorities can issue certs for your domain. If your CAA record says only Let's Encrypt can issue for yourapp.com, a hijacker using a different CA will get rejected. It's not foolproof but it raises the bar.

Monitor, not just your servers but your DNS. Uptime monitoring tells you when your site is down. It doesn't tell you that your site is up but serving someone else's content.


TL;DR

DNS hijacking doesn't require access to your servers or your code. It requires access to wherever your domain's DNS records live, which is usually a registrar account protected by a password and maybe SMS two-factor.

The attack is invisible to users. HTTPS doesn't stop it. You can lose credentials, email, and customer trust before anyone on your team notices.

Lock your domain. Enable DNSSEC. Watch your NS records. Set up monitoring that tells you when your DNS changes, not just when your site goes down.