Repository navigation
Description
Summary
A delegated subzone whose name servers are all gone is the most exploitable NS takeover case, and -type NS does not flag it. A recursive resolver usually answers SERVFAIL for such a name, and TakeoverHint only inspects NS records already in the result. Asking the parent zone's servers for the delegation would catch it.
Where
docs/ROADMAP.md:64-69(the known limitation)internal/dns/takeover.go:145-161(TakeoverHint/ dangling-NS check)
Details
ROADMAP: "A recursive resolver asked about a subzone whose every name server is gone usually answers SERVFAIL rather than the delegation, so such a name ends up inconclusive … instead of flagged." A SERVFAIL result never reaches the takeover check.
Impact
To find fully dangling delegations, users have to rescan by hand against the parent zone's authoritative server.
Suggested fix
When NS is in -type and a name ends in SERVFAIL:
- Look up the parent zone's name servers, with the code
-axfralready uses (internal/axfr). - Send them one non-recursive NS query for the name.
- If the referral's NS targets do not exist (NXDOMAIN through the trusted resolver), mark the name
dangling-ns.
Cache the parent's servers per zone, count the queries against -rate and -max-queries, and respect -exclude. Testing this needs referral support in internal/dnsserver (ROADMAP:58-63 says referrals are not modelled yet).
Open question: how should queries to the target's own name servers be paced?
Acceptance criteria
- A lab scenario with a fully dangling delegation is flagged
dangling-nsunder-type NS - The extra queries are paced and counted, and shown in the run-quality report
- ROADMAP updated
Getting started
- Relevant files:
internal/dns/takeover.go,internal/axfr,internal/dnsserver,docs/ROADMAP.md - Related: Support NS, MX and TXT record types with a dangling-NS takeover hint #194, Takeover check flags CNAME and NS targets that exist without addresses as dangling #362
Filed by repo-audit/full-audit at dd5b156. Severity: medium. Effort: L. audit-key: enhancement|internal/dns/takeover.go|DanglingNS
Activity
TMHSDigital commentedon Nov 21, 2026
Implemented in 4679596.
What changed
NSin-type, a name whose lookup ends SERVFAIL is asked of the target zone's own name servers, found with the-axfrlookup (nowaxfr.NameServers) once per target. The query is one NS query that does not ask for recursion (dns.AskDelegation). When the referral names name servers that do not exist (NXDOMAIN through the trusted resolver, through the existing takeover cache), the name is reported with those NS records and markeddangling-ns. Otherwise it stays inconclusive. A flagged name is not expanded by-recursive.-ratelimiter. They stop at-max-queries, which counts their own queries the same way-nsec-walkdoes, and at-max-duration. No query is sent for a name or name server that-excluderules out. They are counted inqueries_sentand in two new report fields,parent_checksandparent_queries(Stats.ParentChecks/Stats.ParentQueriesinpkg/subenum, plus a line in the text breakdown).internal/dnsservernow models referrals (Reply.Referral,Reply.ReferralZone,Query.Recursive). In a lab scenario, a delegation where none of the name servers has an address answers SERVFAIL to a recursive query and a referral to a non-recursive one. In lab mode the check goes to the lab server. The new Lab 9 (-simulate-zone lab9) practises this.Verification
TestAskDelegation*(dns),TestReferral(dnsserver),TestDanglingDelegation(labzone),TestDanglingDelegationAtParent,TestDelegationCheckMaxQueries,TestDelegationCheckWithoutNameServersandTestDelegationCheckNeedsNS(scan), andTestE2ELabDanglingDelegation(CLI, Lab 9 plus the-statsfields). With the check disabled, the scan and CLI tests fail, and so does the existingTestE2ELabDanglingNS.go test -shuffle=on ./...andgo mod tidy -diffall pass. CI is green.Not done
-retry-inconclusivepass is not checked.