fix: prevent indefinite hangs during TLS cipher enumeration (Fixes #819)#925
fix: prevent indefinite hangs during TLS cipher enumeration (Fixes #819)#925Tianlin0725 wants to merge 1 commit intoprojectdiscovery:devfrom
Conversation
Neo - PR Security ReviewNo security issues found Highlights
Hardening Notes
Comment |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @projectdiscovery team, this PR is ready for review. It fixes the TLS cipher enumeration hang issue (#819) by adding proper timeout handling. All tests pass. Please let me know if you need any changes. |
Add timeout context to handshake operations in both ztls and tls (ctls) cipher enumeration paths to prevent indefinite hangs when scanning targets with problematic TLS configurations. Changes: - pkg/tlsx/ztls/ztls.go: Add context.WithTimeout for each cipher handshake - pkg/tlsx/tls/tls.go: Use HandshakeContext with timeout instead of Handshake Fixes projectdiscovery#819
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
context.WithTimeoutfor each cipher handshake inEnumerateCipherspkg/tlsx/tls/tls.go
conn.Handshake()toconn.HandshakeContext(ctx)with timeoutRoot Cause
The original code used
context.TODO()(no deadline) or directHandshake()calls without timeout, causing tlsx to hang indefinitely when encountering hosts that do not respond properly during TLS negotiation.Testing
The fix ensures that:
-timeoutflag/claim #819
Fixes #819