Repository navigation
Description
Summary
-axfr already detects zones signed with plain NSEC and tells the user "anyone can list every name by walking it", but subenum cannot do that walk itself. Add an opt-in -nsec-walk that lists the zone from its NSEC chain, so a walkable zone gives every name for a few hundred queries instead of a wordlist brute force that can only find guessable names.
Where
internal/dns/nsec.go:29(DenialNSEC) andinternal/dns/nsec.go:38(ProbeDenial): detection onlyinternal/axfr/axfr.go:71-72(probeDenial): logs "Zone walkable: ... anyone can list every name by walking it" and stops theredocs/ROADMAP.md:34: "Walk NSEC-signed zones (-nsec-walk)" is listed under Later with no issue to track it
Details
probeDenial reports the finding and returns the denial type in axfr.Result.Denial. Nothing consumes it to collect names, so the run goes on to brute-force a zone whose full contents the user was just told are public.
Impact
For a plain-NSEC zone, a walk returns the complete name list, including names no wordlist or CT log would surface. It is also a one-query-per-name operation, far cheaper than a brute force. Users currently have to switch to a separate tool (ldns-walk, nsec-walker) and feed the result back with -seeds.
Suggested fix
- In
internal/dns, add a walker that starts at the apex and repeatedly asks an authoritative server (the oneProbeDenialsucceeded against) for a name just after the current owner with the DO bit set (for example\000.<owner>), reads the NSEC record from the authority section, and follows its Next Domain Name until it wraps back to the apex. Reuseexchange(nsec.go:89) for UDP with TCP fallback on truncation. - Gate it behind
-nsec-walk(implies the denial probe); only walk when the probe returnedDenialNSEC. Charge every query to-rate,-max-queriesand-max-duration, honour-exclude, and guard against loops (a repeated or non-increasing owner name ends the walk). - Feed the names into the candidate set with source
nsec, the same way-axfrnames are tagged (Record which source (wordlist, ct, wayback, axfr, permute) found each name #273), so they are still resolved and filtered. - Expose it in
pkg/subenumand the run-quality report next to the AXFR result. - Extend
internal/dnsserver'sReplyto serve NSEC records (the ROADMAP "Known limitations" section notes other types are not modelled yet), and add a lab scenario so the walk is testable offline.
Acceptance criteria
-
-nsec-walkagainst a lab zone signed with plain NSEC returns every name in the zone, tagged with sourcensec - Against an NSEC3 or unsigned zone it does nothing beyond the existing probe and says why
- The walk respects
-max-queries,-max-duration,-rateand-exclude, and terminates on a looping or malformed chain - Docs (
docs/cli.md, ROADMAP) updated
Getting started
- Relevant files:
internal/dns/nsec.go,internal/axfr/axfr.go,internal/dnsserver/,internal/labzone/ - How to run tests:
go test ./...(tests must stay hermetic: use the lab DNS server or-simulate, never a live domain) - Related: Cheap wins before brute-forcing: try AXFR and detect NSEC-walkable zones #85, Detect NSEC-walkable zones before brute-forcing #234, The library cannot try a zone transfer or report a walkable zone #314
Filed by repo-audit/feature-ideas at 090df0a. Severity: medium. Effort: L. audit-key: enhancement|internal/axfr/axfr.go|nsec-walk
Activity
TMHSDigital commentedon Nov 21, 2026
Fixed in e105aa3:
-nsec-walkruns the-axfrname-server lookup and DNSSEC probe and, only when the zone uses plain NSEC, walks the chain from the apex (\000.<owner>queries with DO set) and adds the names with sourcensec. NSEC3 or unsigned zones get a "not walking" line with the reason.The walk is paced by
-rate, capped by-max-queries(hard cap 10,000), stops at-max-duration, skips-excludesubtrees without querying under them, and ends on a non-increasing, repeated or out-of-zone next name. The-statsreport gainsnsec_names,nsec_foundandnsec_stop;pkg/subenumgainsZoneOptions.WalkNSECand anNSECWalksource. Lab 8 (examples/labs/lab8-nsec-walk.zone) uses the new$DNSSEC nsec|nsec3|nonelab directive.Verified with hermetic tests (
internal/dns/nsecwalk_test.go,internal/cli/nsecwalk_test.go,internal/labzone/dnssec_test.go,pkg/subenum/zone_test.go), golangci-lint v2.15.0, and green CI on main.Not included: an MCP tool argument for the walk.