Skip to content

Commit 000d310

Browse files
committed
MSSQL auto auth should look at the domain
If the domain is set, using NTLM where the domain is used, otherwise use plaintext / sql authentiction.
1 parent ebc7000 commit 000d310

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

lib/metasploit/framework/login_scanner/mssql.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ class MSSQL
1616
include Metasploit::Framework::LoginScanner::NTLM
1717

1818
DEFAULT_PORT = 1433
19-
DEFAULT_REALM = 'WORKSTATION'
19+
DEFAULT_REALM = nil
2020
# Lifted from lib/msf/core/exploit/mssql.rb
2121
LIKELY_PORTS = [ 1433, 1434, 1435, 14330, 2533, 9152, 2638 ]
2222
# Lifted from lib/msf/core/exploit/mssql.rb
2323
LIKELY_SERVICE_NAMES = [ 'ms-sql-s', 'ms-sql2000', 'sybase', 'mssql' ]
2424
PRIVATE_TYPES = [ :password, :ntlm_hash ]
25-
REALM_KEY = Metasploit::Model::Realm::Key::ACTIVE_DIRECTORY_DOMAIN
25+
REALM_KEY = Metasploit::Model::Realm::Key::ACTIVE_DIRECTORY_DOMAIN
2626

2727
# @!attribute auth
2828
# @return [Array<String>] Auth The Authentication mechanism to use

lib/msf/core/auxiliary/auth_brute.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ def build_brute_message(host_ip,host_port,proto,msg)
729729
else
730730
complete_message = ''
731731
unless ip.blank? && port.blank?
732-
complete_message << "#{ip}:#{port}"
732+
complete_message << Rex::Socket.to_authority(ip, port).ljust(21)
733733
else
734734
complete_message << proto || 'Bruteforce'
735735
end

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def initialize(info = {})
4444
OptPath.new('HEX2BINARY', [ false, "The path to the hex2binary script on the disk",
4545
File.join(Msf::Config.data_directory, "exploits", "mssql", "h2b")
4646
]),
47-
OptString.new('DOMAIN', [ true, 'The domain to use for windows authentication', 'WORKSTATION'], aliases: ['MssqlDomain']),
47+
OptString.new('DOMAIN', [ true, 'The domain to use for windows authentication', ''], aliases: ['MssqlDomain']),
4848
*kerberos_storage_options(protocol: 'Mssql'),
4949
*kerberos_auth_options(protocol: 'Mssql', auth_methods: Msf::Exploit::Remote::AuthOption::MSSQL_OPTIONS),
5050
], Msf::Exploit::Remote::MSSQL)

lib/msf/core/optional_session/mssql.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def initialize(info = {})
2626
register_options(
2727
[
2828
Msf::OptInt.new('SESSION', [ false, 'The session to run this module on' ]),
29-
Msf::OptString.new('DATABASE', [ false, 'The database to authenticate against', 'MSSQL']),
30-
Msf::OptString.new('USERNAME', [ false, 'The username to authenticate as', 'MSSQL']),
29+
Msf::OptString.new('DATABASE', [ false, 'The database to authenticate against', '']),
30+
Msf::OptString.new('USERNAME', [ false, 'The username to authenticate as', 'sa']),
3131
Msf::Opt::RHOST(nil, false),
3232
Msf::Opt::RPORT(1433, false)
3333
]

0 commit comments

Comments
 (0)