AWS IMDSv2
Qu'est-ce que 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.
● Exemples
- 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.
● Questions fréquentes
Qu'est-ce que 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. Cette notion relève de la catégorie Sécurité du cloud en cybersécurité.
Que signifie 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.
Comment fonctionne 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.
Comment se défendre contre AWS IMDSv2 ?
Les défenses contre AWS IMDSv2 combinent habituellement des contrôles techniques et des pratiques opérationnelles, comme détaillé dans la définition ci-dessus.
Quels sont les autres noms de AWS IMDSv2 ?
Noms alternatifs courants : EC2 Instance Metadata Service v2, IMDSv2.
● Termes liés
- cloud-security№ 092
Attaque AWS IMDSv1
Vol des identifiants de role d'instance EC2 via des requetes GET non authentifiees vers l'endpoint historique IMDSv1, generalement par SSRF.
- cloud-security№ 208
SSRF sur metadonnees cloud
Attaque SSRF qui exploite une application vulnerable pour interroger le service de metadonnees de l'instance du fournisseur cloud et voler des identifiants temporaires.
- attacks№ 1120
Server-Side Request Forgery (SSRF)
Vulnérabilité web permettant à un attaquant de pousser un serveur à émettre des requêtes HTTP ou réseau vers des destinations qu'il choisit, souvent des systèmes internes.
- cloud-security№ 212
Vol de tokens cloud
Vol de tokens OAuth, SAML ou de signature aupres d'un service d'identite cloud et rejeu pour usurper utilisateurs ou services sans avoir besoin de mots de passe.
- cloud-security№ 561
Mauvaise configuration IAM (cloud)
Paramètres IAM cloud non sécurisés ou trop permissifs qui permettent à des utilisateurs, rôles ou services d'effectuer plus d'actions qu'ils n'en ont réellement besoin.
- cloud-security№ 209
Mauvaise configuration cloud
Faille de sécurité due à des réglages incorrects ou non sécurisés des services cloud : stockage exposé, politiques IAM faibles, ports d'administration ouverts, etc.