HackTheBox : Timelapse Walkthrough

GrimTheRipper
7 min readJan 13, 2025

--

Operating System : Windows

Difficulty : Easy

First, let start reconnaissance all open ports on all the target system with nmap scan.

Interesting service.

  • kerberost : 88
  • ldap : 389
  • smb : 139,445
  • winrm (ssl) : 5986
All open ports.

Next, use the Nmap tool to scan the details of the services and versions on all open ports. You will find that the LDAP service points to the domain: timelapse.htb.

Nmap scan detail of open ports.

Add the target machine’s IP address (10.10.11.152) and domain (timelapse.htb) to the /etc/hosts file

Add ipaddress and domain to /etc/hosts file.

Next, use the smbclient tool to enumerate the SMB service. You will discover a ‘Shares’ folder that stands out and is not part of the default shared folders.

Found Shares folder of smb service.

Use the smbmap tool to check the permissions of the ‘Shares’ folder with the guest user, and you will find that it has read-only access.

Shares folder has read-only permission.

Next, use the smbclient tool to connect to the SMB service at the ‘Shares’ folder. Upon further enumeration, you will find the winrm_backup.zip file in the dev directory. Then, download the winrm_backup.zip file to the attacker’s machine.

Found winrm_backup.zip in smb service.
Download winrm_backup.zip to attacker machine.

Use the unzip tool to extract the winrm_backup.zip file, and you will find that a password is required to open the file.

winrm_backup.zip require password.

Next, proceed to crack the password of the winrm_backup.zip file. Start by using the zip2john tool to extract the hash from the password-protected ZIP file. Then, use this hash to crack the password using the dictionary attack technique.

zip2john for get hash from winrm_bakup.zip file.

The hash extracted from the winrm_backup.zip file.

The hash from winrm_backup.zip file.

Next, use the John the Ripper tool to crack the password using the rockyou.txt wordlist. You will find that the password is successfully cracked.

Password is successfully cracked.

Use the obtained password to extract the contents of winrm_backup.zip, which will yield the legacyy_dev_auth.pfx file, a file used for authentication with the WinRM service.

Extract winrm_backup.zip successfully.

Attempt to open the legacyy_dev_auth.pfx file, and you will find that a password is required to access the file

Password is required.

Next, use the pfx2john tool to extract the hash from the password-protected PFX file. Then, use this hash to crack the password using the dictionary attack technique.

pfx2john for get hash from legacyy_dev_auth.pfx.

Next, use the John the Ripper tool to crack the password using the rockyou.txt wordlist. You will find that the password is successfully cracked.

Password is successfully cracked.

Next, use the obtained password to open the legacyy_dev_auth.pfx file.

Open legacyy_dev_auth.pfx with password.

Inside the legacyy_dev_auth.pfx file, you will find the private key and certificate file used for authentication with the WinRM service.

Private key and cert in legacyy_dev_auth.pfx file.

Next, convert the data from the legacyy_dev_auth.pfx file into priv.pem and cert.crt using the OpenSSL command. If prompted for a password, use the same password that was used to open the legacyy_dev_auth.pfx file.

openssl pkcs12 -in legacyy_dev_auth.pfx -nocerts -out priv.pem
Private key file.
openssl pkcs12 -in legacyy_dev_auth.pfx -clcerts -nokeys -out cert.crt
Certificate file.

Next, copy the priv.pem file to a new file named private.key and use the Nano editor to modify the file, ensuring that it contains only the private key content.

New private key (private.key) file.

Similarly, copy the cert.crt file to a new file named cert.cert and use the Nano editor to modify the file, ensuring that it contains only the certificate content.

New certificate (cert.cert) file.

Next, use the OpenSSL command to convert the private.key file so that it no longer requires a password for authentication (as the password would be repeatedly requested during the WinRM connection and usage). If prompted for a password, use the same password that was set when converting the legacyy_dev_auth.pfx file.

openssl rsa -in private.key -out priv-nopass.key
New private key (priv-nopass.key) file without password.

Next, use the Evil-WinRM (SSL) tool to connect to the target machine using the private key and certificate files.

evil-winrm -i timelapse.htb -S -k priv-nopass.key -c cert.crt
Access to the target with legacyy user successfully.

Read the user flag from the user.txt file.

User flag : user.txt

Next, upload the winPEASx64.exe tool to the target machine to perform local enumeration and gather information for privilege escalation.

Upload winPEASx64.exe to the target successfully.

Execute the winPEASx64.exe on the target machine.

Execute the winPEASx64.exe

The results from using the winPEASx64.exe tool revealed the ConsoleHost_history.txt file, which appears to be of interest.

ConsoleHost_history.txt

Upon viewing the contents of the ConsoleHost_history.txt file, you will find the credentials (username and password) for the user svc_deploy.

svc_deploy user credential.

Next, use the netexec tool to test access to the target machine using the credentials of the user svc_deploy. You will find that the connection is successful, and you have gained access to the target machine (Pwn3d!).

Test access to the target machine successfully with svc_deploy credential (Pwn3d!).

Next, use the Evil-WinRM tool along with the credentials (username and password) of the user svc_deploy to connect to the target machine. You will find that the connection to the target machine is successful.

Access the target machine successfully with svc_deploy credential.

Next, check the user’s permissions and groups. It was found that the user svc_deploy belongs to the LAPS_Readers group, which has the ability to read LAPS files.

LAPS (Local Administrator Password Solution) is a tool developed by Microsoft to enhance the security of managing local administrator account passwords on Windows operating systems, particularly in environments with multiple machines, such as in organizations.

svc_deploy user is group member of LAPS_Readers.

By reading the LAPS data, the password for the Administrator account will be revealed. (When this password expires, LAPS will automatically change it.)

Get-ADComputer -Identiry 'dc01' -property 'ms-mcs-admpwd'
Password of Administrator in LAPS.

Next, use the netexec tool to test access to the target machine using the Administrator’s password. It was found that the connection was successful, and access to the target machine was achieved (Pwn3d!).

Test access to the target machine successfully with Administrator password (Pwn3d!).

Next, use the Evil-WinRM tool to connect to the target machine with the Administrator account, and you will find that the connection is successful.

Access the target machine successfully with Administrator.

Next, search for the root flag (root.txt) and find it located in the Desktop directory of the user TRX.

Get-ChildItem -Path C:\ -Recurse -Filter "root.txt" -File -ErrorAction Silentlycontinue
Find root flog (root.txt).

Read the root flag from the root.txt file.

Root flag : root.txt

--

--

GrimTheRipper
GrimTheRipper

Written by GrimTheRipper

You get the best out of others when you give the best of yourself

No responses yet