Manager HTB Walkthrough

Sep 22, 2024    #box   #htb   #manager   #windows   #ldap   #kerberos   #smb   #mssql   #certificate   #ca   #esc7  

Hack The Box Manager Walkthrough/Writeup:

How I use variables & wordlists:

1. Enumeration:

NMAP:

Web 80:

SMB 445:

Over view of IPC$ Share:

LDAP 389:

DNS 53:

Kerberos 88:

Making a list….checking it once?:

2. Foothold:

Credentialed SMB Enumeration:

I check if we have access to more smb shares with the creds & we do:

Credentials MSSQL Enumeration:

Finding a website backup:

Finding Hard-coded Credentials:

Getting access to the system as Raven:

3. Privilege Escalation:

Privesc Enumeration:

CA Abuse to Privesc:

Step 1 Add Raven as an Officer, to manage & issue certs:

Step 2 Enable SubCA template:

Step 3 Request a certificate on behalf of the administrator:

Step 4 Re-issue our failed cert:

Step 5 Retrieve the issued cert and download as .pfx:

Step 6 Retrieve the Admin Hash:

Attack Deep-Dive e.g. Exploiting UPNs in ESC7 Attacks: A Hacker’s Guide:

But wait, you might ask, “Bloodstiller, how do we actually use this certificate to own the domain?” Great question! Here’s how we turn our shiny new cert into total control:

  1. We present our manipulated certificate to the target system (usually a domain controller).

  2. The system checks the cert: Is it valid? Not expired? Issued by a trusted CA?

    • As we have power to issue certs, it’s valid - check.
    • We just issued it - check.
    • As CA’s be default trust certs issues by themselves - check!
  3. Here’s where the magic happens: the DC/System extracts the UPN (which we set) from the SAN field of our certificate.

  4. It uses this UPN to find the corresponding user account in Active Directory. Remember, this is the admin account we specified, not our actual account!

  5. If everything looks good (and why wouldn’t it?), the system hands us a Kerberos Ticket Granting Ticket (TGT) for that account.

  6. Boom! We now have a TGT for a high-privileged account. We can use this ticket to access resources and wreak havoc with admin privileges.

    • +Note+: Certipy extracts this the admin hash from TGT and presents us with it as well as saving the TGT as a .cacche file so we can then perform PTT attacks from the comfort of our attack box.

4. Ownership:

    • I login as the admin using their hash:

5. Persistence:

Process of failed Golden Ticket Attack:

Lessons Learned:

What did I learn?

  1. I learned alot about certificate attacks, I had done very little on them previously so this was nice to get done.
  2. I learned about golden ticket attacks being thwarted……

What silly mistakes did I make?

  1. Enclosing my user & password vars in quotations marks rendering them USELESS! We live and learn
  2. The standard not updating /etc/hosts when doing LDAP queries etc.
  3. Oh here is a fun one, I spent a good amount of time trying to exfil the website backup before realizing it was in-fact in the webroot and I could just wget it.

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: Access HTB Walkthrough