Skip to content

Commit 039946e

Browse files
committed
Use the first cipher suite sent by the client
If encrypted, use the TLS_RSA_WITH_AES_128_CBC_SHA; otherwise, use the first cipher suite sent by the client. This complements the last commit and makes this module work with SSLv3, TLSv1.0, TLSv1.1, and TLSv1.2 when NEGOTIATE_TLS is not enabled (see https://gist.github.com/rcvalle/10335282).
1 parent b95fcb9 commit 039946e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

modules/auxiliary/server/openssl_heartbeat_client_memory.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,14 @@ def on_client_close(c)
300300
# Send an OpenSSL Server Hello response
301301
def openssl_send_server_hello(c, hello, version)
302302

303+
# If encrypted, use the TLS_RSA_WITH_AES_128_CBC_SHA; otherwise, use the
304+
# first cipher suite sent by the client.
305+
if @state[c][:encrypted]
306+
cipher = "\x00\x2F"
307+
else
308+
cipher = hello[46, 2]
309+
end
310+
303311
# Create the Server Hello response
304312
extensions =
305313
"\x00\x0f\x00\x01\x01" # Heartbeat
@@ -308,7 +316,7 @@ def openssl_send_server_hello(c, hello, version)
308316
[version].pack('n') + # Use the protocol version sent by the client.
309317
@state[c][:server_random] + # Random (Timestamp + Random Bytes)
310318
"\x00" + # Session ID
311-
"\x00\x2F" + # Cipher ID (TLS_RSA_WITH_AES_128_CBC_SHA)
319+
cipher + # Cipher ID (TLS_RSA_WITH_AES_128_CBC_SHA)
312320
"\x00" + # Compression Method (none)
313321
[extensions.length].pack('n') + extensions
314322

0 commit comments

Comments
 (0)