Abuse Info
Scott Sutherland from NetSPI has authored PowerUpSQL, a PowerShell Toolkit for Attacking SQL Server. Major contributors include Antti Rantasaari, Eric Gruber, and Thomas Elling. Before executing any of the below commands, download PowerUpSQL and load it into your PowerShell instance. Get PowerUpSQL here: https://github.com/NetSPI/PowerUpSQL Finding Data Get a list of databases, sizes, and encryption status:- Create a custom extended stored procedure:
- Host the test.dll on a share readable by the SQL Server service account:
- Run extended stored procedure:
- Remove extended stored procedure:
Opsec Considerations
Prior to executing operating system commands through SQL Server, review the audit configuration and choose a command execution method that is not being monitored. View audits:Edge Schema
Source: User, Group, ComputerDestination: Computer
Traversable: Yes
References
- https://github.com/NetSPI/PowerUpSQL/wiki
- https://www.slideshare.net/nullbind/powerupsql-2018-blackhat-usa-arsenal-presentation
- https://sqlwiki.netspi.com/attackQueries/executingOSCommands/#sqlserver
- https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/configure-windows-service-accounts-and-permissions?view=sql-server-2017
- https://blog.netspi.com/finding-sensitive-data-domain-sql-servers-using-powerupsql/