Active Directory Trust Fundamentals
Concept
Section titled “Concept”A trust relationship is a logical and cryptographic agreement established between two Windows domains (or between an Active Directory forest and an external Kerberos realm).
It is anchored in two architectural pillars:
- The Trusted Domain Object (TDO): An Active Directory object of class
trustedDomainstored in the domain partition (CN=System,DC=domain,DC=local), defining trust attributes (remote domain name, remote SID, direction, transitivity, security filtering flags). - The Shared Secret (Trust Secret): A symmetric shared password (negotiated during trust establishment and periodically renewed by the PDC Emulator role) represented by an inter-domain trust computer account (
Inter-Domain Trust Account).
Why It Matters in DFIR
Section titled “Why It Matters in DFIR”In multi-domain intrusions:
- Inter-Domain Lateral Movement Vector: An attacker who compromises a DC in Domain A can extract the shared trust secret and forge inter-realm Kerberos tickets to access assets in Domain B.
- Stealthy Trust Key Persistence: If an attacker harvests the trust account password, resetting the local
krbtgtaccount twice will not invalidate forged inter-realm tickets crafted with the trust key. - Cross-Domain Telemetry Interpretation: During cross-domain access, the source KDC issues a referral TGT rather than a direct TGS. Detecting these specific requests in Event ID 4769 logs is crucial for reconstructing attacker pivot paths.
How It Works
Section titled “How It Works”The Trust Secret Mechanism
Section titled “The Trust Secret Mechanism”When a two-way trust is established between Domain A (CORP) and Domain B (DEV):
- Two trust accounts are provisioned:
- In Domain A: account
DEV$(typeTRUST_ACCOUNT, UserAccountControl0x800/SERVER_TRUST_ACCOUNT). - In Domain B: account
CORP$.
- In Domain A: account
- Both accounts share an identical, randomly generated symmetric password.
- When user
alice@DEVaccessescifs/fileserver.CORP:- Alice requests a TGS from her local KDC (
DEV). - KDC
DEVidentifies that the target SPN resides inCORP. - KDC
DEVencrypts an Inter-Realm TGT using the shared trust account key (CORP$). - Alice presents this Inter-Realm TGT to the KDC of
CORP. - KDC
CORPdecrypts the ticket using its matchingDEV$account key, validates the identity, applies SID filtering rules, and issues the final TGS forfileserver.CORP.
- Alice requests a TGS from her local KDC (
[Alice@DEV] │ 1. Request TGS for fileserver.CORP ▼[KDC DEV] ──── Encrypts Inter-Realm TGT with Trust Key (DEV$ / CORP$) │ ▼ 2. Presents Inter-Realm TGT[KDC CORP] ─── Decrypts with Trust Key, evaluates SIDs & issues TGS │ ▼ 3. Presents TGS[fileserver.CORP] ─── Grants access according to local DACLWhat Is Possible
Section titled “What Is Possible”- Extracting Trust Secrets from NTDS: An adversary with Domain Admin privileges on a DC can use tools like
secretsdumpormimikatz lsadump::trustto extract NTLM and AES keys of trust accounts. - Forging Inter-Realm Golden Tickets: With the trust key, an attacker can craft forged referral tickets injecting arbitrary SIDs (subject to SID Filtering policies).
- Verifying Cryptographic Trust Health: Administrators and investigators can validate trust status and password synchronization via
netdom trust <Domain> /verify.
What Is Not Possible
Section titled “What Is Not Possible”- Traversing Trusts Without Network Path to KDCs: Kerberos cross-realm ticket exchange requires direct network access from the client to both the local and remote KDCs.
- Forging Inter-Domain Tickets Using Local
krbtgtKeys: The localkrbtgthash only encrypts tickets within the local domain. Crossing the trust boundary strictly requires the inter-domain trust key. - Operating a Trust with Desynchronized Secrets: If trust passwords desynchronize, cross-domain authentication fails with
STATUS_TRUST_FAILURE(0xC000018B).
Common DFIR Confusions
Section titled “Common DFIR Confusions”| Frequent Confusion | Verifiable Forensic Reality |
|---|---|
| ”We reset the krbtgt account twice; all attacker tickets are revoked.” | Double krbtgt rotation does not reset inter-domain trust keys. Adversaries possessing trust keys can still forge referral tickets. |
| ”A trust relationship automatically grants administrative access.” | A trust provides authentication pathways. Authorization requires explicit local DACL assignment. |
| ”Trust communications generate separate VPN or tunnel traffic.” | Trusts utilize standard Active Directory RPC and Kerberos ports (88, 389, 445, 135, 49152-65535). |
Concrete Forensic Example
Section titled “Concrete Forensic Example”In a banking network, a regional branch domain (branch.bank.local) connects to headquarters (hq.bank.local) via a two-way external trust.
- The attacker compromises a branch domain controller.
- They run
mimikatz lsadump::trust /patchand harvest the RC4 key for theHQ$trust account. - The attacker crafts a forged inter-realm ticket using this key targeting a payment gateway in
hq.bank.local. - Detection Artefact: On the HQ DC, Event ID 4769 logs a TGS request for
ServiceName: krbtgt/HQ.BANK.LOCALpresented by a foreign security principal validated via trust accountBRANCH$.
Key Forensic Artefacts
Section titled “Key Forensic Artefacts”- Active Directory Database (
ntds.dit):trustedDomainobjects: attributestrustPartner,trustDirection,trustType,trustAttributes.- Trust computer accounts:
sAMAccountType = 0x30000002(TRUST_ACCOUNT).
- Windows Registry (LSA Secrets):
- Keys under
HKLM\SECURITY\Policy\Secrets\G\$\${GUID}holding cached trust passwords.
- Keys under
- Security Event Logs:
- Event ID 4769 (DC): TGS requests with
ServiceNamecorresponding to remote domain trust accounts. - Event ID 4624 (Target Server): Network logon (Type 3) with remote domain in
TargetDomainName. - Event ID 4625 (DC): Logon failures showing
0xC000018B(STATUS_TRUST_FAILURE).
- Event ID 4769 (DC): TGS requests with
Investigation Methods
Section titled “Investigation Methods”- Enumerate All Active Trust Objects:
Run
Get-ADTrust -Filter * | Format-List Name, Direction, TrustType, IntraForest, Target. - Audit Modification Timestamps of TDO Objects:
Examine
whenChangedontrustedDomainobjects inCN=System,DC=domain,DC=localto detect rogue trust establishment. - Identify Trust Computer Accounts:
Query computer accounts with
SERVER_TRUST_ACCOUNTflag set inuserAccountControl.
Investigative Tooling
Section titled “Investigative Tooling”- Nltest & Netdom:
Terminal window nltest /domain_trustsnetdom trust <LocalDomain> /Domain:<RemoteDomain> /verify - PowerView:
Terminal window Get-DomainTrustGet-DomainTrustMapping - BloodHound: Visual exploration of cross-domain trust links and attack paths.
Key Takeaways
Section titled “Key Takeaways”- Active Directory trusts rely on a symmetric shared secret between domain authorities.
- DC compromise enables extraction of trust keys and subsequent inter-realm ticket forging.
- Incident recovery requires rotating all inter-domain trust account passwords alongside
krbtgt.