Attacking Domain Trusts
Last updated
Was this helpful?
Last updated
Was this helpful?
This attack allows for the compromise of a parent domain once the child domain has been compromised. The sidHistory
attribute is used in migration scenarios. If a user in one domain is migrated to another domain, a new account is created in the second domain. The original user's SID will be added to the new user's SID history attribute, ensuring that the user can still access resources in the original domain. An attacker can perform SID history injection (due to a lack of SID Filtering protection) and add an administrator account to the SID History attribute of an account they control in the child domain. When logging in with this account, all of the SIDs associated with the account are added to the user's token. This token is used to determine what resources the account can access.
We need:
FQDN
- child domain
KRBTGT hash
- child domain
SID
- child domain
USER
- child domain (does not need to exist)
SID Enterprise Admin group
- root domain
2
- 3
with (Since we have compromised the child domain, we can log in as a Domain Admin or similar and perform the DCSync attack to obtain the NT hash for the KRBTGT account)
3
- 5
with or PowerView
5
with cmdlet Get-ADGroup
We may see users or admins from Domain A as members of a group in Domain B. Only Domain Local Groups
allow security principals from outside its forest. We may see a Domain Admin or Enterprise Admin from Domain A as a member of the built-in Administrators group in Domain B in a bidirectional forest trust relationship. If we can take over this admin user in Domain A, we would gain full administrative access to Domain B based on group membership.
Now we can verify the access to the target domain using the Enter-PSSession
cmdlet to connect over WinRM.
Domain with an inbound or bidirectional domain/forest trust
Offline cracking of output with hashcat (-m 13100
)
2
with
3
- 4
with (bruteforce SID)
Use to construct a Golden Ticket. This ticket will be valid to access resources in the child domain (specified by -domain-sid
) and the parent domain (specified by -extra-sid
).
USe to automate the process
Use the PowerView function
Enumaration SPN on the domain target with or PowerView
with
Enumaration SPN on the domain target with