Forest and Trust Attacks
Trust Enumeration
Enumerate Trusts
ldapsearch (objectClass=trustedDomain)
ldapsearch (objectClass=trustedDomain) --attributes trustPartner,trustDirection,trustAttributes,flatNameTrust Account (won't appear in CN=Users)
ldapsearch (samAccountType=805306370) --attributes samAccountName
# Output: sAMAccountName: PARTNER$trustDirection Values
0
TRUST_DIRECTION_DISABLED
1
TRUST_DIRECTION_INBOUND
2
TRUST_DIRECTION_OUTBOUND
3
TRUST_DIRECTION_BIDIRECTIONAL
trustAttributes Flags
1
TRUST_ATTRIBUTE_NON_TRANSITIVE
Non-transitive trust
4
TRUST_ATTRIBUTE_QUARANTINED_DOMAIN
SID filtering enabled
8
TRUST_ATTRIBUTE_FOREST_TRANSITIVE
Transitive between forests
32
TRUST_ATTRIBUTE_WITHIN_FOREST
Between domains in same forest
64
TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL
Between domains in different forests (SID filtering implied)
Parent-Child Trust Abuse
When DA in child domain → escalate to Enterprise Admin in forest root.
Get Child Domain krbtgt Hash
Get Child Domain SID
Get Parent Domain SID
Forge Golden Ticket with Enterprise Admins SID
Parameters:
/aes256- Child domain's krbtgt AES256 hash/user- User to impersonate/domain- Child domain FQDN/sid- Child domain SID/sids- Parent domain SID with -519 (Enterprise Admins RID)
Save to file:
Use the Ticket
Alternative: Diamond Ticket
One-Way Inbound Trust (You're in Trusted Domain)
You can access resources in the trusting domain.
Verify Trust Direction
Find Foreign Security Principals
Output shows SID from your domain that has access to trusting domain.
Identify the Principal
Enumerate Trusting Domain Computers
Forge Inter-Realm Referral Ticket
Get inter-realm key:
Forge referral ticket:
Request service ticket in trusting domain:
Inject and access:
One-Way Outbound Trust (You're in Trusting Domain)
You're on the "wrong" side - no direct access to trusted domain.
Verify Trust Direction
Get TDO GUID
DCSync the Inter-Realm Key
[Out] = current key, [Out-1] = previous key
Request TGT as Trust Account
Inject and Enumerate (High Integrity)
Quick Reference
Child → Parent
Bidirectional
Golden ticket with Enterprise Admins SID
Trusted → Trusting
Inbound (1)
Find foreign principals, forge referral tickets
Trusting → Trusted
Outbound (2)
DCSync trust account, use as stepping stone
Last updated