DB-Owner
Last updated
Last updated
Login to WEB01
as the Administrator
user with password Welcome01!
.
Open "Microsoft SQL Server Management Studio"
3. Login with the sa
user using the password sa
or Password1!
(Depending if you changed it for another vulnerability)
4. Click “New Query” button and use the SQL query below to make Amsterdam\Richard
database owner of the production
database.
5. Change the Owner of the database to the SA account. Right click on "Production", click "Properties" and open the "Files" tab. Click on the "..." and fill in "sa" and click on "OK"
6. Execute the following query to make sure Amsterdam\Richard
is Database owner and the real Owner of the database is sa
:
7. Set the database as trustworthy and check if it is:
The 1
after Production
shows us that the database is ThrustWorthy
.
If the database is set as trustworthy and we have db_owner privileges, we could elevate our privileges and execute queries as sa.
Login to WS01
as Richard with the password Sample123
.
Download and start heidiSQL.
Click on "New" on the left bottom and configure the following settings:
Network Type: Microsoft SQL Server (TCP/IP)
Library: SQLOLEDB
Hostname / IP: WEB01.amsterdam.bank.local
Select: "Use Windows Authentication"
Port: 1433
4. Click "OK" on the security Issue warning.
5. Click on the "Query" tab and enter the following Query to check if we are db_owner
:
Our current user AMSTERDAM\richard
is db_owner.
6. Check who is the owner of the database.
sa
is the owner of the production
database.
6. Check if the database is set to trustworthy
The Production database is trustworty.
7. Create a stored procedure which will add AMSTERDAM\Richard
as sysadmin.
8. Execute the stored procedure:
9. Check if we are sysadmin:
The 1
means that we are sysadmin! Check the executing commands page under SQL Server Attacks to read how to execute cmd commands:
Login to WEB01 as Administrator, start the "Microsoft SQL Server Management Studio" and login as Administrator.
Execute the following query: