mssql
Forest Trusts MSSQL Abuse
Methodology
Check the SPN's
Check which SPN's you have access to
Check the Privileges you have of the above filtered SPN's
Keep note of the Instance-Name, ServicePrincipalName and the DomainAccount-Name
If you find any service with higher privileges continue below to abuse it
Powershell
[!INFO] Remember to follow the Powershell methodology
PowerUpSQL
For MSSQL and PowerShell hackery, lets use PowerUpSQL
Import-Module .\PowerupSQL-master\PowerupSQL.psd1. Enumerate SPN
Get-SQLInstanceDomain2. Check Access
3. Check Privileges / Gather Infromation
MSSQL Database Links
Methodology
Check the SQL Server link
Keep note if you have link to any other database in DatabaseLinkName
If SysAdmin:0 means that we will not be allowed to enable xp_cmdshell
Keep on enumerating and check all the linked databases you have access to
Now we can try to execute commands through out all the linked databases found
Enumerate MSSQL links:
Crawl MSSQL links:
Execute command where xp_cmdshell enabled:
Reverse shell on specific MSSQL instance with disabled logging, AMSI bypass and powercat.ps1: https://github.com/besimorhino/powercat/blob/master/powercat.ps1
Enable RPC Out and xp_cmdshell:
Extra Commands
Impersonate an user
Basic SQL Server queries for DB enumeration
Also works with Get-SQLServerLinkCrawl
Last updated