Skip to content

DNS AXFR — confirm zone transfer is blocked

A name-server misconfig leaks AXFR to the internet — every subdomain, MX, TXT (including SPF/DKIM keys) is visible to attackers. Daily check with alert.

Recipe

bash
#!/usr/bin/env bash
DOMAIN="${1:-example.com}"
NS=$(dig +short NS "$DOMAIN" | head -1)
RESP=$(dig +short axfr "$DOMAIN" "@$NS" 2>&1)

if echo "$RESP" | grep -q "Transfer failed\|REFUSED\|NOTAUTH"; then
  echo "ok"
else
  if [ -n "$RESP" ] && [ "$(echo "$RESP" | wc -l)" -gt 1 ]; then
    echo "leak $(echo "$RESP" | wc -l) records visible from internet"
    exit 1
  fi
  echo "ok"
fi

Same thing in Enterno.io

Sanity check — our DNS tool already includes an AXFR probe. Wire this script up to a heartbeat and get a daily confirmation that zone-transfer stays blocked.

Set up DNS Lookup → ← All recipes

Related recipes