Skip to content

Comments

fix: prevent DeadlineExceeded from poisoning dial cache#529

Open
AuditeMarlow wants to merge 1 commit intoprojectdiscovery:mainfrom
guardian360:fix/dialwrap-deadline-exceeded-cache-poisoning
Open

fix: prevent DeadlineExceeded from poisoning dial cache#529
AuditeMarlow wants to merge 1 commit intoprojectdiscovery:mainfrom
guardian360:fix/dialwrap-deadline-exceeded-cache-poisoning

Conversation

@AuditeMarlow
Copy link

@AuditeMarlow AuditeMarlow commented Feb 10, 2026

Fixes #530

Problem

When a dial attempt fails due to a context deadline or cancellation (transient), dialAllParallel wraps it as ErrPortClosedOrFiltered (permanent). This poisons the shared dial cache — every subsequent connection to that host:port fails immediately for the rest of the scan, even with a fresh context.

Solution

Add context.DeadlineExceeded and context.Canceled guards at all three error-classification points in dialwrap.go so only genuine connection-refused errors are cached as permanent.

Summary

  • dialAllParallel line 277: filter DeadlineExceeded from the permanent-error bucket
  • dialAllParallel line 296: filter Canceled and DeadlineExceeded before wrapping as ErrPortClosedOrFiltered
  • DialContext line 156: treat DeadlineExceeded as transient (retry instead of returning cached error)

…rmanent error

dialAllParallel misclassified context.DeadlineExceeded (and in one path,
context.Canceled) as ErrPortClosedOrFiltered. This caused transient
timeouts to be cached as permanent failures, blocking all subsequent
connections to that host:port for the rest of the scan.

Add DeadlineExceeded and Canceled guards at all three classification
points in dialwrap.go so only genuine connection-refused errors are
treated as permanent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

context.DeadlineExceeded misclassified as ErrPortClosedOrFiltered, poisoning dial cache

1 participant