Check ID: ec2_instance_imdsv2_enabled
Provider: AWS
Service: ec2
Severity: HIGH
Categories: identity-access, secrets
Resource type: AwsEc2Instance

What this check verifies

EC2 instances are evaluated for IMDSv2 enforcement: metadata endpoint enabled with http_tokens: required, or metadata service fully disabled (http_endpoint: disabled).

Risk

Permitting IMDSv1 or optional tokens lets SSRF or compromised workloads retrieve temporary IAM credentials, impacting confidentiality and integrity. Stolen role creds can drive privilege escalation, unauthorized data access, and lateral movement across AWS resources.

Recommendation

Apply defense in depth:
  • Require IMDSv2 tokens on all instances (http_tokens: required)
  • Disable metadata where not needed (http_endpoint: disabled)
  • Minimize hop limit to 1 when feasible
  • Update SDKs/apps for IMDSv2
  • Restrict instance profile permissions (least privilege)
  • Block metadata access from untrusted workloads

Remediation

aws ec2 modify-instance-metadata-options —instance-id <instance-id> —http-tokens required —http-endpoint enabled

References

Where this check fires

This check runs on every scheduled scan against your AWS account. Findings appear at Cloud Security → Findings filterable by Check ID = ec2_instance_imdsv2_enabled. To re-evaluate after a fix, hit Run now on the account’s schedule under Cloud Security → Schedules — the next scan re-checks this control and marks the finding fixed or keeps it persistent.
← Back to AWS checks