Account default for instance metadata does not require IMDSv2

Severity
Medium
Service
EC2
Check ID
EC2_IMDSV2_NOT_DEFAULT

What this check finds

The account-level instance metadata default does not require tokens (IMDSv2), so new EC2 instances launch accepting IMDSv1 unless the launch request overrides it. IMDSv1 is the path most SSRF-to-credential-theft attacks take. Per-instance enforcement fixes today's instances; this fixes every future one.

Passing looks like: Account default requires IMDSv2.

How to fix it

Set the account default to required.

AWS CLI

  1. aws ec2 modify-instance-metadata-defaults --http-tokens required --http-endpoint enabled

Names in capitals are placeholders for your own resource. Review a command before you run it.

AWS console

EC2 → EC2 Dashboard → Data protection and security → IMDS defaults → Manage.

Compliance controls it is evidence for

A failing result counts against these controls in KloudLytics; a passing one is evidence towards them. How compliance mapping works

Compliance controls mapped to Account default for instance metadata does not require IMDSv2
FrameworkControls
CIS AWS Foundations Benchmark v5.0.0
  • 5.7 Ensure that the EC2 Metadata Service only allows IMDSv2
NIST SP 800-53 Rev5 (Moderate)
  • CM-6 Configuration Settings
  • SC-7 Boundary Protection
NIST Cybersecurity Framework 2.0
  • PR.IR-01 Networks and environments are protected from unauthorized logical access and usage
  • PR.PS-01 Configuration management practices are applied
ISO/IEC 27001:2022 Annex A
  • A.8.9 Configuration management
  • A.8.20 Networks security

Checked on every scan

KloudLytics runs this check each time it scans a connected AWS account, through a read-only role, and lists every affected resource with its region. On Pro and Business a fix is written for the specific resource rather than the general case above. The exact access it needs

More EC2 checks

All EC2 checks

Find out what is actually exposed in your AWS environment.

Connect one AWS account and run your first security assessment.

No credit card · Agentless · Read-only