From Exposure to Lockdown: How AWS Neutralizes Compromised IAM Credentials through Managed Policies

From Exposure to Lockdown: How AWS Neutralizes Compromised IAM Credentials through Managed Policies
AWSCompromisedKeyQuarantine is an AWS managed policy that automatically quarantines publicly exposed IAM access keys and has evolved from v1 to v3 to deny more high-risk actions as cloud attack tactics changed. The article also explains how GitHub secret scanning, push protection, and validity checks interact with AWS to detect exposed credentials quickly and trigger quarantine, notifications, and investigation workflows. #AWSCompromisedKeyQuarantine #GitHub #AWS

Keypoints

  • AWSCompromisedKeyQuarantine is automatically attached when AWS detects exposed IAM access keys or secrets, limiting misuse through explicit Deny permissions.
  • The managed policy evolved from v1 in 2020 to v2 in 2021 and v3 in 2024, with each version expanding protections against emerging attack patterns.
  • A real-world exposure test showed AWS attaching AWSCompromisedKeyQuarantineV3 within 10 seconds of a key being pushed to a public GitHub repository.
  • GitHub secret scanning and push protection detected the exposed key, generated alerts, and sent notifications alongside AWS Health and Support events.
  • CloudTrail logs can be used to detect quarantine events through the AttachUserPolicy event and the PolicyArn field for the managed policy.
  • The policy’s evolution reflects attacker behavior, including cryptomining, S3 destructive activity, and abuse of Amazon Bedrock APIs.
  • Security teams are advised to monitor GitHub ASN traffic, STS GetCallerIdentity checks, and AWS support/health alerts to speed incident response.

MITRE Techniques

  • [T1078 ] Valid Accounts – Exposed AWS IAM access keys were used as long-term credentials for command-line access to an IAM user (‘Access keys grant long-term command line interface (CLI) access to an IAM user.’).
  • [T1589.001 ] Gather Victim Identity Information: Credentials – Threat actors targeted exposed AWS access keys and secrets in public repositories and environment files (‘access keys and secrets exposed in public GitHub repositories or through other notices’).
  • [T1074.001 ] Data Staged: Local Data Staging – Sensitive credentials were staged into a public GitHub repository during the exposure test (‘Access key and secret successfully pushed to public GitHub Repository’).
  • [T1110 ] Brute Force – The article describes GitHub validity checks and STS calls used to test whether exposed credentials remain active (‘GitHub also performs GET requests with the exposed credentials to confirm the credential’s validity’).
  • [T1098 ] Account Manipulation – The policy directly denies actions such as creating users, roles, and access keys to block account modification after compromise (‘iam:CreateUser’, ‘iam:CreateRole’, ‘iam:CreateAccessKey’).
  • [T1496 ] Resource Hijacking – The policy additions were influenced by cryptomining activity and EC2/Lightsail abuse (‘AWS uncovered a cryptomining campaign’).
  • [T1485 ] Data Destruction – The policy added S3 deletion restrictions to prevent attackers from deleting data after exfiltration (‘threat actors delete data from S3 buckets after exfiltration’).
  • [T1528 ] Steal Application Access Token – The article notes exposed secrets being checked and quarantined through automated service-provider workflows (‘identify exposed credentials’).

Indicators of Compromise

  • [User Agents] AWS credential validity checks from GitHub/secret scanning activity – aws-sdk-go-v*/*.*.* os/linux lang/go#*.*.* md/GOOS#linux md/GOARCH#amd64 api/sts#*.*.* GHAS-AWS_KEYID-validation-1.0.0-This-call-originates-from-an-automated-process-that-tests-AWS_KEYIDs-committed-to-GitHub-repos.-Please-contact-secret-scanning-github.com-for-more-info., aws-sdk-go-v*/*.*.* os/linux lang/go#*.*.* md/GOOS#linux md/GOARCH#amd64 api/sts#*.*.* GHAS-AWS_KEYID-validation-1.0.0-This-call-originates-from-an-automated-process-that-tests-AWS_KEYIDs-committed-to-GitHub-repos.-For-questions-on-our-processes–please-contact-secret-scanning-github.com.
  • [AWS API Events] Exposure validation and quarantine activity in CloudTrail – GetCallerIdentity, AttachUserPolicy, CreateUser, CreateAccessKey.
  • [AWS Managed Policy Names] Quarantine policies attached to exposed IAM users – AWSCompromisedKeyQuarantine, AWSCompromisedKeyQuarantineV2, AWSCompromisedKeyQuarantineV3.
  • [AWS Console / Support Artifacts] Notifications and support handling for exposed keys – Risk IAM quarantine, AWS Health alert, Support case.
  • [GitHub Security Signals] Secret scanning and push protection alerts – public GitHub repository, public npm packages, push protection notification.


Read more: https://unit42.paloaltonetworks.com/detecting-exposed-aws-iam-credentials/