How Slack moved its EC2 fleet from IMDSv1 to IMDSv2
Slack runs about 60,000 EC2 instances across 17 AWS regions and hundreds of AWS accounts. The Instance Metadata Service (IMDS)[1] exposes information about an instance, including IAM credentials, which an attacker could use to reach other Slack services if the instance is compromised. AWS released IMDSv2 in 2019, and every request to it is protected by session authentication.
IMDSv1 supports simple GET requests, so a Server Side Request Forgery (SSRF)[2] vulnerability in an application on an instance can be used to extract credentials. IMDSv2 requires a PUT request to obtain a token with a set TTL, and then GET requests that include that token in a header.
To find out which instances still used IMDSv1, Slack used the MetadataNoToken CloudWatch metric and an internal application that sent the data to Prometheus. The team then updated scripts and libraries to IMDSv2-compatible versions, and the number of instances using IMDSv1 dropped sharply. For new instances, Slack added a shared Terraform module that controls whether IMDSv1 is kept or turned off, and it began blocking the launch of IMDSv1 instances with service control policies (SCPs)[3].
Slack shares (CRM)
179.81 USD −1.5% since the news day, December 3
Close on December 4 Quotes: CNBC
Read the original slack.engineeringDiscussion
Sources
-
slack.engineering
Our Journey Migrating to AWS IMDSv2





