AWS IMDSv2
¿Qué es AWS IMDSv2?
AWS IMDSv2The session-token-based replacement for the AWS EC2 Instance Metadata Service, designed to defeat SSRF-based credential theft of EC2 instance role tokens by requiring a PUT-issued, short-lived token on every request.
IMDSv2 is the second version of the EC2 Instance Metadata Service, introduced in 2019 in direct response to the Capital One breach and other SSRF-driven cloud credential theft attacks. Unlike IMDSv1, where any code on the instance — including a webserver tricked into making a GET to `http://169.254.169.254/latest/meta-data/iam/security-credentials/`— could read the instance role credentials, IMDSv2 requires the client to first issue a PUT to `/latest/api/token` with a TTL header, then include the returned session token on every metadata read. A reflected or server-side request forgery cannot easily issue both calls because the PUT requires a non-default HTTP method and a custom header, and the response is a short-lived token. IMDSv2 also lets administrators set the `HttpPutResponseHopLimit` to 1, blocking containers on the host from reaching the metadata service. As of 2023, new AWS resources and most launch templates default to `HttpTokens: required`; legacy AMIs and infra still permitting IMDSv1 remain a common Wiz/CSPM finding and an active path for cloud token theft.
● Ejemplos
- 01
An EC2 launch template sets `HttpTokens: required` and `HttpPutResponseHopLimit: 1`, blocking both IMDSv1 access and container-side metadata theft.
- 02
A CSPM finding flags every EC2 instance still allowing IMDSv1 because the legacy CentOS AMI was launched before the org-wide policy.
● Preguntas frecuentes
¿Qué es AWS IMDSv2?
The session-token-based replacement for the AWS EC2 Instance Metadata Service, designed to defeat SSRF-based credential theft of EC2 instance role tokens by requiring a PUT-issued, short-lived token on every request. Pertenece a la categoría de Seguridad en la nube en ciberseguridad.
¿Qué significa AWS IMDSv2?
The session-token-based replacement for the AWS EC2 Instance Metadata Service, designed to defeat SSRF-based credential theft of EC2 instance role tokens by requiring a PUT-issued, short-lived token on every request.
¿Cómo funciona AWS IMDSv2?
IMDSv2 is the second version of the EC2 Instance Metadata Service, introduced in 2019 in direct response to the Capital One breach and other SSRF-driven cloud credential theft attacks. Unlike IMDSv1, where any code on the instance — including a webserver tricked into making a GET to `http://169.254.169.254/latest/meta-data/iam/security-credentials/`— could read the instance role credentials, IMDSv2 requires the client to first issue a PUT to `/latest/api/token` with a TTL header, then include the returned session token on every metadata read. A reflected or server-side request forgery cannot easily issue both calls because the PUT requires a non-default HTTP method and a custom header, and the response is a short-lived token. IMDSv2 also lets administrators set the `HttpPutResponseHopLimit` to 1, blocking containers on the host from reaching the metadata service. As of 2023, new AWS resources and most launch templates default to `HttpTokens: required`; legacy AMIs and infra still permitting IMDSv1 remain a common Wiz/CSPM finding and an active path for cloud token theft.
¿Cómo defenderse de AWS IMDSv2?
Las defensas contra AWS IMDSv2 combinan habitualmente controles técnicos y prácticas operativas, como se detalla en la definición.
¿Cuáles son otros nombres para AWS IMDSv2?
Nombres alternativos comunes: EC2 Instance Metadata Service v2, IMDSv2.
● Términos relacionados
- cloud-security№ 092
Ataque a AWS IMDSv1
Robo de credenciales del rol de instancia EC2 enviando peticiones GET no autenticadas al endpoint heredado IMDSv1, normalmente mediante SSRF.
- cloud-security№ 208
SSRF al metadato de la nube
Ataque SSRF que abusa de una aplicacion vulnerable para consultar el servicio de metadatos de instancia del proveedor cloud y robar credenciales temporales.
- attacks№ 1120
Server-Side Request Forgery (SSRF)
Vulnerabilidad web que permite a un atacante hacer que el servidor realice peticiones HTTP u otras hacia recursos elegidos por él, normalmente sistemas internos.
- cloud-security№ 212
Robo de tokens en la nube
Robo de tokens OAuth, SAML o de firma desde un servicio de identidad cloud y su reutilizacion para suplantar a usuarios o servicios sin necesidad de contrasenas.
- cloud-security№ 561
Configuración incorrecta de IAM (cloud)
Ajustes inseguros o demasiado permisivos del IAM en la nube que permiten a usuarios, roles o servicios realizar acciones más allá de lo que realmente necesitan.
- cloud-security№ 209
Configuración incorrecta en la nube
Brecha de seguridad provocada por ajustes incorrectos o inseguros de servicios cloud, como almacenamiento expuesto, políticas IAM débiles o puertos de gestión abiertos.