Azure entra cloud pentesting

From xalgorix/xalgorix · View interactive version

Azure entra cloud pentesting is an AI agent skill from the GitHub repository xalgorix/xalgorix. Azure and Entra ID offensive testing — tenant discovery via OpenID metadata, users, service principals, managed identities, application registrations, Microsoft Graph scopes and consent grants, RBAC across subscriptions, storage, Key Vault, App Service, Automation, and Run Command

How to use this skill

Skill file

Azure / Entra Cloud Pentesting

Purpose

Full Azure + Entra ID offensive methodology: from a domain to a tenant model (black-box), or from a validated token/service principal (credentialed) to mapped identity, RBAC, resources, and escalation paths. Microsoft Graph and Azure CLI/API first — Sentinel/Defender are irrelevant to offensive workflow.

Entry Conditions

Discovery Signals

Attack Model

tenant discovered → identity model mapped (users/SPs/apps/MI)
→ Graph permissions + RBAC roles enumerated
→ resource access (Key Vault, Storage, VMs, Automation)
→ escalation candidates → verified impact

Methodology

Step 1: Tenant Discovery (black-box)

curl -sk "https://login.microsoftonline.com/<target-domain>/v2.0/.well-known/openid-configuration" | jq ".token_endpoint, .issuer"
# issuer reveals the tenant ID; .well-known endpoints enumerate federation metadata
# Brute/verify common subdomains: <name>.azurewebsites.net, <name>.blob.core.windows.net
# MSAL JS configs in bundles: tenant + clientId + scopes → the app's consent surface

Step 2: Identity Model (Graph)

# With a Graph-audience token:
az rest --url "https://graph.microsoft.com/v1.0/me"
az rest --url "https://graph.microsoft.com/v1.0/users?$count=true" -H "ConsistencyLevel: eventual"   # if Directory.Read*
az rest --url "https://graph.microsoft.com/v1.0/servicePrincipals"          # enterprise apps
az rest --url "https://graph.microsoft.com/v1.0/applications"               # app registrations
az rest --url "https://graph.microsoft.com/v1.0/oauth2PermissionGrants"     # consent grants (delegated)
az rest --url "https://graph.microsoft.com/v1.0/policies/authorizationPolicy" # default user roles
# Decode your own token: roles claim (app roles) vs scp (delegated scopes) — these are DIFFERENT privilege models

Step 3: ARM / RBAC

# With an ARM-audience token:
az login --service-principal -u <appId> -p <secret> --tenant <tid>   # or use the token
az account list
az role assignment list --all --output table                          # where does this principal have roles?
# Owner/Contributor/User Access Administrator on a scope = the RBAC escalation primitives

Step 4: Resource Access

# Key Vault (its OWN audience — ARM role ≠ data plane, but `Access Policies`/RBAC model decides):
az keyvault list && az keyvault secret list --vault-name <v>
# Storage: az storage container list --account-name <acct> (keys or SAS)
# App Service: az webapp config appsettings list (connection strings galore)
# VMs + Run Command (the classic exec primitive):
az vm run-command invoke -g <rg> -n <vm> --command-id RunShellScript --scripts "id"
# Automation accounts: runbooks + credentials
# Managed identities: az identity list; each maps to an ARM principal

Step 5: Chains

Token/Audience Rule

Before declaring a credential weak or powerful: determine aud (Graph / ARM / Key Vault / Storage), tenant, principal (user vs service principal vs managed identity), scopes (scp, delegated) vs roles (roles, application). A Graph token does not grant ARM access; an ARM token does not grant Graph privileges; Key Vault and Storage have separate audiences. Mint the right audience from the same credential when the identity supports it.

Evidence Contract

candidate (identity/permission/resource)
→ token with the right audience proves live access
→ concrete data or action (secret listed/read, VM command output, role assignment enumerated)
→ report with tenant/principal context

NOT evidence: tenant ID known, app registration existing, decoded token claims without a live call, az account list failing due to audience confusion (try Graph next)

Common Misses

False Positives / Non-Findings

Xalgorix Tool Strategy

Specialist Handoffs

Stopping Rule

Stop when: the tenant's identity model (users/SPs/apps/MIs), your effective Graph scopes and ARM roles, and the target's high-value resources (Key Vault, Storage, VMs, Automation) are mapped, and the strongest escalation candidates are verified or constraint-blocked.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.