Skip to content

No reverse DNS: add an opt-in PTR pass over found addresses #436

Closed

Description

@TMHSDigital

Summary

subenum never asks reverse DNS. The addresses it finds often sit in ranges where the owner publishes PTR records under the target domain (host-12.dc1.example.com), which is a cheap, keyless source of names no wordlist will guess. Add an opt-in reverse pass over the found addresses.

Where

  • No PTR query or LookupAddr call exists anywhere under internal/ or pkg/.
  • internal/candidates/candidates.go:17: the candidate sources (wordlist, axfr, permute, plus passive ct/wayback)
  • internal/dns/scope.go:50 (InternalScope): addresses are already classified per result, so private/loopback ones can be skipped.

Details

Results carry their A/AAAA values (internal/dns/resolver.go:23), but nothing turns them back into names. Tools in the same space treat a reverse sweep as a standard enumeration step.

Impact

Users mapping an organisation's own hosting miss hostnames that are only discoverable through PTR. This matters most for on-prem and self-hosted ranges, where brute-forcing is weakest.

Suggested fix

  • -ptr (default off): after the main pass, take the unique public A/AAAA values of found names (skipping internal_address ones and wildcard fingerprints) and query PTR for each.
  • Optional -ptr-neighbours N: also query the N addresses on each side of every IPv4 hit, capped so a /24 costs at most 256 queries per range. IPv6 stays exact-match only.
  • PTR names under the target and in scope become candidates with source ptr, are then resolved forward like any candidate (so a stale PTR is not reported as existing), and count toward -rate, -max-queries and -stats.

Trade-offs: neighbour sweeps send traffic to address space the user may not own. Keep it opt-in, document it next to -exclude, and skip ranges that belong to shared CDNs or clouds (a forward-confirmed PTR under the target is still safe to report).

Acceptance criteria

  • With a dnstest server that answers PTR, a name only reachable through PTR is reported with source ptr after forward confirmation.
  • Without -ptr, query counts are unchanged.
  • PTR queries respect -rate, budgets and -exclude, and appear in -stats.

Getting started

  • Relevant files: internal/dns/resolver.go, internal/candidates/candidates.go, internal/cli/permute.go (pattern for a follow-up pass), internal/dnsserver (to add PTR answers for tests; see docs/ROADMAP.md "Known limitations")
  • How to run tests: go test ./...

Filed by repo-audit/feature-ideas at 090df0a. Severity: low. Effort: M. audit-key: enhancement|internal/candidates/candidates.go|ptr-sweep

Activity

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

    @TMHSDigital
    OwnerAuthor

    Implemented in 2fb80e4.

    What changed

    • New -ptr flag (off by default). After the main pass and any -permute pass, each target's unique public A/AAAA values get one PTR query. internal_address ones (private, loopback, link-local, CGNAT) and addresses from the wildcard fingerprint are skipped.
    • PTR names under the target and in scope, minus wordlist entries and names already found, are scanned as a flat pass of their own. Each is resolved forward, so a stale PTR is not reported. Hits carry sources: ["ptr"].
    • PTR queries are paced by -rate (and by -rate-per-resolver through -r) and stop when -max-duration runs out. A reverse name that -exclude rules out (for example *.2.0.192.in-addr.arpa) is never queried, and at most -max-queries addresses are asked. The name pass gets its own -max-queries budget, as the -permute pass does and as -nsec-walk treats its walk.
    • -stats adds ptr_addresses, ptr_queries, ptr_names and ptr_found, and queries_sent includes the PTR queries and the name pass. Without -ptr, no PTR query is sent and counts are unchanged.
    • A resumed run restores -ptr hits with their source and keeps them out of the -permute seeds. Its PTR lookups start over rather than picking up where the stopped run left off.
    • internal/dnsserver answers PTR (Reply.PTR). Lab scenarios take <address> PTR <host> lines.
    • Docs: flags table, README, output reference and both JSON schemas, labs format, ROADMAP known limitations, ARCHITECTURE file list, CHANGELOG.

    Verification

    • TestE2EPTR uses a local dnstest server. It checks that a PTR-only name is reported with source ptr after forward confirmation, that a stale PTR name is not reported, and the -stats counts. It also checks that private addresses and off-target or excluded names are never queried, that an excluded reverse zone gets no PTR query, that -max-queries 1 caps the PTR queries, and that a run without -ptr sends no PTR query.
    • TestPTRResume, TestPTRAddresses, TestLookupPTR, TestReverseName and TestPTRRecords (lab zones) cover the rest.
    • gofmt, go vet, golangci-lint v2.15.0, go test -shuffle=on ./... and go mod tidy -diff all pass locally. The Go CI run on the commit passed.

    Left out

    • The optional -ptr-neighbours N sweep. It sends traffic to address space the user may not own, so it needs an owner decision first.
    • pkg/subenum and subenum mcp don't expose -ptr. The library has no follow-up passes.
    • -rate is not checked by timing in a test. The PTR lookups use the same rate limiter and per-query accounting as the scan's lookups.
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: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions