# Cross-domain enumeration

## Domain trusts explained

Active Directory Domain Services (AD DS) provides security across multiple domains or forests through domain and forest trust relationships. Before authentication can occur across trusts, Windows must first check if the domain being requested by a user, computer, or service has a trust relationship with the domain of the requesting account.

{% embed url="<https://learn.microsoft.com/en-us/entra/identity/domain-services/concepts-forest-trust>" %}

<figure><img src="/files/kTBucxWifnMRWuUQjr86" alt=""><figcaption></figcaption></figure>

## Enumerating domain trust

```
Get-NetForest [-Forest megacorp.local]
Get-Forest [-Forest megacorp.local]
```

Need PowerView\.ps1 for this:

```
Get-NetForestDomain [-Forest megacorp.local]
Get-ForestDomain [-Forest megacorp.local]
```

## Enumerate from one to another domain

If you have a valid account for the child/parent domain and there is a trust between the domains, you can enumerate the other domain using the authentication of the compromised domain.

A great tool can me powershell empire, but you will need to do all enumeration from the compromised DC and run powershell empire. This can trigger AV. A better way is to use BloodyAD. BloodyAD is a remote tool that uses LDAP to enumerate the domain.

### Get all domain users

```
bloodyAD -d compromised-domain.local -u Administrator -p :<nt-hash-or-password> --host ip-of-target-domain get children 'DC=bloody,DC=local' --type user
```

### Get all writable objects

```
bloodyAD -d compromised-domain.local -u Administrator -p :<nt-hash-or-password> --host ip-of-target-domain get writable
```

### More Bloody-AD examples:

{% embed url="<https://incendium.gitbook.io/pentesting-notes/windows-pentesting/bloodyad>" %}


---

# Agent Instructions: 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://notes.incendium.rocks/pentesting-notes/windows-pentesting/cross-domain-enumeration.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.
