MSSQL
Connection
We can use Impacket to connect to a MSSQL server:
$ mssqlclient.py sql_dev@10.129.43.30 -windows-authimpacket-mssqlclient PublicUser:GuestUserCantWrite1@escapeEnumeration
Who Are We
# Get the SQL login
# The variable SYSTEM_USER contains the name of the SQL login for the current session
SQL> SELECT SYSTEM_USER;
# Database user we mapped to
SQL> SELECT USER_NAME();
# If we are memeber of role
SQL> SELECT IS_SRVROLEMEMBER('public');
# Windows user
SQL> SELECT suser_name();What Can We Do
Accounts
System Information
Attacks
UNC Path Injection
We can force the MSSQL server to authenticate with a SMB share we control to capture the NTLM authentication messages and crack it later.
Related HackTheBox machines include:
Last updated