Rapid7 Vulnerability & Exploit Database

Microsoft SQL Server NTLM Stealer

Back to Search

Microsoft SQL Server NTLM Stealer

Created
05/30/2018

Description

This module can be used to help capture or relay the LM/NTLM credentials of the account running the remote SQL Server service. The module will use the supplied credentials to connect to the target SQL Server instance and execute the native "xp_dirtree" or "xp_fileexist" stored procedure. The stored procedures will then force the service account to authenticate to the system defined in the SMBProxy option. In order for the attack to be successful, the SMB capture or relay module must be running on the system defined as the SMBProxy. The database account used to connect to the database should only require the "PUBLIC" role to execute. Successful execution of this attack usually results in local administrative access to the Windows system. Specifically, this works great for relaying credentials between two SQL Servers using a shared service account to get shells. However, if the relay fails, then the LM hash can be reversed using the Halflm rainbow tables and john the ripper. Thanks to "Sh2kerr" who wrote the ora_ntlm_stealer for the inspiration.

Author(s)

  • nullbind <scott.sutherland@netspi.com>

Development

Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use auxiliary/admin/mssql/mssql_ntlm_stealer
msf auxiliary(mssql_ntlm_stealer) > show actions
    ...actions...
msf auxiliary(mssql_ntlm_stealer) > set ACTION < action-name >
msf auxiliary(mssql_ntlm_stealer) > show options
    ...show and set options...
msf auxiliary(mssql_ntlm_stealer) > run 

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security

;