MSSQL Attacks
Setup
Enumeration
Find MSSQL Servers via LDAP
ldapsearch (&(samAccountType=805306368)(servicePrincipalName=MSSQLSvc*)) --attributes name,samAccountName,servicePrincipalName
# Example output:
name: MSSQL Service
sAMAccountName: mssql_svc
servicePrincipalName: MSSQLSvc/ilf-db-1.inlanefreight.local:1433, MSSQLSvc/ilf-db-1.inlanefreight.local
retrieved 1 results totalServer Information
Impersonate User with Access
xp_cmdshell
Check if Enabled
Enable
Execute Commands
Disable (Cleanup)
OLE Automation Procedures
Check if Enabled
Enable
Execute Reverse Shell
Disable (Cleanup)
SQL CLR (Common Language Runtime)
Check if Enabled
Create CLR Assembly
Execute CLR DLL
Disable (Cleanup)
Linked Servers
Enumerate Links
Check Identity on Linked Server
Enable RPC for Linked Server
Execute CLR via Linked Server
SQL Server Privilege Escalation
Check Token Privileges
Find Writable Directory
Upload Payload
Execute SweetPotato
Quick Reference
Method
Output
Use Case
SQL-BOF Command
Description
Last updated