Attack Trusts

"Note that the Active Directory domain is not the security boundary; the AD forest is." (Sean Metcalf, refarrow-up-right)

Theory

Some trust types:

Trust Type
Description

Parent-child

A trust between domains within the same forest. The child domain has a bidirectional transitive trust with the parent domain.

Cross-link (shortcut)

A trust between child domains (used to speed up authentication).

Tree-root (intra-forest)

A bidirectional transitive trust between a forest root domain and a new tree root domain. Created implicitly when a new domain tree is created in the forest.

Forest

A transitive trust between two forest root domains. Enforces SID filtering.

External (inter-forest)

A non-transitive trust between two separate domains in separate forests that are not already joined by a forest trust. Enforces SID filtering.

Enumeration

Get forest object:

Get all domains in a fores:

Enum trusts for current domain via nltest and .NET:

Enum trusts via Win32 API and LDAP:

Build domain trust mapping:

Transitive trusts resolution:

No authentication enumeration via MS-NRPC (Netlogon) with https://github.com/sud0Ru/NauthNRPCarrow-up-right:

Visualization (yEd)

Request a Foreign User TGT with Rubeus

Having just an RC4/AES keys of a user in target forest (that's a foreign user in target domain, but a native user in current domain), we can request Kerberos tickets manually with Rubeus.

Request TGT for that user in current domain:

Request inter-realm TGT from current domain to the target domain:

Use inter-realm TGT to request a TGS in the target domain:

This PRarrow-up-right helps to use such tickets with Impacket.

Request an Inter-Realm TGT with Impacket

Request a TGT in current domain:

Request an IR TGT for the foreign domain in current domain:

Request an ST in foreign domain:

sIDHistory/ExtraSids Hopping

Abusing Bidirectional ParentChild (WITHIN_FOREST) trust between child.megacorp.local ⟷ megacorp.local.

Check if SID filtering is enabled for a trust:

Raise Child

For creating a cross-trust golden ticket (Golden Ticket + ExtraSid) we'll need:

  1. Child domain FQDN (child.megacorp.local);

  2. Name of the child domain's DC machine account and its RID (DC01$, 1337);

  3. SID of the child domain (S-1-5-21-4266912945-3985045794-2943778634);

  4. SID of the parent domain (S-1-5-21-2284550090-1208917427-1204316795);

  5. Compomised krbtgt hash from the child domain (00ff00ff00ff00ff00ff00ff00ff00ff);

  6. ???

  7. PROFIT.

1. Child domain FQDN:

2. Name of the child domain's DC machine account and its RID:

3. SID of the child domain:

4. SID of the parent domain:

Create cross-trust golden ticket:

For DCSyncing we'll need only parent domain FQDN (megacorp.local):

DCSync:

Inter-Realm TGT Forging

Manually craft an IR TGT injecting a privileged SID (example for WITHIN_FOREST trust but can also be adopted for TREAT_AS_EXTERNAL case):

Request an ST for DCSync:

DCSync:

UnD + PrinterBug

Unconstrainedchevron-right

Can be abused either if CVE-2019-0683 is not fixed or if EnableTGTDelegation is enabled for the trusted forest:

Attack Forest Trusts

List foreign users and users from foreign groups:

List user accounts from a target domain with SPNs set for Kerberoasting:

If SID history is enabled (e. g., if domain is on its migration period, netdom trust b.net /d:a.net /enablesidhistory:yes) then the forest trust is treated as external.

We can try to locate non-default (with RID greater than 1000) admin account:

If such an account is a member of a domain local security group (not a global group like Enterprise Admins or Domain Admins) and allows us to compromise a user or a computer in the target domain, we can create a cross-trust golden ticket for her the same way as described above.

CVE-2020-0665

Last updated