Fuse HTB Walkthrough

Oct 18, 2024    #box   #htb   #medium   #windows   #active-directory   #ldap   #seloaddriverprivilege   #rpc   #capcom  

Fuse Hack The Box Walkthrough/Writeup:

How I use variables & Wordlists:

1. Enumeration:

NMAP:

LDAP 389:

Using LDAP anonymous bind to enumerate further:

DNS 53:

Kerberos 88:

Using Kerbrute to bruteforce Usernames:

RPC:

SMB 445:

Attempting to connect with NULL & Guest sessions:

Trying Usernames as Passwords:

HTTP 80:

Discovering Usernames in the CSV Entries:

Discovering their may be an issue with the printing service in the CSV entries:

Directory Busting With FFUF:

Fuzzing for more CSV’s with FFUF:

Finding a password in the Printer Logs:

Changing the expired password:

Attempt 1: Trying to change the expired password using smbpasswd.py:

Attempt 2: Trying to change the password using powershell:

][this article]] which details the change via powershell. It’s worth a shot:

Attempt 3: Finally changing a password with smbpasswd.py:

Preparing commands to access SMB:

Downloading the entire print$ share:

BrandNewPassword69!181128!!!!!

Searching for more information in the pillaged smb files:

Trying to dump user information via ldapsearch:

Enumerating using rpcclient:

Finding a hard-coded clear text credential a printer description:

2. Foothold:

Enumerating as svc-print:

Running a bloodhound collection:

Connecting to the host using evil-winrm:

3. Privilege Escalation:

Finding out we have the SeLoadDriverPrivilege privilege:

Checking the system is vulnerable to the exploit:

SeLoadDriverPrivilege Explained:

4. Ownership:

Capcom.sys Driver Vulnerability: Arbitrary Code Execution with SYSTEM Privileges

Overview of the Capcom.sys Vulnerability:

Download A Copy of the official Capcom.sys Driver:

Compiling the EopLoadDriver tool to enable us to load the Capcom.sys driver:

The EopLoadDriver tool is a utility designed to leverage the SeLoadDriverPrivilege for loading a driver into the Windows kernel. It interacts with the Windows registry to register the driver and then uses the NtLoadDriver system call to load it. This tool is essential in our exploit chain as it allows us to load the vulnerable Capcom.sys driver, which we’ll subsequently exploit to gain SYSTEM privileges. By using EopLoadDriver, we’re able to bridge the gap between having the SeLoadDriverPrivilege and actually loading a driver of our choice into the kernel.

Preparing the EopLoadDriver ~C++ Project:

Importing the EopLoadDriver code & Compiling:

Compiling the ExploitCapcom exploit C++ project:

The ExploitCapcom tool is the core component of our privilege escalation attack. It’s designed to exploit the vulnerability in the Capcom.sys driver that we’ve loaded using EopLoadDriver. This tool takes advantage of the driver’s ability to disable Supervisor Mode Execution Prevention (SMEP) and execute arbitrary code in kernel mode. By default, ExploitCapcom opens a new command prompt with SYSTEM privileges, but we’ll modify it to launch our custom payload instead. This tool effectively completes the privilege escalation chain, leveraging the loaded vulnerable driver to elevate our permissions to the highest level in the Windows operating system.

Importing the ExploitCapcom C++ Project:

Modifying ExploitCapcom exploit to enable a reverse shell:

Generating our reverse-shell payload using msfvenom:

Run the exploit chain on the victim:

  1. I use evil-winrm to transfer all the files to the target:

    • upload [filename]
  2. Load the driver Run Exploit:

    • .\EopLoadDriver.exe System\CurrentControlSet\Capcom C:\Users\svc-print\Documents\Capcom.sys
    • All 0’s is good as a response, means we are working.
  3. Setup Listener:

    • rlwrap -cAr nc -lnvp 443
  4. Trigger exploit:

    • .\ExploitCapcom.exe
  5. Catch the reverse shell:

  6. Get our root flag:

5. Persistence:

Creating a Golden Ticket with mimikatz:

Full DCSync attack using netexec and Golden Ticket:

Lessons Learned:

What did I learn?

  1. I learned that trying to get all your enumeration done very quickly before the password is reset can be frustrating.

  2. I learned that people will always use the description field to hold important information.

  3. I learned that the exploit really did not want to execute the nc64.exe binary no matter how hard I tried. However I think I may have a record for speed-running compiling exploits.

What silly mistakes did I make?

  1. Had to revert the machine and forgot the hosts.

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 proton dot me



Next: Cascade HTB Walkthrough