Skip to content

Commit fd232b1

Browse files
committed
Use the protocol version from the handshake
I used the protocol version from the record layer thinking I was using the protocol version from the handshake. This commit fix this and uses the protocol version from the handshake instead of from the record layer as in https://gist.github.com/rcvalle/10335282, which is how it should have been initially. Thanks to @wvu-r7 for finding this out!
1 parent 039946e commit fd232b1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

modules/auxiliary/server/openssl_heartbeat_client_memory.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def process_request(c)
128128

129129
# Process cleartext TLS messages
130130
def process_openssl_cleartext_request(c, data)
131-
message_type, message_version = data.unpack("Cn")
131+
message_type, message_version, protocol_version = data.unpack("Cn@9n")
132132

133133
if message_type == 0x15 and data.length >= 7
134134
message_level, message_reason = data[5,2].unpack("CC")
@@ -165,7 +165,7 @@ def process_openssl_cleartext_request(c, data)
165165
@state[c][:received_hello] = true
166166

167167
print_status("#{@state[c][:name]} Sending Server Hello...")
168-
openssl_send_server_hello(c, data, message_version)
168+
openssl_send_server_hello(c, data, protocol_version)
169169
return
170170
end
171171

@@ -196,7 +196,7 @@ def process_openssl_cleartext_request(c, data)
196196
else
197197
# Send heartbeat requests
198198
if @state[c][:heartbeats].length < heartbeat_limit
199-
openssl_send_heartbeat(c, message_version)
199+
openssl_send_heartbeat(c, protocol_version)
200200
end
201201

202202
# Process cleartext heartbeat replies
@@ -216,7 +216,7 @@ def process_openssl_cleartext_request(c, data)
216216

217217
# Process encrypted TLS messages
218218
def process_openssl_encrypted_request(c, data)
219-
message_type, message_version = data.unpack("Cn")
219+
message_type, message_version, protocol_version = data.unpack("Cn@9n")
220220

221221
return if @state[c][:shutdown]
222222
return unless data.length > 5
@@ -237,7 +237,7 @@ def process_openssl_encrypted_request(c, data)
237237

238238
# Send heartbeat requests
239239
if @state[c][:heartbeats].length < heartbeat_limit
240-
openssl_send_heartbeat(c, message_version)
240+
openssl_send_heartbeat(c, protocol_version)
241241
end
242242

243243
# Process heartbeat replies

0 commit comments

Comments
 (0)