Proposed Changes

  • Fix ztls handshake timeout logic by running Handshake() in a goroutine and selecting on context timeout.
  • Close TLS connection on timeout to unblock stuck handshakes.
  • Replace context.TODO() with timeout context in ztls cipher enumeration.
  • Use HandshakeContext(ctx) with timeout in ctls cipher enumeration instead of bare Handshake().

Why

  • Issue #819 reports indefinite hangs for some hosts during long runs.
  • Existing ztls timeout path could still block because Handshake() was evaluated synchronously in the select send expression.
  • Cipher-enum paths had missing timeout contexts.

How to verify

  1. Run package compile smoke tests:
    • go test ./pkg/tlsx/ztls ./pkg/tlsx/tls -run TestDoesNotExist
  2. Reproduce with unresponsive hosts / slow TLS endpoints and observe scanner no longer hangs indefinitely in handshake/cipher enum paths.

Proof

  • Compile/test smoke:
    • ok github.com/projectdiscovery/tlsx/pkg/tlsx/ztls
    • ok github.com/projectdiscovery/tlsx/pkg/tlsx/tls

Notes

  • Full upstream tests currently fail in this environment on pre-existing TLS test behavior unrelated to these changes.

/claim #819

Claim

Total prize pool $1,324
Total paid $0
Status Pending
Submitted February 20, 2026
Last updated February 20, 2026

Contributors

TY

tyeungchukong-gmail-com

@tyeungchukong-gmail-com

100%

Sponsors

YO

youssefosama3820009-commits

@youssefosama3820009-commits

$1,224
PR

ProjectDiscovery

@projectdiscovery

$100