Summary

This PR fixes the indefinite hang issue in tlsx when scanning targets with problematic TLS configurations. The bug occurred because cipher enumeration handshakes did not have proper timeout enforcement.

Changes

pkg/tlsx/ztls/ztls.go

  • Added context.WithTimeout for each cipher handshake in EnumerateCiphers
  • Ensures handshake respects the configured timeout option

pkg/tlsx/tls/tls.go

  • Changed from conn.Handshake() to conn.HandshakeContext(ctx) with timeout
  • Prevents indefinite blocking on stuck TLS connections

Root Cause

The original code used context.TODO() (no deadline) or direct Handshake() calls without timeout, causing tlsx to hang indefinitely when encountering hosts that do not respond properly during TLS negotiation.

Testing

The fix ensures that:

  1. Each cipher handshake respects the -timeout flag
  2. Stuck connections are properly terminated
  3. Long-running scans can complete without manual intervention

/claim #819

Fixes #819

Claim

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

Contributors

TI

tianlin-magi

@tele-he-gmail-com

100%

Sponsors

YO

youssefosama3820009-commits

@youssefosama3820009-commits

$1,224
PR

ProjectDiscovery

@projectdiscovery

$100