Lion Cipher Lab

Enforce IMDSv2 to block metadata credential theft

Why it matters

Almost every serious AWS breach story has the same middle chapter: an attacker who could only make the server fetch a URL (an SSRF bug) pointed it at 169.254.169.254 and walked away with the instance's IAM role credentials. That is essentially the 2019 Capital One breach. The metadata service is a genuinely useful feature — it is how an instance learns its own role's temporary keys without you hard-coding secrets — but the original version (IMDSv1) hands those keys to anyone who can make a plain GET. IMDSv2 closes that door with a design that an SSRF attacker almost never satisfies. Knowing…

What you'll learn

Steps in this lab

  1. What IMDS is, and why it is the crown jewels
  2. Why IMDSv1 is a gift to SSRF
  3. Launch a throwaway box (and keep it free)
  4. See the theft: pull the credentials over IMDSv1
  5. Enforce IMDSv2 — require the token
  6. Prove it: the old GET now 401s, the token flow still works
  7. The hop limit is the control that matters for containers
  8. Make IMDSv2 the default for every new instance
  9. Judgment: what IMDSv2 does NOT do — and the teardown

Open the full interactive lab →