Instance Metadata Attacks
Instance metadata attacks target a cloud service that provides running virtual machines with configuration details and credentials about themselves. Attackers exploit weaknesses in how applications or network controls handle requests to this internal service, typically by abusing vulnerabilities in web applications to redirect requests toward it. If successful, attackers can retrieve temporary cloud credentials and use them to access other cloud resources.
Instance metadata attacks exploit the cloud provider Instance Metadata Service (IMDS), an HTTP endpoint typically accessible at a link-local address from within a compute instance, to retrieve sensitive data including temporary IAM credentials, instance identity documents, and configuration parameters. The most common exploitation vector is Server-Side Request Forgery (SSRF), where a vulnerable application hosted on the instance can be manipulated into issuing HTTP requests to the IMDS endpoint on behalf of the attacker. Additional vectors include remote code execution and unvalidated HTTP requests made by application logic. Retrieved temporary credentials may then be used for lateral movement or privilege escalation within the cloud environment. Mitigations include enforcing IMDSv2 (which requires session-oriented requests with PUT-based token retrieval, raising the bar for SSRF exploitation), restricting metadata endpoint access via host-based firewall rules, and applying least-privilege IAM policies to instance roles. Notably, IMDSv1, which accepts simple GET requests without session tokens, is particularly susceptible to SSRF-based exploitation and has been observed in active threat campaigns targeting AWS EC2 environments.
Why it matters
Instance metadata attacks represent a critical risk in cloud environments because a single exploitable vulnerability in a web application can lead directly to the compromise of cloud credentials and, from there, broader access to cloud resources. The Instance Metadata Service was designed for convenience, providing running instances with the configuration details they need, but its accessibility from within the instance creates a high-value target when application-layer controls are absent or insufficient. Because the credentials retrieved from IMDS are temporary but fully functional, attackers who obtain them can move laterally across cloud environments, access sensitive data stores, or escalate privileges before the credentials expire.
Who it's relevant to
Inside Instance Metadata Attacks
Common questions
Answers to the questions practitioners most commonly ask about Instance Metadata Attacks.