flawopen.com/SSRF/Cloud metadata and SSRF
How Can SSRF Reach Cloud Metadata, and When Are Credentials at Risk?
Think of the metadata service as a locked service counter inside a cloud machine. SSRF can turn your application into a courier to that counter, but what it can retrieve depends on the provider's request rules, instance settings, and the application's network path. A reachable endpoint does not automatically mean credentials are exposed.
Why the metadata endpoint is dangerous
AWS EC2, Azure, and Google Compute Engine document instance metadata services reachable from supported VM environments; 169.254.169.254 is a common link-local address, but request formats and controls differ. Metadata may include sensitive instance details, and AWS can return temporary role credentials when the instance profile and request path permit it. SSRF matters when an attacker can influence a server-side request that reaches this service. Reachability alone does not establish that credentials are retrievable: required headers or tokens, HTTP method constraints, proxy behavior, network placement, and instance configuration affect the result.
Real-world relevance
The security impact is a chain, not an automatic outcome: an input influences a server-side request; the request reaches a metadata service; the service accepts that request under its provider-specific controls; and the returned data grants useful access. The final blast radius depends on the workload identity's permissions. Break the chain with fixed destination choices, strict egress controls, provider metadata protections, and narrowly scoped workload identities.
FAQ
No. Address, headers, methods, token requirements, and available data vary. AWS IMDSv2 requires a session token for metadata retrieval when HttpTokens is set to required; Azure requires the Metadata: true header; Google documents the Metadata-Flavor: Google header. These provider checks can mitigate some SSRF paths, but they are not a substitute for preventing user-controlled destinations and blocking unnecessary egress. Verify the exact VM and container configuration in the provider's documentation.
References
- OWASP SSRF Prevention Cheat Sheet
- AWS — Configure instance metadata options
- Microsoft Learn — Azure Instance Metadata Service
- Google Cloud — Metadata server troubleshooting and request headers
- Is server-side fetch() vulnerable to SSRF by default?
- Capital One — 2019 SSRF and AWS metadata incident analysis
- CVE-2022-31150 — Node.js Undici CRLF injection and SSRF teardown