Domain 6Active Directory AttacksCORE

Trust Relationships

AD trust relationships: intra-forest, inter-forest, external, child-parent trusts. Trust directions, transitivity, SID filtering, and cross-forest attack vectors for OSCP.

Domain: Domain 6: Active Directory Exploitation•Updated: 2026-09-01
#trusts#inter-forest#intra-forest#external-trusts#sid-filtering#oscp

Trust Relationships

Trust relationships define how Active Directory domains and forests authenticate users across security boundaries. In OSCP labs, trusts are often the key to moving from one domain to another and achieving full forest compromise.


1. Trust Types Overview

Trust Direction

Direction Description Example
One-Way Domain A trusts Domain B. Users from B can access resources in A, but not vice versa. A ← B (B’s users can access A)
Two-Way Domain A trusts Domain B AND Domain B trusts Domain A. Bidirectional access. A ↔ B (both directions)

Trust Transitivity

Type Description Example
Transitive If A trusts B and B trusts C, then A automatically trusts C. A → B → C means A → C
Non-Transitive Trusts do NOT extend beyond the two domains involved. A → B does NOT mean A → C even if B → C

Trust Types

Trust Type Auto-Created? Transitive? Direction Scope
Intra-Forest Yes Yes Two-way Within same forest
Inter-Forest No (manual) Configurable Configurable Between different forests
External No (manual) No Configurable Between domains in different forests
Child-to-Parent Yes Yes Two-way Within same tree
Parent-to-Child Yes Yes Two-way Within same tree
Cross-Link Yes Yes Two-way Between child domains of same parent

2. Intra-Forest Trusts

Intra-forest trusts are automatic and exist between all domains within the same forest. They are the foundation of forest-wide authentication.

How They Work

Forest: contoso.com
│
├── contoso.com (Root)
│   ├── ←→ uk.contoso.com (Child-to-Parent / Parent-to-Child)
│   └── ←→ us.contoso.com (Child-to-Parent / Parent-to-Child)
│
└── uk.contoso.com ←→ us.contoso.com (Cross-Link)

Result: ALL domains trust ALL other domains (transitive).
A user from uk.contoso.com can access resources in us.contoso.com.

Key Properties

Property Value
Created Automatically when domains are added to the forest
Direction Always two-way
Transitive Always transitive
Authentication Kerberos-based
SID Filtering NOT applied (full SID history preserved)
Trust Account Uses KRBTGT (same as within-domain auth)

Attack Relevance

Aspect Detail
Automatic Access If you compromise one domain in a forest, you have a path to all other domains through automatic trusts.
Enterprise Admins Enterprise Admins in the root domain have control over ALL domains in the forest.
Domain Admins Domain Admins in a child domain CANNOT automatically access the parent domain. But they can be a stepping stone to Enterprise Admins.
No SID Filtering Within a forest, SID history is preserved. This means group memberships from one domain are recognized in another.

3. Inter-Forest Trusts

Inter-forest trusts are manual trusts between two different forests. They are the most attack-relevant trust type in OSCP because they connect separate security boundaries.

How They Work

Forest A: contoso.com              Forest B: partner.com
│                                      │
├── Enterprise Admins                 ├── Enterprise Admins
│       │                                     │
│       └──── Inter-Forest Trust ─────────────┘
│              (Two-way, Transitive)
│
Authentication:
├── Uses forest-wide trust accounts (Trust_XXXXX$)
├── Trust accounts are created in BOTH forests
├── Trust account passwords are synchronized
└── Kerberos cross-realm TGTs are issued

Key Properties

Property Value
Created Manually by Enterprise Admins from BOTH forests
Direction Configurable (one-way or two-way)
Transitive Configurable (transitive or non-transitive)
Authentication Kerberos-based (cross-realm TGTs)
Trust Accounts Trust_XXXXX$ accounts in both forests
SID Filtering APPLIED — SID history is filtered for security

SID Filtering

SID filtering is a security mechanism that prevents privilege escalation across forest trusts.

How SID Filtering Works:
════════════════════════
When a user from Forest A accesses Forest B:

1. The user's token includes their SID and SID History
2. SID filtering REMOVES certain SIDs from the token:
   └── SIDs from Forest A's domains are removed
   └── Only SIDs from Forest B are preserved

3. This prevents a Domain Admin from Forest A from
   automatically becoming a Domain Admin in Forest B

SID Filtering Blocks:
├── Domain Admins SID (S-1-5-32-544)
├── Enterprise Admins SID (S-1-5-32-519)
├── Any SID from the source forest's domains
└── Preserves: user's primary SID, global group SIDs

SID History Bypass

SID History can be used to bypass SID filtering under certain conditions:

SID History Attack:
═══════════════════
1. Compromise a trust account (Trust_XXXXX$)
2. The trust account is NOT subject to SID filtering
3. Add privileged SIDs to the trust account's SID History
4. Authenticate as the trust account
5. The privileged SIDs are recognized in the target forest

Alternatively:
1. Find a user/group that is NOT filtered
2. Add SID History to include Domain Admins from target forest
3. Authenticate and gain elevated access

Inter-Forest Trust Attack Relevance

Attack Description Prerequisites
Trust Ticket Attack Forge a cross-forest TGT using the trust account’s password hash. This allows authentication in the target forest. Trust account hash (Trust_XXXXX$)
Resource SID Delegation Abuse SID filtering bypass via SID History injection on trust accounts. Write access to trust account or user with SID History control
Shadow Credentials Add key credential links to trust accounts to authenticate as them. Write access to trust account (msDS-KeyCredentialLink)
CG2G (Cross-Golden-to-Golden) Compromise KRBTGT in one forest, use inter-forest trust to attack the other forest. KRBTGT hash from source forest + inter-forest trust

4. External Trusts

External trusts are manual, non-transitive trusts between two domains in different forests.

Key Properties

Property Value
Created Manually by Domain Admins from both domains
Direction Configurable (one-way or two-way)
Transitive Always non-transitive
Authentication Kerberos-based
SID Filtering APPLIED
Scope Limited to the two specific domains

When to Use External vs Inter-Forest

Scenario Trust Type
Need access between specific domains only External Trust
Need access between entire forests Inter-Forest Trust
Merged companies with separate forests Inter-Forest Trust
Partner organization with limited access External Trust

Attack Relevance

Aspect Detail
Limited Scope External trusts are non-transitive, so they don’t extend to other domains. This limits the attack surface.
SID Filtering SID filtering is applied, similar to inter-forest trusts.
Less Common in OSCP External trusts appear less frequently than inter-forest trusts in OSCP labs.

5. Trust Attack Summary

Trust Attack Comparison

Trust Type Auto-Created Transitive SID Filtering Attack Surface OSCP Frequency
Intra-Forest Yes Yes No High (automatic, widespread) Very Common
Inter-Forest No Configurable Yes Critical (cross-forest pivoting) Common
External No No Yes Medium (limited scope) Less Common
Child-to-Parent Yes Yes No High (automatic hierarchy) Very Common

Trust Ticket Attack (Detailed)

Attack Flow:
═══════════
1. Obtain the trust account password hash
   → The trust account is Trust_XXXXX$ (5 random hex chars)
   → Use DCSync to extract: secretsdump.py -just-dc-user "Trust_XXXXX$" DOMAIN/admin@DC_IP

2. Forge a cross-forest TGT
   → Use the trust account hash to create a TGT for the target forest
   → Mimikatz: kerberos::golden /user:admin /sid:SOURCE_SID /rc4:TRUST_HASH \
              /sids:TARGET_SID /domain:SOURCE /service:krbtgt \
              /target:TARGET_FOREST

3. Use the forged TGT to access the target forest
   → The target forest's KDC accepts the cross-realm TGT
   → You can request service tickets in the target forest

CG2G Attack (Cross-Golden-to-Golden)

Attack Flow:
═══════════
1. Compromise KRBTGT in Forest A
   → DCSync: secretsdump.py -just-dc-user krbtgt FORESTA/admin@DC_A

2. Create a Golden Ticket for Forest A
   → Forge TGT as any user in Forest A

3. Use the Golden Ticket to access the trust relationship
   → Request a cross-realm TGT for Forest B
   → The KDC in Forest B issues a cross-realm TGT

4. Use the cross-realm TGT in Forest B
   → Request service tickets in Forest B
   → Access resources in Forest B

5. (Optional) Extract KRBTGT from Forest B
   → If you can authenticate to DC in Forest B
   → Now you own both forests

6. Trust Enumeration

# PowerShell - All trusts
Get-ADTrust -Filter *

# PowerShell - Trust details
Get-ADTrust -Filter * -Properties *

# PowerShell - Specific trust attributes
Get-ADTrust -Filter * -Properties TrustDirection, TrustType, TrustAttributes

# netdom
netdom trust DOMAIN /domainlist

# klist
klist domains

# systeminfo
systeminfo | Select-String "Domain"
# Using ldapsearch
ldapsearch -x -H ldap://DC_IP -D "user@domain.com" -w password \
  -b "CN=Configuration,DC=domain,DC=com" "(objectClass=trustedDomain)"

# Using BloodHound
# Trust relationships are collected by the Trusts collector
# Query: Match (n:Domain)-[:TrustedBy]->(m:Domain) Return n.name, m.name

Trust Direction Values

Value Meaning
1 Inbound (other domain trusts us)
2 Outbound (we trust other domain)
3 Bidirectional (two-way trust)

Trust Type Values

Value Meaning
2 Windows NT 4.0 trust
3 Tree-root trust (intra-forest)
4 Parent-child trust (intra-forest)
5 External trust
6 Forest trust (inter-forest)

OSCP Exam Checklist: Trust Relationships

Must-Know Concepts

  • Intra-forest trusts are automatic, two-way, transitive, no SID filtering
  • Inter-forest trusts are manual, configurable, with SID filtering
  • External trusts are manual, non-transitive, with SID filtering
  • SID filtering removes source forest SIDs to prevent privilege escalation
  • Trust accounts (Trust_XXXXX$) can be targeted for trust ticket attacks
  • CG2G: compromise KRBTGT in one forest → use trust → compromise other forest
  • Enterprise Admins control the entire forest; Domain Admins control their domain only
  • Cross-link trusts exist between child domains of the same parent

Must-Remember Commands

# Enumerate trusts
Get-ADTrust -Filter * -Properties *
netdom trust DOMAIN /domainlist
klist domains
# DCSync trust account
secretsdump.py -just-dc-user "Trust_XXXXX$" DOMAIN/admin@DC_IP

# Forge cross-forest TGT (Mimikatz)
kerberos::golden /user:admin /sid:SOURCE_SID /rc4:TRUST_HASH \
  /sids:TARGET_SID /domain:SOURCE /service:krbtgt /target:TARGET_FOREST