Skip to content

Add SRV record lookups and opt-in service-name discovery (-srv) #419

Closed

Description

@TMHSDigital

Summary

subenum cannot look up SRV records, so it misses service names such as _autodiscover._tcp, _sip._tls, _ldap._tcp or _xmpp-server._tcp. These names show which services an organisation runs, and a wordlist of host labels will never find them. Add opt-in SRV discovery that probes a short built-in list of _service._proto names under each target.

Where

  • internal/dns/resolver.go:39 (typeOrder = []string{"A", "AAAA", "CNAME", "NS", "MX", "TXT"})
  • internal/dns/resolver.go:120 (ParseTypes rejects any type outside typeOrder)
  • internal/dns/resolver.go:434 (lookupType, one case per supported type)
  • docs/ROADMAP.md:58 (the test DNS server models only A, AAAA, CNAME, NS, MX and TXT)

Details

-type SRV is rejected today with "unsupported record type", and tests pin that behaviour (internal/dns/simulate_test.go:71, pkg/subenum/subenum_test.go:341). Supporting the type alone would not help much: SRV records live at underscore names (_sip._tcp.example.com), and the wordlist validator and candidate generator are built for host labels. The feature needs a small candidate set of its own.

Suggested fix

  1. Add SRV to typeOrder and a case in lookupType using net.Resolver.LookupSRV, rendering records as priority weight port target.
  2. Add -srv (off by default): for each target, and optionally each found name, look up a built-in list of roughly 30 to 50 common _service._proto pairs. Ship it as an embedded data file next to data/wordlist.txt, and charge those queries to -max-queries and -rate like any other.
  3. Run SRV targets through the existing takeover check, since a dangling SRV target is the same class of risk as a dangling CNAME.
  4. Extend internal/dnsserver Reply with SRV answers, and add a lab zone so the feature can be tested hermetically.

Trade-offs: underscore labels must bypass the host-label validation in internal/validate only on this path, and -dry-run should count the extra queries.

Acceptance criteria

  • -type SRV is accepted, and SRV records appear in text (-show-records), JSON, JSONL and CSV output
  • -srv probes the built-in service list under each target and reports hits with sources: ["srv"]
  • -dry-run and -max-queries account for SRV probes
  • Hermetic tests against internal/dnstest with SRV answers
  • Documented in docs/cli.md and the flags table

Getting started

  • Relevant files: internal/dns/resolver.go, internal/dnsserver, internal/candidates/candidates.go, data/
  • How to run tests: go test ./...
  • Related docs: docs/ARCHITECTURE.md, docs/DEVELOPER_GUIDE.md

Filed by repo-audit/feature-ideas at dd5b156. Severity: medium. Effort: L. audit-key: enhancement|internal/dns/resolver.go|typeOrder-SRV

Activity

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

    @TMHSDigital
    OwnerAuthor

    First part done in e5435fc: -type SRV is accepted.

    • Each record reads <priority> <weight> <port> <target> and is sorted, since Go shuffles equal-priority records by weight. They appear in text (-show-records), JSON, JSONL and CSV.
    • The test DNS server (dnsserver.Reply.SRV) and lab zone files (<name> SRV <priority> <weight> <port> <host>) answer SRV, -simulate invents one, and pkg/subenum accepts "SRV".
    • Service names already pass the wordlist validator, so -w with _sip._tcp and -type SRV finds them today. I checked this end to end against a lab zone.
    • Tests: TestResolveSRV (dnstest) and TestAnswerSRV (lab zones), plus parse errors.

    Still open: -srv, the opt-in pass that probes a built-in list of _service._proto names with sources: ["srv"] and is counted in -dry-run and -max-queries; and running SRV targets through the takeover check.

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: dnsenhancementseverity: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions