Cloud metadata services are internal APIs that provide cloud instances with information about themselves - including temporary credentials. Think of it as a concierge desk inside each cloud VM: the instance can ask "Who am I?" and get its identity, role, and credentials back. The problem? If an attacker can make requests to this service, they get those credentials too.
The Instance Metadata Service (IMDS) is accessible at a special IP address (169.254.169.254) from within any cloud instance. Combined with Server-Side Request Forgery (SSRF), this becomes one of the most impactful cloud attack vectors. The Capital One breach in 2019 (100M+ records) exploited exactly this pattern.
SSRF + Metadata = Credential Theft
How Metadata Services Work
AWS Instance Metadata Service (IMDS)
User Data - Another Secret Source
Azure Instance Metadata Service
Azure Managed Identity Types
GCP Metadata Service
SSRF to Metadata Attack
Real-World Impact
Defending Against Metadata Attacks
Metadata Exploitation Methodology
SSRF to Credential Theft
Knowledge Check
Challenges
Key Takeaways
- Metadata services (169.254.169.254) provide IAM credentials to instances
- SSRF + metadata access = credential theft (Capital One breach pattern)
- AWS IMDSv2 requires PUT + token - protects against basic SSRF
- Azure/GCP require custom headers but are still exploitable with header injection
- User-data/startup scripts often contain hardcoded secrets
- Defense: IMDSv2, hop limit=1, firewall rules, SSRF input validation