Repository navigation
Description
Summary
Two resume bookkeeping errors in how names a resumed run finds again ("refound") are counted:
- The refound names' takeover, internal-address and partial-answer flags are counted twice.
- Names restored for one
-dLtarget are also suppressed for every later target.
Where
internal/cli/resume.go:148-165,185-192(withoutRepeat,withoutRefound)internal/cli/session.go:58,82(restoredmap, created once per session)internal/cli/session.go:587-591(emitResultdrops restored names)internal/cli/session.go:779-790,804-808internal/scan/runner.go:682-710(flags counted before the result is emitted)internal/report/report.go:126-130,internal/scan/verdict.go:38
Details
Flags counted twice. A resumed pass looks up again some names that the stopped run had already found: up to a chunk per worker past RootDone. scanState.report increments takeover, internal and partial (and the pool's poolHits/confirmed) for each of them. emitResult then drops the restored name and counts s.refound++. But withoutRefound subtracts the refound count only from Found, Processed, Total and Stats.Found, so the flags end up counted in both the saved part and the resumed part. A doubled Partial can also push the verdict from complete to degraded.
Restored names leak across targets. restored is created once per session (session.go:82) and only ever added to. With nested -dL targets (example.com, dev.example.com) and -recursive or multi-label entries, both targets can find api.dev.example.com. A resumed run reports that name only under the first target and lowers the second target's Found count by a refound that its own state never counted.
Impact
These only affect resumed runs. The report's takeover, internal and partial counts disagree with the result list and -sarif. Under -dL, results also differ depending on whether the run was resumed.
Steps to reproduce
- Flags: run
-type A,AAAA,CNAMEagainst a zone with takeover-prone CNAMEs past the first few hundred entries, press Ctrl+C after they were found, then run-resume … -stats s.json.takeover_candidatesins.jsonexceeds the number of hinted results. - Targets: make a
-dLfile withexample.comanddev.example.comand a wordlist withapiandapi.dev. Interrupt during the second target, then resume.api.dev.example.comis missing from the second target's results.
Suggested fix
- When
emitResultdrops a restored result, also count its Takeover, Internal and Partial flags, and subtract them inwithoutRefoundtogether with Found. Treat pool hit/confirmed the same way, or document that they count lookups. - Reset
s.restoredat the start of each target, beforerestoreTarget.
Acceptance criteria
- After a resume, takeover, internal and partial counts equal those of an uninterrupted run
- A resumed
-dLrun with nested targets reports the same names per target as an uninterrupted run - Tests for both in
internal/cli/resume_test.go, using a lab zone
Getting started
- Relevant files:
internal/cli/resume.go,internal/cli/session.go - How to run tests:
go test ./internal/cli/ -run Resume - Related: Resumed scans over-count found and processed for re-found names #156, Resume edge cases: multi-label parents, finished -dL targets, unretried names #315
Filed by repo-audit/full-audit at dd5b156. Severity: low. Effort: S. audit-key: bug|internal/cli/resume.go|withoutRefound
Activity
TMHSDigital commentedon Nov 18, 2026
Fixed in 16fdded.
refoundCount) and subtracted bywithoutRefoundtogether with the name. The pool's PoolHits/Confirmed count lookups, repeated ones included, and are left as they are; the function's comment now says so.-dLtarget is no longer dropped from a later nested target that finds it.Verified:
TestWithoutRefoundDropsFlagschecks the flag arithmetic;TestE2EResumeNestedTargetsKeepTheirNamesresumes a hand-built-dLstate (example.comdone,dev.example.comnot started) in simulate mode and fails without the reset (the second target lostapi.dev.example.comand reported found=1), passes with it. Full suite, vet and golangci-lint v2.15.0 pass; CI green.