[1433] MSSQL
dbeaver GUI
To install dbeaver using a Debian package we can download the release .deb package from https://github.com/dbeaver/dbeaver/releases and execute the following command:
Intrusionz3r0X@htb[/htb]$ sudo dpkg -i dbeaver-<version>.deb]
Intrusionz3r0X@htb[/htb]$ dbeaver &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.
Basic Enumeration
MSSQLPWNER tool
Advance Enumeration and techniques
Enable XP_CMDSHELL
Write Files
Read Local Files
Capture NTLMv2 Hash
Impersonate Users
Linked Servers exploitation on MSSQL
Cross Forest SQL Server Links Abuse
Exploitation on Windows
Exploitation on Linux
Trustworthy Databases
If our user hasn't been granted remote login permissions as a sysadmin (sa), but instead has been provided public privileges as a local SQL User.we can pursue a strategy to enumerate trusted databases on the targeted linked server. Our objective would be to determine if the user holds the db_owner role for any trusted database. If such a database is identified, we can create a stored procedure to enable xp_cmdshell, ensuring it executes under the context of the OWNER, which typically would be the sa user.
Requirements
Identified a trustworthy database
Confirmed that our current user login name
Confirm our current user has db_owner privileges roles on database
Verify owner database is SA
Enumerate Trustworthy Databases
Exploitation on Windows
Exploitation on Linux
Last updated