Last updated
Last updated
Querier is a medium difficulty Windows box which has an Excel spreadsheet in a world-readable file share. The spreadsheet has macros, which connect to MSSQL server running on the box. The SQL server can be used to request a file through which NetNTLMv2 hashes can be leaked and cracked to recover the plaintext password. After logging in, PowerUp can be used to find Administrator credentials in a locally cached group policy file.
Scope
IP Address: 10.10.10.125
Nmap Scan
RPC Enumeration
SMB Enumeration
smbclient
managed to get results but CME
failed, The share Reports
is not standard share, So let's explore it
I mount the share to my kali machine to explore it easily
I searched online for this file extension, and I found that It's Excel file macros enabled which contain visual basic
script
I searched for a tool that can extract the script from xslm
file and a found this one:
The macros script simply has a connection string to connect to database and execute some SQL query
So, the credentials are reporting:PcwTWTHRwryjc$c6
, Let's connect to mssql database
Confirm access with CME
I tried these credentials against other protocols RPC
, SMB
but it didn't authenticate me although I have valid credentials
One possible attack from mssql is to connect to remote smb server and get the hash of the service account of the database.
Start smb server and wait for the hash
Crack with hashcat
Authenticate with this credentials MSSQL-SVC:corporate568
, I can see from CME
that we have admin privileges over mssql
instance
Connect to the database as that user
Confirm admin pivileges
I want to execute system command with xp_cmdshell
but I need to enable it first
User Flag: a113d259fb6b81c18xxxxxxxxxxxxxxxxxx
The service account mssql-svc
often has SeImpersonatePrivilege
& SeAssignPrimaryTokenPrivilege
privileges which can be used to escalate to SYSTEM
account
We can use RoguePotato
or PrintSpoofer
tools and nc.exe
to execute this attack
First download them to the windows machine
Execute PrintSpoofer.exe
with the following syntax and start nc
listener on kali machine to receive connection back
Root Flag: 42be413e54f4658662xxxxxxxxxxxxxx
Get a shell to easily explore the system for possible escalation paths
Download PowerUp.ps1
which search for misconfigurations and weaknesses on the system
I downloaded RunasCs.exe
tool to get a shell with another user - administrator
- in my case
And get a shell as admin
:)
Root Flag: 42be413e54f4658662xxxxxxxxxxxxxx