Repository navigation
Description
Summary
Names that the target's own DNS answers point at (CNAME, MX and NS targets inside the target domain) are written out as record values but never tested as candidates. A name like lb-7.int.example.com, reached only through app.example.com CNAME lb-7.int.example.com, is missed unless a wordlist happens to contain it. Add an opt-in follow-up pass that tests those in-scope targets.
Where
internal/dns/resolver.go:23(Record{Type, Value}): the values are kept on each result.internal/candidates/candidates.go:17(sourceswordlist,axfr,permute): nothing records-derived.internal/cli/permute.go:31(mainPassNames) andinternal/cli/permute.go:65(runPermutationPass): the existing follow-up pass that a records pass could mirror.
Details
Outside internal/dns and internal/output, the only code that reads Record.Value is the MCP report (internal/cli/mcp_report.go:89, :175), which formats it for display. No scan, candidate or permute code feeds a record value back into the candidate list, so in-scope hostnames that the zone itself names are reported as data and then dropped.
Impact
Users scanning with -type A,AAAA,CNAME (or MX/NS) see in-scope hostnames in the output that were never checked themselves, so their own records, takeover hints and internal-address flags are missing. These names are often the ones no wordlist contains (load balancers, per-region hosts, mail relays).
Suggested fix
- Add
-follow-records(default off, like-permute). After the main pass, collect the CNAME, MX and NS values of found names. Keep the ones that are under the target and not ruled out by-exclude. Drop names that were already candidates or found. - Scan them as a guarded pass, the way
runPermutationPassdoes (preflight, wildcard filtering,-rate,-max-queries,-max-duration), with a newrecordssource incandidatessosourcessays where each name came from. - Make the pass repeat to a small fixed depth (or until it finds nothing new), because a followed name can itself point at another in-scope name.
- Later, SPF
include:/a:/mx:hostnames from TXT records and SRV targets (Add SRV record lookups and opt-in service-name discovery (-srv) #419) could feed the same pass.
Open question: should the pass run by default when the type list already contains CNAME? Starting opt-in keeps query counts unchanged for existing users.
Acceptance criteria
- A lab or dnstest zone where
x CNAME y.targetandyis not in the wordlist: with the new flag,yis reported with sourcerecords; without the flag, output is unchanged. - Out-of-scope and
-excluded targets are never queried. - The pass counts toward
-max-queries/-max-duration, appears in-stats, and resumes correctly.
Getting started
- Relevant files:
internal/cli/permute.go,internal/candidates/candidates.go,internal/cli/session.go - How to run tests:
go test ./... - Related docs:
docs/cli.md, README "Finding more names"
Filed by repo-audit/feature-ideas at 090df0a. Severity: medium. Effort: M. audit-key: enhancement|internal/cli/permute.go|follow-record-targets
Activity
TMHSDigital commentedon Nov 19, 2026
Fixed in 7ea4e94 with
-follow-records, off by default. The open question resolved as opt-in, so query counts don't change for existing users.-excludeallows go to the dispatcher, the same way a found parent does under-recursive.-recursive.-max-queriesand-max-duration, so they show in the totals, the verdict andskipped_by_cap. Out-of-target and excluded targets are never queried.sources: ["records"], and-statscounts them per target asrecords_found. The-dry-runnotes mention the flag.pkg/subenumhasConfig.FollowRecords.include:hosts and SRV targets.-follow-recordsis now the place they could plug in.Verified with
go test ./...,-raceoninternal/scan, and golangci-lint v2.15.0. Tests cover target extraction (MX preference, scope, exclusions, dedupe), the dispatcher's queueing (candidates skipped, recursion not repeating a followed name, budget counting), an engine run following a CNAME chain against a local DNS server, and a CLI run with therecordssource,records_foundand an excluded MX target never asked. They also check that output without the flag is unchanged, and a resume that finds the target of a restored result.