Skip to content

Commit 2445c1f

Browse files
author
Brent Cook
committed
Land rapid7#6012, Use SSLVerifyMode and SSLCipher from the Exploit::Remote::Tcp
2 parents 5a7ac8c + 40cb136 commit 2445c1f

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed

lib/msf/core/exploit/tcp.rb

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def initialize(info = {})
6464
register_advanced_options(
6565
[
6666
OptBool.new('SSL', [ false, 'Negotiate SSL for outgoing connections', false]),
67-
OptEnum.new('SSLVersion', [ false, 'Specify the version of SSL that should be used', 'TLS1', ['SSL2', 'SSL3', 'TLS1']]),
67+
OptEnum.new('SSLVersion', [ false, 'Specify the version of SSL/TLS to be used (TLS and SSL23 are auto-negotiate)', 'TLS1', ['SSL2', 'SSL3', 'SSL23', 'TLS', 'TLS1', 'TLS1.1', 'TLS1.2']]),
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"']),
7070
Opt::Proxies,
@@ -100,15 +100,17 @@ def connect(global = true, opts={})
100100
end
101101

102102
nsock = Rex::Socket::Tcp.create(
103-
'PeerHost' => opts['RHOST'] || rhost,
104-
'PeerPort' => (opts['RPORT'] || rport).to_i,
105-
'LocalHost' => opts['CHOST'] || chost || "0.0.0.0",
106-
'LocalPort' => (opts['CPORT'] || cport || 0).to_i,
107-
'SSL' => dossl,
108-
'SSLVersion' => opts['SSLVersion'] || ssl_version,
109-
'Proxies' => proxies,
110-
'Timeout' => (opts['ConnectTimeout'] || connect_timeout || 10).to_i,
111-
'Context' =>
103+
'PeerHost' => opts['RHOST'] || rhost,
104+
'PeerPort' => (opts['RPORT'] || rport).to_i,
105+
'LocalHost' => opts['CHOST'] || chost || "0.0.0.0",
106+
'LocalPort' => (opts['CPORT'] || cport || 0).to_i,
107+
'SSL' => dossl,
108+
'SSLVersion' => opts['SSLVersion'] || ssl_version,
109+
'SSLVerifyMode' => opts['SSLVerifyMode'] || ssl_verify_mode,
110+
'SSLCipher' => opts['SSLCipher'] || ssl_cipher,
111+
'Proxies' => proxies,
112+
'Timeout' => (opts['ConnectTimeout'] || connect_timeout || 10).to_i,
113+
'Context' =>
112114
{
113115
'Msf' => framework,
114116
'MsfExploit' => self,
@@ -269,6 +271,20 @@ def connect_timeout
269271
datastore['ConnectTimeout']
270272
end
271273

274+
#
275+
# Returns the SSL certification verification mechanism
276+
#
277+
def ssl_verify_mode
278+
datastore['SSLVerifyMode']
279+
end
280+
281+
#
282+
# Returns the SSL cipher to use for the context
283+
#
284+
def ssl_cipher
285+
datastore['SSLCipher']
286+
end
287+
272288
protected
273289

274290
attr_accessor :sock

lib/rex/socket/ssl_tcp.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ def initsock(params = nil)
6464
case params.ssl_version
6565
when 'SSL2', :SSLv2
6666
version = :SSLv2
67-
when 'SSL23', :SSLv23
67+
# 'TLS' will be the new name for autonegotation with newer versions of OpenSSL
68+
when 'SSL23', :SSLv23, 'TLS'
6869
version = :SSLv23
6970
when 'SSL3', :SSLv3
7071
version = :SSLv3

0 commit comments

Comments
 (0)