Skip to content

Walkable NSEC zones are detected but not walked; add -nsec-walk #437

Closed

Description

@TMHSDigital

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) and internal/dns/nsec.go:38 (ProbeDenial): detection only
  • internal/axfr/axfr.go:71-72 (probeDenial): logs "Zone walkable: ... anyone can list every name by walking it" and stops there
  • docs/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

  1. In internal/dns, add a walker that starts at the apex and repeatedly asks an authoritative server (the one ProbeDenial succeeded 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. Reuse exchange (nsec.go:89) for UDP with TCP fallback on truncation.
  2. Gate it behind -nsec-walk (implies the denial probe); only walk when the probe returned DenialNSEC. Charge every query to -rate, -max-queries and -max-duration, honour -exclude, and guard against loops (a repeated or non-increasing owner name ends the walk).
  3. Feed the names into the candidate set with source nsec, the same way -axfr names are tagged (Record which source (wordlist, ct, wayback, axfr, permute) found each name #273), so they are still resolved and filtered.
  4. Expose it in pkg/subenum and the run-quality report next to the AXFR result.
  5. Extend internal/dnsserver's Reply to 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-walk against a lab zone signed with plain NSEC returns every name in the zone, tagged with source nsec
  • Against an NSEC3 or unsigned zone it does nothing beyond the existing probe and says why
  • The walk respects -max-queries, -max-duration, -rate and -exclude, and terminates on a looping or malformed chain
  • Docs (docs/cli.md, ROADMAP) updated

Getting started


Filed by repo-audit/feature-ideas at 090df0a. Severity: medium. Effort: L. audit-key: enhancement|internal/axfr/axfr.go|nsec-walk

Activity

  1. added
    enhancement
    help wanted
    area: dns
    severity: medium
    on Nov 18, 2026
  2. TMHSDigital commented on Nov 21, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in e105aa3: -nsec-walk runs the -axfr name-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 source nsec. 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 -exclude subtrees without querying under them, and ends on a non-increasing, repeated or out-of-zone next name. The -stats report gains nsec_names, nsec_found and nsec_stop; pkg/subenum gains ZoneOptions.WalkNSEC and an NSECWalk source. Lab 8 (examples/labs/lab8-nsec-walk.zone) uses the new $DNSSEC nsec|nsec3|none lab 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: dnsenhancementhelp wantedseverity: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions