Hackthebox.eu - Retired - Bastion
Recon
As always I start with just a simple up/down scan on all TCP ports to see what is open.
$ nmap -T4 -p- -oX ./nmapb.xml bastion.htb
Then I convert that to HTML to make it pretty
That is a lot of open ports lets scan again with the -A switch on just the open ports
$ nmap -T4 -A -p22,135,139,445,5985,47001,49664,49665,49666,49667,49668,49669,49670 -oX ./nmapf.xml bastion.htb
Then I convert that to HTML too
$ xsltproc ./nmapf.xml -o ./nmapf.html
So Let's look.
Looks like we have a windows box with openssh on port 22 netbios/smb on139/445 and winRM on the rest of the open ports
No website to attack.. That's different.
Lets see what shares are on
$ smbclient -L \\bastion.htb
Cool we can see some shares with an anonymous connection
$ smbclient -L \\bastion.htb
Let's see if we can connect to any of them. Backups sounds tasty let's try that first
Cool
We get a nice note about the VPN link being slow in note.txt
Sysadmins: please don't transfer the entire backup file locally, the VPN to the subsidiary office is too slow.
Under Windows image backup there is a folder that looks like the backup for a computer called
L4mpje-pc
Exploit
I started to use mget to download the file but that was going to take forever.. That note we found might actually be for us to think of a different way to look at the backup file
I thought about it for a bit and decided to just mount the share to my local box to look at the files
I created a folder name mount
/Desktop/HTB/bastion/mount$ sudo mount -t cifs //bastion.htb/Backups ./ -o user=""
And mounted the drive
Here is a blog that walks you through the process
Once I had the VHD loaded I poked around for any interesting files and didn't find anything.. So I decided to grab the sam and security files to see if we can break the hashes.
These are the windows equivalent of the passwd and shadow files in Linux systems.
They hold the hashes for the user accounts on a windows box. Normally they are protected and you can't access them while the machine is running, but they are easy to steal from a VHD.
You can get them from the \windows\system32\config folder
I just copied them to my working folder on my local machine
cp ./SAM /home/circusmonkey/Desktop/HTB/bastion/
cp SYSTEM /home/circusmonkey/Desktop/HTB/bastion/
I then used sam2dump to write them to another file, this process is similar to combining the passwd and shadow files before you throw them at your favorite cracker.
Sam2dump Security Sam > hashes.txt
I chose hashcat to try and break the hash
$ hashcat -m 1000 -a 0 /home/circusmonkey/Desktop/HTB/bastion/hash.txt /home/circusmonkey/rockyou.txt --force
Pretty quickly we got this result
bureaulampje
Cool so
username: l4mpje
Password: bureaulampje
Let's see if we can ssh with these creds
We got a shell!!!
We got the user hash
Doing simple enumeration after this part leads us to a program installed called mRemoteNG
Which is a tabbed connection manager for RDP,SSH and other protocols.
One of the features it allows for within the program is the saving of credentials. You know, so you don't have to actually type in your password when connecting to services.
The passwords are saved in a XML file called confCons.xml located in ther user appdata roaming folder…
I wonder if there is one present on this system?
Good news everybody
Let's check it out
This looks like a saved connection credentials for RDP to the local machine as the administrator account….
I found a bunch of blog posts online about how to try and decrypt this. They all seemed like a lot of work :)
I found another post about how from the gui for the program you can basically just echo out the save credential… that is the route I'm going to try
I just need to install the program, copy over the xml and out should pop the administrator password.
I had a bunch of errors with the way the xml copied and pasted over to my windows VM. I had to correct a bunch of added spacing but eventually I got it to load the XML… I also only copied over the connection for the Administrator RDP session.
Then I created the external tool mentioned in the blog to echo out the password.
Then just a simple right click on the dc
External tools and New external tool
What is most likely the administrator password
thXLHM96BeKL0ER2
Yes it was
Let's get that hash
administrator@BASTION C:\Users\Administrator\Desktop>type root.txt
9588***********************************
Bye-Bye Everybody
Comments
Post a Comment