Skip to content

Commit d7712d8

Browse files
committed
Separate SSL and SRVSSL options for client and server connections
1 parent 3547984 commit d7712d8

File tree

58 files changed

+101
-106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+101
-106
lines changed

documentation/modules/auxiliary/server/capture/ftp.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ This module creates a mock FTP server which accepts credentials before throwing
1919
* `Serv-U FTP Server v15.0 ready...`
2020
* `ProFTPD 1.3.4a Server (FTP-Server)`
2121

22-
### SSL
22+
### SRVSSL
2323

24-
Boolean if SSL should be used, making this FTPS. FTPS is typically run on port 990. If `SSLCert` is not set, a certificate
25-
will be automatically generated. Default is `False`.
24+
Boolean if SSL/TLS should be used for the server, making this FTPS. FTPS is typically run on port 990. If `SSLCert` is not set,
25+
a certificate will be automatically generated. Default is `False`. Note: This option is separate from the `SSL` option which
26+
controls client connections.
2627

2728
### SSLCert
2829

@@ -147,8 +148,8 @@ mVuIIRbrDW/sOgu2Viis
147148
msf > use auxiliary/server/capture/ftp
148149
msf auxiliary(server/capture/ftp) > set srvport 990
149150
srvport => 990
150-
msf auxiliary(server/capture/ftp) > set ssl true
151-
ssl => true
151+
msf auxiliary(server/capture/ftp) > set srvssl true
152+
srvssl => true
152153
msf auxiliary(server/capture/ftp) > set sslcert /root/metasploit-framework/selfsigned.pem
153154
sslcert => /root/metasploit-framework/selfsigned.pem
154155
msf auxiliary(server/capture/ftp) > run

documentation/modules/auxiliary/server/capture/http_basic.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ This module creates a mock web server which, utilizing a HTTP 401 response, prom
2323

2424
After the user enters a set of credentials, their browser will be redirected to this address. Default is ``.
2525

26-
### SSL
26+
### SRVSSL
2727

28-
Boolean if SSL should be used, making this HTTPS. HTTPS is typically run on port 443. If `SSLCert` is not set, a certificate
29-
will be automatically generated. Default is `False`.
28+
Boolean if SSL/TLS should be used for the server, making this HTTPS. HTTPS is typically run on port 443. If `SSLCert` is not set,
29+
a certificate will be automatically generated. Default is `False`. Note: This option is separate from the `SSL` option which
30+
controls client connections.
3031

3132
### SSLCert
3233

@@ -156,8 +157,8 @@ Oj6N43ld9EONST6BhP3v1buoWHi1FMouocrUkUDuahiHoLlK4ERSUrb4uNnwko24
156157
WdNCCmA8APA1qf2BYVqs
157158
-----END CERTIFICATE-----
158159
msf > use auxiliary/server/capture/http_basic
159-
msf auxiliary(server/capture/http_basic) > set ssl true
160-
ssl => true
160+
msf auxiliary(server/capture/http_basic) > set srvssl true
161+
srvssl => true
161162
msf auxiliary(server/capture/http_basic) > set srvport 443
162163
srvport => 443
163164
msf auxiliary(server/capture/http_basic) > set sslcert /root/metasploit-framework/selfsigned.pem

documentation/modules/auxiliary/server/capture/imap.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ This module creates a mock IMAP server which accepts credentials.
2020
* `The Microsoft Exchange IMAP4 service is ready.`
2121
* `Microsoft Exchange Server 2003 IMAP4rev1 server versino 6.5.7638.1 (domain.local) ready.`
2222

23-
### SSL
23+
### SRVSSL
2424

25-
Boolean if SSL should be used, making this Secure IMAP. Secure IMAP is typically run on port 993. If `SSLCert` is not set, a certificate
26-
will be automatically generated. Default is `False`.
25+
Boolean if SSL/TLS should be used for the server, making this Secure IMAP. Secure IMAP is typically run on port 993.
26+
If `SSLCert` is not set, a certificate will be automatically generated. Default is `False`. Note: This option is separate
27+
from the `SSL` option which controls client connections.
2728

2829
### SSLCert
2930

@@ -144,8 +145,8 @@ l/m7Kka0n7lXnKo+IFSJ0dTooBvwaV7+4tEGuHxWJsNO+2aex9qFCuDUdBFxyWyK
144145
uBVlsY6F7EjTfWpxwyVP
145146
-----END CERTIFICATE-----
146147
msf > use auxiliary/server/capture/imap
147-
msf auxiliary(server/capture/imap) > set ssl true
148-
ssl => true
148+
msf auxiliary(server/capture/imap) > set srvssl true
149+
srvssl => true
149150
msf auxiliary(server/capture/imap) > set sslcert /root/metasploit-framework/selfsigned.pem
150151
sslcert => /root/metasploit-framework/selfsigned.pem
151152
msf auxiliary(server/capture/imap) > set srvport 993

documentation/modules/auxiliary/server/capture/mysql.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ This module creates a mock MySQL server which accepts credentials. Upon receivi
2424

2525
The MySQL version to print in the login banner. Default is `5.5.16`.
2626

27-
### SSL
27+
### SRVSSL
2828

29-
Boolean if SSL should be used. Default is `False`.
29+
Boolean if SSL/TLS should be used for the server. Default is `False`. Note: This option is separate from the `SSL` option which controls client connections.
3030

3131
### SSLCert
3232

documentation/modules/auxiliary/server/capture/postgresql.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ This module creates a mock PostgreSQL server which accepts credentials. Upon re
99

1010
## Options
1111

12-
### SSL
12+
### SRVSSL
1313

14-
Boolean if SSL should be used. Default is `False`.
14+
Boolean if SSL/TLS should be used for the server. Default is `False`. Note: This option is separate from the `SSL` option which controls client connections.
1515

1616
### SSLCert
1717

documentation/modules/auxiliary/server/capture/telnet.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ This module creates a mock telnet server which accepts credentials. Upon receiv
1212

1313
The Banner which should be displayed. Default is empty, which will display `Welcome`.
1414

15-
### SSL
15+
### SRVSSL
1616

17-
Boolean if SSL should be used. Default is `False`.
17+
Boolean if SSL/TLS should be used for the server. Default is `False`. Note: This option is separate from the `SSL` option which controls client connections.
1818

1919
### SSLCert
2020

documentation/modules/auxiliary/server/capture/vnc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ This module creates a mock VNC server which accepts credentials. Upon receiving
1616

1717
Write a file containing a John the Ripper format for cracking the credentials. Default is ``.
1818

19-
### SSL
19+
### SRVSSL
2020

21-
Boolean if SSL should be used. Default is `False`.
21+
Boolean if SSL/TLS should be used for the server. Default is `False`. Note: This option is separate from the `SSL` option which controls client connections.
2222

2323
### SSLCert
2424

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

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,23 @@ def check_dependencies
111111
# ServerPort => Override the server port to listen on (default to SRVPORT).
112112
# Uri => The URI to handle and the associated procedure to call.
113113
#
114-
#
115-
# TODO: This must be able to take an SSL parameter and not rely
116-
# completely on the datastore. (See dlink_upnp_exec_noauth)
114+
# SSL configuration for the server is controlled by the SRVSSL datastore option
115+
# (separate from SSL which is used for client connections). The ssl() method
116+
# returns the SRVSSL value, ensuring server and client SSL are independent.
117+
# If opts['Ssl'] is provided, it will override the SRVSSL datastore option.
117118
def start_service(opts = {})
118119

119-
# Keep compatibility with modules that don't pass the ssl option to the start server but rely on the datastore instead.
120-
opts['ssl'] = opts['ssl'].nil? ? datastore['SSL'] : opts['ssl']
121-
122120
check_dependencies
123121

122+
# Use opts['Ssl'] if provided, otherwise use the SRVSSL datastore option
123+
server_ssl = opts.has_key?('Ssl') ? opts['Ssl'] : ssl
124+
124125
# Start a new HTTP server service.
125126
self.service = Rex::ServiceManager.start(
126127
Rex::Proto::Http::Server,
127128
(opts['ServerPort'] || bindport).to_i,
128129
opts['ServerHost'] || bindhost,
129-
opts['ssl'],
130+
server_ssl,
130131
{
131132
'Msf' => framework,
132133
'MsfExploit' => self,
@@ -152,7 +153,7 @@ def start_service(opts = {})
152153
'Path' => opts['Path'] || resource_uri
153154
}.update(opts['Uri'] || {})
154155

155-
proto = (opts['ssl'] ? "https" : "http")
156+
proto = (server_ssl ? "https" : "http")
156157

157158
# SSLCompression may or may not actually be available. For example, on
158159
# Ubuntu, it's disabled by default, unless the correct environment
@@ -437,7 +438,8 @@ def get_uri(cli=self.cli)
437438
# The resource won't exist until the server is started
438439
return unless resource
439440

440-
ssl = !!(datastore["SSL"])
441+
# Use ssl() method which returns SRVSSL (separate from SSL for client connections)
442+
ssl = !!ssl()
441443
proto = (ssl ? "https://" : "http://")
442444
if datastore['URIHOST']
443445
host = datastore['URIHOST']

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def initialize(info = {})
2020
[
2121
OptAddressLocal.new('SRVHOST', [ true, 'The local host or network interface to listen on. This must be an address on the local machine or 0.0.0.0 to listen on all addresses.', '0.0.0.0' ]),
2222
OptPort.new('SRVPORT', [ true, "The local port to listen on.", 8080 ]),
23+
OptBool.new('SRVSSL', [ false, 'Negotiate SSL/TLS for the server (overrides SSL option for server-side connections)', false])
2324

2425
], Msf::Exploit::Remote::SocketServer
2526
)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def initialize(info = {})
1818

1919
register_options(
2020
[
21-
OptBool.new('SSL', [ false, 'Negotiate SSL for incoming connections', false]),
2221
# SSLVersion is currently unsupported for TCP servers (only supported by clients at the moment)
2322
OptPath.new('SSLCert', [ false, 'Path to a custom SSL certificate (default is randomly generated)'])
2423
], Msf::Exploit::Remote::TcpServer
@@ -111,10 +110,11 @@ def start_service(opts = {})
111110
end
112111

113112
#
114-
# Returns the SSL option
113+
# Returns the SSL option for the server
114+
# Uses SRVSSL which is separate from the SSL option (for client connections)
115115
#
116116
def ssl
117-
datastore['SSL']
117+
datastore['SRVSSL']
118118
end
119119

120120
#

0 commit comments

Comments
 (0)