AWS IMDSv2
Что такое 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.
● Примеры
- 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.
● Частые вопросы
Что такое 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. Относится к категории Облачная безопасность в кибербезопасности.
Что означает 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.
Как работает 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.
Как защититься от AWS IMDSv2?
Защита от AWS IMDSv2 обычно сочетает технические меры и операционные практики, как описано в определении выше.
Какие есть другие названия AWS IMDSv2?
Распространённые альтернативные названия: EC2 Instance Metadata Service v2, IMDSv2.
● Связанные термины
- cloud-security№ 092
Атака на AWS IMDSv1
Кража учетных данных роли инстанса EC2 через неаутентифицированные GET-запросы к устаревшему эндпойнту IMDSv1, обычно посредством SSRF.
- cloud-security№ 208
SSRF к облачным метаданным
Атака подделки серверных запросов, при которой через уязвимое приложение виртуальная машина обращается к сервису метаданных облачного провайдера и крадет временные учетные данные.
- attacks№ 1120
Подделка запросов на стороне сервера (SSRF)
Веб-уязвимость, позволяющая злоумышленнику заставить сервер выполнять HTTP- или иные сетевые запросы по выбору атакующего, как правило к внутренним системам.
- cloud-security№ 212
Кража облачных токенов
Хищение OAuth-, SAML- или подписывающих токенов у облачной службы идентификации и их повторное использование для выдачи себя за пользователей или сервисы без паролей.
- cloud-security№ 561
Неправильная настройка IAM (облако)
Небезопасные или избыточно разрешающие настройки облачного IAM, позволяющие пользователям, ролям или сервисам выполнять действия за пределами реальных потребностей.
- cloud-security№ 209
Неправильная настройка облака
Брешь в безопасности из-за некорректных или небезопасных настроек облачных сервисов: открытое хранилище, слабые IAM-политики, доступные порты управления и т. п.