HackTheBox - Timelapse Writeup
Box author | ctrlzero
Nmap
Let’s scan the Ip address first, by using Nmap.
result
|
|
Oh wow! this is an active directory machine and that’s a lot of open ports. We also get the hostname called timelapse.htb
, let’s add it to the /etc/hosts
file.
SMB
In the result of the Nmap scan. I saw that ports 139
and 445
are open and it’s a default for SMB (Server Message Block)
. Let’s check the windows version using a tool called CrackMapExec.
CrackMapExec: SMB
The version of Windows currently using is Windows 10.0 Build 17763 x64
. So, this is not a new version of Windows, at the time writing this blog Windows 11 is already out.
SMBclient
Now, we already know that smb ports are open. Let’s try listing the shares by using smbclient
. Surprisingly, it doesn’t require authentication for it. I just press Enter
in the password prompt.
JohntheRipper: zip2john
After checking the all shares. I finally found something that looks interesting. I found the winrm_backup.zip
file in \Shares\Dev\
. Let’s download it, into our attack machine with the get command
. Now, it’s time to unzip the file. However, it is protected by a password and I don’t know, what the password is. So, I’m gonna run zip2john
to crack the zip file with rockyou.txt
as a wordlist.
*.PFX file
Finally, the wait pay off. We’ve got the password and it’s time to crack it open. Well, it just contains one file called legacyy_dev_auth.pfx
. I never heard of the extensions called pfx
before, and with quick googling. It says:
.pfx
file, which is in a PKCS#12
format, contains the SSL certificate (public keys) and the corresponding private keys.JohntheRipper: pfx2john
The pfx
file it’s just a binary that compiles with public and private keys. Now, what we need is, to extract the keys from it. I manage found an article that shows us 'How to extract it'
. Here’s the article. First, we need to extract the private key by using openssl
. Unfortunately, its needed the password. I already try the password that we found earlier and it doesn’t work. Now, I’m gonna run the file against pfx2john
to produce the hash and crack it with john
.
Extracting the cert from *.PFX file
Nice! we finally managed to retrieve the pfx
file password. Let’s try to extract the keys one more time. Here’s an article for reference. Let me breaks down into three parts real quick.
- The first command is basically to extract the encrypted private key
- Run the next following command to extract the certificate/public key
- The final command, it’s just decrypted the private key
NOTE: you will be prompted to type the import password. Type the password you found earlier by using pfx2john
Evil-WinRM: legacyy
Based on the zip file name 'winrm_backup.zip'
. I guess this might be something to do with winrm
, and the Nmap scan result also shows us that port 5986
is open.
Let’s try connecting to it with Evil-WinRM
and make sure to enable ssl
with the -S
tag. I’m gonna use the keys we discovered with -c
for the public key and -k
for a private key. Finally, I’m in as a legacyy
user.
Powershell History
So, I’ll try to run the winpeas
. Unfortunately, it doesn’t execute because the Anti-Virus
program managed to catch it and throws this error file contains a virus or potentially unwanted software
. Honestly, I am stuck on this machine. Then, I realized, I never check the powershell history
and I felt guilty because that file has always been ignored by me. To my surprise, I found something useful yet interesting in the powershell history
file.
|
|
Evil-WinRM: svc_deploy
Well, in the history
file contains svc_deploy
user credentials and lead us into port 5986
once again. Let’s connect to the machine as svc_deploy
user with the credentials we just found. Success!
Group: LAPS_Readers
Let’s check this user “background” with the net user
command. Turns out, this user is part of LAPS_Readers
Global Group memberships. Honestly, I didn’t even know what it is, but it sounds cool :p with a quick search on the net. It says:
Local Administrator Password Solution
(LAPS) provides management of local account passwords of domain-joined computers.
Passwords are stored in Active Directory (AD) and protected by ACL, so only eligible users can read them or request its reset.LDAPsearch
The excited part of it. We can read the password stored in Active Directory. The last time I checked, this is an AD machine. So, I manage to find an article that’s about credentials dumping. I already try used crackmapexec
and it just threw a bunch of errors at me. So, I end up using ldapsearch
. Let’s dump the administrator
credentials.
Evil-WinRM: administrator
We successfully retrieve the administrator
credentials. Let’s try connect to evil-winrm
.
*CHEF KISS* Beautiful