Blog
SavedSearch
Visit Hostlelo

Domain Hijack Drill: Check Nameservers, Locks and Alerts

Would you notice if your nameservers changed tonight? A ten-minute drill to verify delegation, read lock codes, harden your registrar and watch NS daily.

The short answer

To check for a domain hijack, compare the nameservers your registrar shows with what the parent zone hands out, using dig +trace or a non-recursive query to a TLD server. Then confirm your domain carries clientTransferProhibited and ask about clientUpdateProhibited or Registry Lock. A small daily script that compares NS records at the parent zone with a saved baseline will email you if anything changes.

A domain and two nameserver towers sit behind a padlock while a verification sweep blocks an unauthorised route.
Reading options

On this page

If someone changed your nameservers tonight, you would probably find out from your visitors, not from your registrar. The fix is a short drill: write down your real nameservers, check what the parent zone hands out, confirm your registrar locks are on, and run a small daily script that tells you when anything moves.

Here is why this is worth ten minutes now. At the time of writing (8 November 2026), CircleID reported on 31 October 2026 that researchers found the same wallet-draining toolkit across 12 cryptocurrency sites, and that one affected project said its domain was hijacked at the registrar level. On 2 November 2026, Relevant Audience reported that DebugBear said its DNS records were compromised through its registrar, with malicious JavaScript found at a DebugBear script URL used by Polymarket. These are press reports, not confirmed findings.

By the end of this guide you will know exactly which nameservers your domain should have, how to prove what the world sees, which lock flags to ask for, and how to get a daily "all good" or "something changed" result.

What a domain hijack actually is

Your domain has a set of nameservers, the servers that answer "where does this site live?" for everyone on the internet. Your registrar, the company you pay for the domain, tells the registry, the operator of the whole extension like .com, which nameservers you chose. The registry publishes that list in the parent zone.

A domain hijack usually means someone changes that list without you. They log in to your registrar account, or abuse the registrar itself, and point your domain at nameservers they control. From that moment, their DNS answers for your name. Your server and files are untouched, yet visitors land somewhere else.

Think of it like the post office. Your house is fine and your locks are fine, but someone filed a change of address form in your name. Every letter now goes to their flat, and the postman is doing nothing wrong.

Why this matters: a hijack does not show up in your server logs or your WordPress dashboard. You see it in the delegation itself, which is what this drill checks.

Before you start

No root access or special tools needed. Gather these:

  • Login to your registrar account (the company where you pay for the domain)
  • Login to your DNS provider, if it is different from your registrar (for example Cloudflare or your host's DNS)
  • A computer with dig installed, or a Linux server you can SSH into
  • A note file or password manager entry to record your known good nameservers
  • About 10 minutes for the drill and 10 more for the daily script

Risk level: the checks are read only and change nothing. The lock step changes settings at your registrar, so take a screenshot of the domain settings page before you touch anything. That screenshot is your backup.

Quick tip: on macOS and most Linux systems dig is already there. On Debian or Ubuntu it comes in the bind9-dnsutils package (dnsutils on older releases) if it is missing.

The ten-minute drill

Step 1: Write down your known good nameservers

Log in to your registrar and open the settings page for your domain. Look for a section called Nameservers or DNS. Copy the exact hostnames into your note, all of them, in lowercase.

If you use Cloudflare for DNS, these are the two Cloudflare nameservers shown for your zone. If you use your host's DNS, they are the ones your host gave you.

This short list is your baseline, the thing every later check compares against.

Step 2: Ask your normal resolver what it sees

This command asks your usual DNS resolver for the NS records of your domain and prints only the short answer.

dig +short example.com NS

You should see the same names you wrote down, each ending with a dot. The order may differ, which is fine.

Heads up: this answer can come from a cache, so treat it as a first look, not the final word.

Step 3: Ask the parent zone directly

The registry's servers are the source of truth for delegation. This command follows the chain from the root servers down to your domain, so you can see what each level hands out.

dig +trace example.com NS

Read the output from the bottom up. The block just above the last one comes from the servers of your extension, such as the .com servers, and lists the NS records they publish for your domain. Those names must match your baseline.

If you want a cleaner single answer, ask one parent server directly with recursion switched off. First, this command lists the servers for the parent zone, here .com.

dig +short com. NS

Then this command picks the first of those servers and asks it, without recursion, which nameservers it hands out for your domain. For another extension, change com. to your own, such as org. or co.uk..

dig +norecurse +noall +authority @"$(dig +short com. NS | head -n 1)" example.com NS

You should see lines like example.com. 172800 IN NS ns1.dns-provider.example., one per nameserver. If a name appears that you did not write down in Step 1, stop and go to the section on what to do if the drill finds a real hijack, further down.

Why this matters: the +norecurse option clears the "recursion desired" flag in the query, so the parent server answers from its own data and does not go off and fetch anything. The +noall +authority pair hides everything except the authority section, which is where a parent zone puts its referral.

Step 4: Read your domain status codes

Every domain carries status codes set in the registry. They tell you which changes are blocked. ICANN keeps the official list on its EPP status codes page.

Open the ICANN Lookup tool, type your domain, and look at the status field. Your registrar's own WHOIS or domain info page usually shows the same field.

These are the codes you want to recognise:

  • clientTransferProhibited: set by your registrar; the registry rejects transfer requests
  • clientUpdateProhibited: set by your registrar; the registry rejects updates to the domain
  • clientDeleteProhibited: set by your registrar; the registry rejects delete requests
  • serverTransferProhibited, serverUpdateProhibited, serverDeleteProhibited: set by the registry itself, and they take precedence over client codes
  • ok: the standard status, with no pending operations and no prohibitions

Lookup tools that use RDAP, the IETF-developed replacement for WHOIS, may print the same codes in plain words. ICANN maps clientTransferProhibited to "client transfer prohibited", clientUpdateProhibited to "client update prohibited", and ok to "active".

If you only see ok or "active", nothing is locked. ICANN's own page recommends asking your registrar to enact status restrictions to help prevent unauthorised changes.

If you want the longer story on transfer locks and auth codes, see the transfer lock and auth code guide. For UK domains and the move to RDAP, see the RDAP lookup guide.

Step 5: Turn on the locks you are missing

At your registrar, look in the domain settings for a transfer lock or domain lock setting and turn it on. On Cloudflare Registrar, for example, the lock sits under Manage Domains > Manage > Configuration, according to Cloudflare's transfer-out guide. Then check Step 4 again: you should now see clientTransferProhibited.

The update lock, clientUpdateProhibited, is less often a self-service toggle. If you cannot find it, open a ticket with your registrar and ask for it by its exact name. It blocks your own changes too, so you will ask for it to be lifted before you change nameservers.

For a high-value domain there is a stronger option. ICANN notes that some registry operators offer a Registry Lock service, which lets you set the server-level codes through your registrar as extra protection against unauthorised changes. The trade-off is time: ICANN says removing a server status can take longer than removing the matching client status, because your registrar has to ask the registry to lift it.

Quick tip: in one ticket, ask whether they set clientUpdateProhibited on request, whether your registry offers Registry Lock through them, and how long lifting each lock takes.

Step 6: Harden the account that controls the domain

A lock that anyone with your password can switch off is only half a lock. While you are logged in to your registrar, check these settings:

  • Two-factor authentication is turned on for every user who can log in
  • The account email is one you still read, on a different domain from the one you are protecting
  • Old team members and old API keys are removed
  • Any change notifications or login alerts your registrar offers are switched on

Why the email point matters: if your account email is admin@example.com and example.com is hijacked, password resets go to the attacker.

Step 7: Look at who changed what in your DNS provider

If your DNS is hosted at Cloudflare, open the Audit Logs page in the dashboard. Cloudflare's audit log documentation says you can search by user email or domain, filter by date range and click Download CSV. Logs are kept for 18 months, and Enterprise customers can use Logpush to store them for longer.

Scan recent weeks for logins and changes nobody on your team made. The page does not list every DNS event, so a clean log is not proof of no change; the daily baseline check is the check that matters.

Heads up: at the time of writing (8 November 2026), Cloudflare's list of available notifications has no alert for DNS record changes or nameserver changes. The DNS entries on that list are about Secondary DNS zone transfers. So do not expect an email from Cloudflare when a record changes. The daily script below fills that gap.

For records inside your zone that point at things you no longer use, see the dangling DNS cleanup guide.

Set up a daily homemade nameserver check

This part is my own design, not an official tool from any registrar or registry. It uses only dig options from the official dig manual, plus standard shell tools. It asks a parent zone server every day which nameservers it hands out for your domain and compares the answer with the baseline you saved.

Step 1: Save the script

This is the complete script. Save it as ns-watch.sh in a bin folder in your home directory on any Linux server or Mac that has dig.

#!/usr/bin/env bash
# ns-watch.sh: homemade check that your domain's delegation has not changed.
# Usage: ns-watch.sh example.com [parent-zone]
set -u

DOMAIN="${1:?Usage: ns-watch.sh example.com [parent-zone]}"
PARENT_ZONE="${2:-${DOMAIN#*.}}"
BASELINE="$HOME/.ns-watch/$DOMAIN.expected"
mkdir -p "$HOME/.ns-watch"

# 1. Find one server for the parent zone (for example a .com server).
PARENT_NS=$(dig +short "$PARENT_ZONE." NS | head -n 1)
if [ -z "$PARENT_NS" ]; then
  echo "ERROR: could not find nameservers for $PARENT_ZONE"
  exit 2
fi

# 2. Ask that server directly, without recursion, which nameservers it hands out.
CURRENT=$(dig +norecurse +noall +answer +authority @"$PARENT_NS" "$DOMAIN" NS \
  | awk -v d="$DOMAIN." 'tolower($1) == tolower(d) && $4 == "NS" {print tolower($5)}' \
  | sort -u)
if [ -z "$CURRENT" ]; then
  echo "ERROR: $PARENT_NS returned no NS records for $DOMAIN"
  exit 2
fi

# 3. First run: save what you see as the known good list.
if [ ! -f "$BASELINE" ]; then
  printf '%s\n' "$CURRENT" > "$BASELINE"
  echo "Baseline saved for $DOMAIN:"
  cat "$BASELINE"
  exit 0
fi

# 4. Later runs: compare and shout if anything changed.
if [ "$CURRENT" = "$(cat "$BASELINE")" ]; then
  # Stay silent when QUIET=1, so cron only mails you when something is wrong.
  [ "${QUIET:-0}" = "1" ] || echo "OK: $DOMAIN nameservers match the baseline"
  exit 0
fi

echo "ALERT: nameservers for $DOMAIN changed"
echo "Expected:"
cat "$BASELINE"
echo "Now seen at $PARENT_NS:"
printf '%s\n' "$CURRENT"
exit 1

The script exits with 0 when all is well, 1 when the nameservers changed and 2 when it could not get an answer.

Step 2: Make it executable and save the baseline

This command makes the script runnable and then runs it once for your domain.

chmod +x ~/bin/ns-watch.sh && ~/bin/ns-watch.sh example.com

You should see "Baseline saved for example.com" followed by your nameservers. Compare that list with the one you wrote down in Step 1 of the drill. If they do not match, do not keep this baseline: delete the file in ~/.ns-watch/ and find out why first.

For a domain under a two-part extension such as example.co.uk, the default parent guess is already co.uk. You can also pass the parent zone as a second argument, like ~/bin/ns-watch.sh example.co.uk co.uk.

Step 3: Schedule it with cron

Cron runs commands on a timetable, and by default it emails any output to the crontab owner, or to the address in MAILTO. With QUIET=1, the script prints nothing on a good day, so you only get mail when there is a problem.

Open your crontab with crontab -e and add these two lines. They send any output to your address and run the check every day at 07:17.

MAILTO=you@example.com
17 7 * * * QUIET=1 $HOME/bin/ns-watch.sh example.com

The five time fields are minute, hour, day of month, month and day of week.

Heads up: cron can only email you if the server can send mail. Test it once by putting a wrong name in your baseline file, waiting for the next run, then restoring the file.

Imagine a made-up example

Imagine a made-up example: Priya runs a small online shop on example.com. Her nameservers are two Cloudflare names. On a Tuesday night someone phishes her registrar password, logs in and swaps the nameservers for two names she has never seen.

Her site still loads for her, because her resolver has the old answer cached. But at 07:17 the next morning her server emails her: "ALERT: nameservers for example.com changed", with the two strange names under "Now seen at". She knows within hours, and she knows exactly what to tell her registrar.

How to check it worked

Run these checks after the drill and after any change at your registrar:

  • dig +short example.com NS returns only your baseline nameservers
  • The parent server check from Step 3 of the drill lists the same names
  • The ICANN Lookup result for your domain shows clientTransferProhibited or "client transfer prohibited" in the status field
  • If you asked for it, the status also shows clientUpdateProhibited
  • Running ~/bin/ns-watch.sh example.com by hand prints "OK: example.com nameservers match the baseline"
  • Editing the baseline file to a wrong name makes the next run print "ALERT" and exit with code 1 (check with echo $?), then you restore the file

Troubleshooting

dig: command not found

Symptom: the shell says dig: command not found. Cause: the DNS tools are not installed. Fix: on Debian or Ubuntu install the bind9-dnsutils package (dnsutils on older releases), or run the checks from a server that already has dig.

ERROR: could not find nameservers for com

Symptom: the script stops at step 1. Cause: the server cannot resolve anything, often because outbound DNS is blocked or /etc/resolv.conf points at a dead resolver. Fix: run dig +short com. NS by hand. If that is empty too, fix the server's DNS settings or firewall first.

ERROR: the parent server returned no NS records

Symptom: the script reaches the parent server but gets nothing back. Cause: the parent zone guess is wrong, for example a subdomain was passed instead of the registered domain. Fix: pass the registered domain only, and give the parent zone as the second argument if your extension has more than one part.

The drill shows different names in Step 2 and Step 3

Symptom: dig +short shows your old nameservers, but the parent server shows new ones, or the other way round. Cause: caching. Resolvers keep answers for the time-to-live (TTL) of the record, so they can lag behind the parent. Fix: trust the parent zone answer. If it shows names you did not set, treat it as an incident. If you changed nameservers yourself recently, wait for caches to expire.

The lock toggle is on, but the status still says ok

Symptom: your registrar shows the lock as enabled, yet ICANN Lookup shows only ok or "active". Cause: the change has not reached the registry yet, or the lookup result is cached. Fix: check again later, and if nothing changes, send your registrar a screenshot of both screens.

Cron never emails me

Symptom: the script works by hand, but no mail ever arrives. Cause: the server has no working mail setup, or MAILTO is empty. Fix: check that MAILTO is set to a real address, then test sending mail from the server. If mail is not an option, send the output to a log file and have your existing monitoring watch for the word "ALERT".

If the drill finds a real hijack

First, contact your registrar's abuse or security team with the exact output from the parent server check. That output is your evidence.

Then think about visitors. The CircleID report notes that cached DNS answers may keep sending visitors to the bad destination for a while. So even after the fix, some people may still see the bad site for a while.

The Relevant Audience report on the DebugBear case listed cleanup steps for site owners who loaded the affected script. They suit most compromises:

  1. Remove the affected script or embed from templates, plugins and tag managers, clear cached pages and confirm it no longer loads.
  2. Invalidate sessions and reset passwords, starting with administrators, and revoke any API credentials that may have been exposed.
  3. Check for unauthorised changes such as new accounts, permission changes and injected scripts, and compare against a known clean version.
  4. Review logs for unusual logins, new accounts, changed files and unexpected transactions during the exposure window.
  5. If a compromise is confirmed, put the site behind a static maintenance page that returns HTTP 503, then clean it or restore a known clean backup before relaunching.

The same report makes a point worth remembering: removing a bad tag prevents new loads, but it does not reverse actions already taken.

The one message worth forwarding

Copy this to whoever manages your domain, whether that is a developer, your host or your boss:

"Hi, could you help me lock down example.com? Please (1) confirm our nameservers at the registrar match our real DNS provider, (2) make sure clientTransferProhibited is set and ask the registrar whether clientUpdateProhibited and Registry Lock are available, (3) check that two-factor authentication is on for every registrar login and that the account email is not on example.com, and (4) set up a daily check that compares the NS records at the parent zone with our known good list and emails us if they change. Thanks."

Your domain is only as safe as the record at the registry, so check that record directly, lock it, and let a small script watch it every day.

Reader questions

Who sets the clientTransferProhibited status on my domain?

Your registrar sets the client status codes, including clientTransferProhibited, clientUpdateProhibited and clientDeleteProhibited. Server status codes are set by the registry and take precedence over client codes.

What does the ok status mean on a domain?

ICANN describes ok as the standard status, with no pending operations or prohibitions. In RDAP output it appears as active, which means no lock codes are set.

Is Registry Lock available for every domain?

No. ICANN says some registry operators offer a Registry Lock service through registrars, so ask your registrar whether your extension supports it.

Why does removing a registry level lock take longer?

For a server status, your registrar has to pass the request to the registry and wait for it to lift the restriction. ICANN notes this can take longer than removing a client status.

Does Cloudflare send an alert when a DNS record changes?

At the time of writing (8 November 2026), Cloudflare's list of available notifications has no DNS record change or nameserver change alert. Its DNS notifications cover Secondary DNS zone transfers.

How long does Cloudflare keep audit logs?

Cloudflare says audit logs are retained for 18 months. Enterprise customers can use Logpush to store them for longer.

Can visitors still reach a hijacked site after the domain is recovered?

Yes, for a while. A CircleID report notes that cached DNS answers may keep sending visitors to the bad destination after a hijack is fixed.

Sources & further reading

  1. ICANN: EPP status codes, what do they mean and why should I know?
  2. ICANN: Registration Data Access Protocol (RDAP)
  3. ICANN Lookup
  4. Ubuntu manpage: dig(1)
  5. Ubuntu manpage: crontab(5)
  6. Cloudflare: Review audit logs
  7. Cloudflare: Available notifications
  8. Cloudflare Registrar: Transfer domain from Cloudflare to another registrar
  9. CircleID: DNS hijacking campaign targets 12 cryptocurrency sites (report)
  10. Relevant Audience: DebugBear DNS hijack and malicious RUM script (report)

Originally published . About our editorial updates.

Your next project deserves a better foundation.

Explore hosting built for your next chapter.

Explore hosting

Find your next answer.

Search published guides and articles.

Ctrl / ⌘ K to open · Esc to close