Foreign ACL Pricipals are users or groups in the child domain that have rights over ACLs (GenericAll, WriteDacl and so on) in the parent domain.
To enumerate these users we can use PowerView, BloodHound or any other ACL visualization tool.
Copy Import-Module .\PowerView.ps1
$sid = Convert-NameToSid otter
Get-DomainObjectAcl - ResolveGUIDs - Identity * - domain domain.com | ? { $_.SecurityIdentifier -eq $sid}
AceType : AccessAllowed
ObjectDN : CN = SomeGroup , CN = Users , DC = DOMAIN , DC = COM
ActiveDirectoryRights : GenericAll
OpaqueLength : 0
ObjectSID : S - 1 - 5 - 21 - 2879935145 - 656083549 - 3766571964 - 2110
InheritanceFlags : None
BinaryLength : 36
IsInherited : False
IsCallback : False
PropagationFlags : None
SecurityIdentifier : S - 1 - 5 - 21 - 2901893446 - 2198612369 - 2488268719 - 2103
AccessMask : 983551
AuditFlags : None
AceFlags : None
AceQualifier : AccessAllowed
The following is a snipped of PowerShell code that can enumerate all foreign ACL rights from a child domain to a parent one.
Copy $Domain = "domain.com"
$DomainSid = Get-DomainSid $Domain
Get-DomainObjectAcl - Domain $Domain - ResolveGUIDs - Identity * | Where-Object {
( $_.ActiveDirectoryRights -match 'WriteProperty|GenericAll|GenericWrite|WriteDacl|WriteOwner' ) -and `
( $_.AceType -match 'AccessAllowed' ) -and `
( $_.SecurityIdentifier -match '^S-1-5-.*-[1-9]\d{3,}$' ) -and `
( $_.SecurityIdentifier -notmatch $DomainSid)
} | ForEach-Object {
$convertedSid = ConvertFrom-Sid $_.SecurityIdentifier
Write-Host "User: $convertedSid"
$_
}
Copy Import-Module .\PowerView.ps1
.\getAllForeignAcls.ps1
and look for interesting permissions to abuse.