Skip to content

Commit 053f0e8

Browse files
authored
Merge pull request rapid7#20024 from cgranleese-r7/add-support-for-network-capture-decryption
Add support for network capture decryption
2 parents 9ef0f7b + c79f7db commit 053f0e8

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ GEM
427427
rex-core
428428
rex-struct2
429429
rex-text
430-
rex-core (0.1.32)
430+
rex-core (0.1.33)
431431
rex-encoder (0.1.8)
432432
metasm
433433
rex-arch
@@ -457,7 +457,7 @@ GEM
457457
metasm
458458
rex-core
459459
rex-text
460-
rex-socket (0.1.59)
460+
rex-socket (0.1.60)
461461
dnsruby
462462
rex-core
463463
rex-sslscan (0.1.11)

lib/msf/core/exploit/remote/http_client.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def initialize(info = {})
5050
OptBool.new('HttpTraceHeadersOnly', [false, 'Show HTTP headers only in HttpTrace', false]),
5151
OptString.new('HttpTraceColors', [false, 'HTTP request and response colors for HttpTrace (unset to disable)', 'red/blu']),
5252
OptString.new('SSLServerNameIndication', [ false, 'SSL/TLS Server Name Indication (SNI)', nil]),
53+
OptString.new('SSLKeyLogFile', [ false, 'The SSL key log file', ENV['SSLKeyLogFile']]),
5354
], self.class
5455
)
5556

@@ -167,7 +168,8 @@ def connect(opts={})
167168
client_username,
168169
client_password,
169170
comm: opts['comm'],
170-
subscriber: http_logger_subscriber
171+
subscriber: http_logger_subscriber,
172+
sslkeylogfile: sslkeylogfile
171173
)
172174

173175

@@ -701,6 +703,14 @@ def ssl_version
701703
datastore['SSLVersion']
702704
end
703705

706+
#
707+
# Returns the SSL key log file path
708+
#
709+
# @return [String]
710+
def sslkeylogfile
711+
datastore['SSLKeyLogFile']
712+
end
713+
704714
#
705715
# Returns the configured proxy list
706716
#

lib/msf/core/exploit/remote/tcp.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def initialize(info = {})
6767
Opt::SSLVersion,
6868
OptEnum.new('SSLVerifyMode', [ false, 'SSL verification method', 'PEER', %W{CLIENT_ONCE FAIL_IF_NO_PEER_CERT NONE PEER}]),
6969
OptString.new('SSLCipher', [ false, 'String for SSL cipher - "DHE-RSA-AES256-SHA" or "ADH"']),
70+
OptString.new('SSLKeyLogFile', [ false, 'The SSL key log file', ENV['SSLKeyLogFile']]),
7071
Opt::Proxies,
7172
Opt::CPORT,
7273
Opt::CHOST,
@@ -108,6 +109,7 @@ def connect(global = true, opts={})
108109
'SSL' => dossl,
109110
'SSLVersion' => opts['SSLVersion'] || ssl_version,
110111
'SSLVerifyMode' => opts['SSLVerifyMode'] || ssl_verify_mode,
112+
'SSLKeyLogFile' => opts['SSLKeyLogFile'] || sslkeylogfile,
111113
'SSLCipher' => opts['SSLCipher'] || ssl_cipher,
112114
'Proxies' => proxies,
113115
'Timeout' => (opts['ConnectTimeout'] || connect_timeout || 10).to_i,
@@ -315,6 +317,14 @@ def ssl_verify_mode
315317
datastore['SSLVerifyMode']
316318
end
317319

320+
#
321+
# Returns the SSL key log file path
322+
#
323+
# @return [String]
324+
def sslkeylogfile
325+
datastore['SSLKeyLogFile']
326+
end
327+
318328
#
319329
# Returns the SSL cipher to use for the context
320330
#

lib/rex/proto/http/client.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Client
2222
# @param http_trace_proc_request [Proc] A proc object passed to log HTTP requests if HTTP-Trace is set
2323
# @param http_trace_proc_response [Proc] A proc object passed to log HTTP responses if HTTP-Trace is set
2424
#
25-
def initialize(host, port = 80, context = {}, ssl = nil, ssl_version = nil, proxies = nil, username = '', password = '', kerberos_authenticator: nil, comm: nil, subscriber: nil)
25+
def initialize(host, port = 80, context = {}, ssl = nil, ssl_version = nil, proxies = nil, username = '', password = '', kerberos_authenticator: nil, comm: nil, subscriber: nil, sslkeylogfile: nil)
2626
self.hostname = host
2727
self.port = port.to_i
2828
self.context = context
@@ -34,6 +34,7 @@ def initialize(host, port = 80, context = {}, ssl = nil, ssl_version = nil, prox
3434
self.kerberos_authenticator = kerberos_authenticator
3535
self.comm = comm
3636
self.subscriber = subscriber || HttpSubscriber.new
37+
self.sslkeylogfile = sslkeylogfile
3738

3839
# Take ClientRequest's defaults, but override with our own
3940
self.config = Http::ClientRequest::DefaultConfig.merge({
@@ -183,6 +184,7 @@ def connect(t = -1)
183184
'Context' => context,
184185
'SSL' => ssl,
185186
'SSLVersion' => ssl_version,
187+
'SSLKeyLogFile' => sslkeylogfile,
186188
'Proxies' => proxies,
187189
'Timeout' => timeout,
188190
'Comm' => comm
@@ -729,6 +731,12 @@ def peerinfo
729731

730732
attr_accessor :hostname, :port # :nodoc:
731733

734+
#
735+
# The SSL key log file for the connected socket.
736+
#
737+
# @return [String]
738+
attr_accessor :sslkeylogfile
739+
732740
#
733741
# The established NTLM connection info
734742
#

0 commit comments

Comments
 (0)