Skip to content

-follow-records target swallows a later recursion candidate and blocks its expansion #481

Backlog

Description

@TMHSDigital

Summary

With -recursive -follow-records, a followed record target is dispatched at the depth limit and remembered in followSeen. If its parent is found later and expanded, the regular depth-N candidate for the same name is dropped, so the name's subtree is never enumerated. Whether it is depends on wordlist order.

Where

  • internal/scan/dispatcher.go:528 (followed job: depth: max(d.maxDepth, 1), "a target is tested, never expanded")
  • internal/scan/dispatcher.go:569-574 (depth > 1 candidate skipped when in followSeen)
  • internal/scan/dispatcher.go:747 (isCandidate checks only already-expanded parents)
  • internal/scan/runner.go:729 (j.depth < maxDepth gate)

Impact

If www (early in the list) has a CNAME to app.dev.example.com before dev is found, app.dev is tested once as a followed target and its later depth-2 candidate is discarded, so nothing below it is tried. The same scan with dev earlier in the wordlist expands it. This contradicts the README's "unless they are already candidates". The dropped candidate is also not counted.

Steps to reproduce

Lab zone with www CNAME app.dev, app.dev A, v1.app.dev A, dev A. Wordlist www, dev, app, v1, flags -recursive -depth 3 -follow-records. Expected v1.app.dev found; it is not. With the wordlist reordered to dev, www, app, v1, it is.

Suggested fix

When next() meets a depth-N candidate already in followSeen, expand it if the followed lookup found it, instead of dropping it. Or give a followed job its natural depth when it is a recursion candidate under a future parent. At minimum, count the dropped candidate.

Acceptance criteria

  • The repro finds v1.app.dev in both wordlist orders.

Getting started

  • Relevant files: internal/scan/dispatcher.go, internal/scan/dispatcher_test.go
  • How to run tests: go test ./internal/scan

Filed by repo-audit/full-audit at a45b999. Severity: low. Effort: M. audit-key: bug|internal/scan/dispatcher.go|follow

Activity

  1. added
    bug
    area: scan
    severity: low
    on Nov 29, 2026
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: scanbugseverity: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions