Skip to content

The library cannot try a zone transfer or report a walkable zone #314

Closed

Description

@TMHSDigital

Summary

-axfr and the NSEC denial probe live in package main and internal/, so users of pkg/subenum (and the MCP server built on it) cannot reach them.

Where

  • pkg/subenum/sources.go:15
  • pkg/subenum/sources.go:26
  • main_axfr.go:59
  • main_axfr.go:39
  • docs/library.md:111

Details

pkg/subenum offers two built-in sources, CertificateTransparency() and WaybackMachine() (sources.go:26-35); a search of the package's non-test files for axfr and nsec finds nothing. The CLI's -axfr lives in package main: zoneTransfer (main_axfr.go:59) calling dns.Transfer (main_axfr.go:111) and dns.ProbeDenial (main_axfr.go:39), both in internal/, so a library user cannot reach them. docs/library.md:9 says the library is "the same engine the command line runs". Since subenum mcp builds on subenum.Config (main_mcp.go:623), agents lack it too. Checked against #77, #85, #197, #234, #265 and the open list.

Impact

Embedders miss the cheapest win before brute force (a server that allows AXFR hands over the zone) and the NSEC-walkable signal, unless they reimplement AXFR.

Suggested fix

Export ZoneTransfer(opts) returning a Source whose Names resolves the NS set and tries AXFR with the CLI's limits (8 servers, 2 addresses each), plus a small ProbeZone(ctx, domain, resolver) (ZoneInfo{TransferAllowed []string, Denial string}, error) for the report fields. Move the shared logic from main_axfr.go into an internal package both call, as #265 did for passive sources. Trade-off: the Source doc says sources work "without querying the domain's DNS" (sources.go:12), so either reword it or keep AXFR as a separate Config.ZoneTransfer bool; transfers are not paced by Rate, which must be documented as it is for the CLI.

Acceptance criteria

  • pkg/subenum exposes a zone-transfer attempt with the CLI's limits
  • The CLI and the library share one implementation
  • docs/library.md documents it, including that transfers are not paced by Rate

Getting started

  • Relevant files: pkg/subenum/sources.go, main_axfr.go, docs/library.md
  • How to run tests: make test (or go test ./...). Tests must stay hermetic: use -simulate, -simulate-zone or the local DNS test server, never a live domain.
  • Related docs: docs/DEVELOPER_GUIDE.md, docs/ARCHITECTURE.md

Filed by repo-audit/full-audit at d0c56f0. Severity: medium. Effort: M. audit-key: enhancement|pkg/subenum/sources.go|ZoneTransfer

Activity

  1. added
    enhancement
    help wanted
    severity: medium
    on Nov 15, 2026
  2. TMHSDigital commented on Nov 15, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in c799597.

    pkg/subenum gains:

    • ProbeZone(ctx, domain, ZoneOptions) (ZoneInfo, error): asks the domain's name servers for a zone transfer and probes its denial proofs. ZoneInfo holds the transferred Names, TransferAllowed and Denial (nsec, nsec3 or none). A refused transfer is not an error; a failed name-server lookup or a cancelled context is.
    • ZoneTransfer(ZoneOptions) Source: the same transfer as a source for Config.Sources, so its names become candidates that are each verified by a lookup.

    The transfer code moved from the CLI into internal/axfr with the same limits (8 name servers, 2 addresses each); the CLI's -axfr messages are unchanged. docs/library.md has a new section, including that these queries go to the domain's own name servers and are not paced by Rate.

    Differences from the suggestion: ProbeZone takes a ZoneOptions (resolver and timeout) rather than a bare resolver, ZoneInfo also returns the names, and there is no Config.ZoneTransfer flag; ZoneTransfer() is used through Config.Sources.

    Verified with four new tests in pkg/subenum/zone_test.go against the in-process DNS server (allowed, refused, as a scan source, and error cases); the existing CLI AXFR tests pass unchanged. go test ./... and golangci-lint run pass.

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

    enhancementhelp wantedseverity: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions