Post

HTB AD Medium: Authority

Authority is a Medium rated AD machine on HTB.

HTB AD Medium: Authority

Nmap

Pasted image 20240714194937.png Pasted image 20240714194933.png Pasted image 20240714194927.png Pasted image 20240714194923.png

Initial Foothold

Enumerating SMB

Connecting to the SMB share without credentials results in the following output. Pasted image 20240714194914.png

Download all files in the Development share. Pasted image 20240714194908.png

Ansible vault can be found in Automation/Ansible/PWM/defaults/main.yml, save the following output of this file (first hash): Pasted image 20240714194902.png

Now we can use ansible2john to generate a crackable hash. Pasted image 20240714194858.png

Finally we can crack the hash using John: !@#$%^&*. Pasted image 20240714194853.png

Now that we have the Ansible vault encrypted password we can decrypt all the encrypted Ansible playbooks stored in the main.yml file we find more credentials. Pasted image 20240714194847.png

Enumating HTTP (Port 8443)

We get redirected to /pwm. Pasted image 20240714194837.png

Going to the configuration manager we can download the configuration, the config script tries to query the following address. We can replace this with our own IP and use responder to get the hash. Pasted image 20240714194832.png

Modify the config file with your VPN IP. Pasted image 20240714194825.png

Start responder sudo responder -I tun0 and upload the new configuration file svc_ldap:lDaP_1n_th3_cle4r!. Pasted image 20240714194819.png

We can use the found credentials to establish a shell using evil-winrm. Pasted image 20240714194815.png

Priv Esc

We can add machines to the domain using the SeMachineAccountPrivilege (addcomputer module impacket). Pasted image 20240714194808.png

Using impacket to add a machine to the domain (password must be strong enough). Pasted image 20240714194804.png

Next up we can request a certificate template from the server using the newly created machine account. Pasted image 20240714194758.png

Examining the certificate we find out that it allows any computer in the domain to request an administrator certificate (Authority-CA, enrolle supplies subject True). Pasted image 20240714194754.png

Before requesting the administrator certificate, add the following line to your hosts file. Pasted image 20240714194749.png

Request administrator certificate. Pasted image 20240714194745.png

We can now create 2 new certificates (one without private key and one without certificate). Pasted image 20240714194741.png

We can use the 2 newly created certificates to change the administrator password. Pasted image 20240714194733.png

Log in as adminstrator using evil-winrm. Pasted image 20240714194727.png

User.txt

Pasted image 20240714194720.png

Root.txt

Pasted image 20240714194714.png

You have PWNED!!!

Pasted image 20240714194709.png

Sources

This post is licensed under CC BY 4.0 by the author.