Skip to content

Commit

Permalink
Handle TLS handshake timeouts in SSLSocketConnection
Browse files Browse the repository at this point in the history
SSLSocketConnection prior to this commit would hang identifitly if a
timeout during the TLS handshake occurs. This can happen if a target
accepts a TCP connection but does not send any TLS handshake messages,
e.g. because of a bug triggered by the fuzzing.

This commit makes boofuzz observe timeouts during the TLS handshake. TLS
handshake timeouts are handled in the same way as timeouts during TCP
connection setup.
  • Loading branch information
constcast committed Apr 4, 2024
1 parent 0a6f247 commit 8617d45
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion boofuzz/connections/ssl_socket_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,21 @@ def open(self):
# No SSL context set
pass

super(SSLSocketConnection, self)._connect_socket()
# The wrapped SSL Socket does not have the timeout that is confiugred
# in BaseSocketConnection but needs the timeout to be configured
# through the SSLSocket class
self._sock.settimeout(self._recv_timeout)

try:
super(SSLSocketConnection, self)._connect_socket()
except TimeoutError as e:
# This TimeoutError is raised by the SSL layer during the TLS
# handshake, e.g. when the TCP connection could be established
# but the TLS handshakes times out. All other errors are handled
# by the parent class
raise exception.BoofuzzTargetConnectionFailedError(str(e))
else:
raise

def recv(self, max_bytes):
"""
Expand Down

0 comments on commit 8617d45

Please sign in to comment.