As part of our ongoing commitment to customers, AWS is providing this security incident response playbook that describes the steps needed to detect and respond to compromised credentials within your AWS account(s). The purpose of this document is to provide prescriptive guidance on the actions to take once you suspect a security event has taken place.

Aspects of AWS incident response
In order to quickly and effectively execute incident response activities, it is crucial to prepare the people, processes, and technology within your organization. Review the AWS Security Incident Response Guide, and implement the steps required to help ensure preparedness of all three domains.
It is important that you notify AWS as soon as you suspect a compromised credential(s) within your AWS account or Organization. Here are the steps to engage AWS Support:
Note: It is very important to verify your ‘Alternate Security Contact’ is defined for each AWS account. For more details, please refer to this article.
There are multiple ways to detect compromised credentials within your AWS environment. Listed are some ways to detect potential Indicators of Compromise (IoC). For a detailed list of IoC’s please refer to appendix A. Note: Document the details of each suspected IoC for further analysis.
Review AWS Billing for unusual spikes which can be a sign of account and credential(s) compromise by following these steps:
Download the IAM credentials report by going to the IAM console and choose the “Credential report” on the left under “Access reports” then review the following:
Review IAM Roles within the AWS account, to identify any unfamiliar roles that have been created or accessed
| EC2 instances by running the following command in the AWS CLI terminal “aws ec2 describe-instances” and validate the results. Look for the creation time for each instance using the *–query ‘Reservations[].Instances[].{ip: PublicIpAddress, tm: LaunchTime}’ –filters ‘Name=tag:Name,Values= myInstanceName’ | jq ‘sort_by(.tm) | reverse | .[0]’* filter. |
| Lambda functions by running the following command in the AWS CLI terminal “aws lambda list-functions” and validate the last modified time by using the “ | grep “LastModified”” filter. |
Review any security notifications from AWS about your account by signing into AWS Support Center then reading and responding to the message(s).
Once you have identified any suspicious resources or activity that may indicate compromise, perform further analysis in your SIEM, or log analysis tools. AWS has various security services tools to aid in analyzing security events. Some of these tools include:
Amazon Guardduty - Amazon GuardDuty is a threat detection service that continuously monitors for malicious activity and unauthorized behavior to protect your AWS accounts, Amazon Elastic Compute Cloud (EC2) workloads, container applications, Amazon Aurora databases, and data stored in Amazon Simple Storage Service (S3).
AWS Security Hub - AWS Security Hub is a cloud security posture management (CSPM) service that performs automated, continuous security best practice checks against your AWS resources to help you identify misconfigurations, and aggregates your security alerts (i.e. findings) in a standardized format so that you can more easily enrich, investigate, and remediate them.
Amazon Detective - Amazon Detective makes it easier to analyze, investigate, and quickly identify the root cause of potential security issues or suspicious activities.
You can also search your AWS CloudTrail event history, by following these steps to analyze and gather evidence:
After analyzing and gathering more information about the compromised credential(s) and any other affected resources, it’s time to control and suppress the security event.
Add the following policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": "*",
"Resource": "*",
"Condition": {
"StringEquals": {
"identitystore:userId": "example"
},
"DateLessThan": {
"aws:TokenIssueTime": "2023-09-26T15:00:00.000Z"
}
}
}
]
}
Click ‘Create policy’ and add the following policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Deny",
"Action": [
"*"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"identitystore:userId": "Add user ID here"
}
}
}
]
}
Application sessions are created when a user accesses a third-party application or AWS service directly from the access portal.
To revoke application sessions, review the documentation of the application that was accessed.
If your Identity provider is compromised, you should block access to Identity Center from a compromised identity provider (i.e. external SAML-based Identity Provider or Active Directory) by changing the identity source to ‘Identity Source directory’.
To change your identity source: 1. Navigate to the Identity Center console 2. Select ‘Settings’ 3. On the Settings page, click on the ‘Identity source’ tab 4. Click on the ‘Actions’ button and then select ‘Change identity source’ 5. Select ‘Identity Center directory’ on the ‘Choose identity source’ page 6. Click on the ‘Next’ button 7. Read the information contained in the ‘Review and confirm’ box, 8. Type ‘ACCEPT’ in the appropriate field, and click on the ‘Change identity source’ button
Please note, If you are accessing AWS via 3rd Party Identity Provider, be sure to audit the access logs and follow that vendors guidance on responding to an event and securing your environment.
Also, If you are changing from Active Directory to the Identity Center directory, all users and groups will be deleted. Permission sets will not be deleted, but permission set assignments will be deleted. If you are changing from an external SAML-based identity provider, all users and groups will remain populated in Identity Center as will the permission set assignments.
Once you are done with containing the security event, it’s time to work on removing and cleaning the cause of the security event.
Remove any resources created by the compromised key(s) which were detected in the “Analysis phase step 1”. Check all AWS regions, even regions where you do not launch AWS resources in. If you need to keep a resource for investigation, consider backing them up.
Remove unnecessary permissions from logging S3 buckets or log aggregation resources identified in “Detection phase step 6” that could be used to avoid detection. This lets you identify unintended access to your resources and data.
Remove any exposed data that is not needed for operations.
Once you are done with eradicating the security event causes. It’s time to restore the affected resources into a good-known state.
If necessary, rebuild systems from scratch, including redeploying from trusted source using automation, sometime in a new AWS account.
After you verify your email address, you can continue authenticating your account. To verify your primary contact phone number, choose Call me now.
After you verify your phone number, you can sign in to your account by choosing Sign in to the console.
Confirm that IAM principals have appropriate access and permissions following the security event.
Address vulnerabilities and install the necessary patches using AWS SSM patch manager or any other 3rd party tool you use.
After you have successfully recovered from the security incident, you should conduct the exercises outlined in AWS Security Incident Response Guide, Post-Incident activity. This will help you document lessons learned from the incident, measure and improve the effectiveness of your incident response capabilities, and implement additional controls to prevent a similar incident from recurring.
In this playbook, we have described the initial steps to take when a compromised credential security event occurs within your AWS account(s). This includes engaging AWS support, detecting a compromise, analysis of events within your account(s), containing the security event, eradicating the threat, recovering your account(s) to a “known-good” operational state, and post-incident activities including lessons learned. As a next step, please review the following AWS resources, to help improve your Incident response capabilities:
CloudTrail Log Structure
When searching through CloudTrail logs, it is important to understand the various fields contained within a CloudTrail event record. For a full list, please refer to the official CloudTrail documentation.
| Field | Description |
|---|---|
| eventTime | The date and time the request was completed, in coordinated universal time (UTC). |
| eventName | The requested action, which is one of the actions in the API for that service |
| eventSource | The service that the request was made to. This name is typically a short form of the service name without spaces plus .amazonaws.com. |
| userIdentity | Information about the IAM identity that made a request. For more information, see CloudTrail userIdentity element. |
| resources | A list of resources accessed in the event. The field can contain the following information:
|
| awsRegion | The AWS Region that the request was made to, such as us-east-2 |
| sourceIPAddress | The IP address that the request was made from. For actions that originate from the service console, the address reported is for the underlying customer resource, not the console web server. |
Events
There are a number of actions threat actors will perform after compromising account credentials. While it is impractical to list every possible action, here are some patterns to search for during your investigation.
Note: The API actions below do not necessarily indicate a security incident has occurred. Evaluate all logged activity within the context of your investigation.
Changes to SAML / OIDC identity provider configuration
Threat actors may create or modify SAML/OIDC identity provider configurations to avoid detection and maintain persistence within your cloud environment.
| API Action | Description |
|---|---|
| iam:CreateSAMLProvider | Creates an IAM resource that describes an identity provider (IdP) that supports SAML 2.0 |
| iam:DeleteSAMLProvider | Deletes a SAML provider resource in IAM. |
| iam:UpdateSAMLProvider | Updates the metadata document for an existing SAML provider |
| iam:CreateOpenIDConnectProvider | Creates an IAM entity to describe an identity provider (IdP) that supports OpenID Connect (OIDC). |
| iam:AddClientIDToOpenIDConnectProvider | Adds a new client ID (also known as audience) to the list of client IDs already registered for the specified IAM OpenID Connect (OIDC) provider resource |
| iam:DeleteOpenIDConnectProvider | Deletes an OpenID Connect identity provider (IdP) resource object in IAM |
| iam:RemoveClientIDFromOpenIDConnectProvider | Removes the specified client ID (also known as audience) from the list of client IDs registered for the specified IAM OpenID Connect (OIDC) provider resource object |
| iam:UpdateOpenIDConnectProviderThumbprint | Replaces the existing list of server certificate thumbprints associated with an OpenID Connect (OIDC) provider resource object with a new list of thumbprints |
Changes to IAM Configuration
Threat actors may create or modify IAM principals, credentials, or permissions to avoid detection or maintain persistence in your cloud environment.
| API Action | Description |
|---|---|
| iam:ChangePassword | Changes the password of the IAM user who is calling this operation |
| iam:CreateUser | Creates a new IAM user for your AWS account |
| iam:CreateRole | Creates a new role for your AWS account |
| iam:CreateGroup | Creates a new group |
| iam:AttachUserPolicy | Attaches the specified managed policy to the specified user |
| iam:AttachRolePolicy | Attaches the specified managed policy to the specified IAM role |
| iam:AttachGroupPolicy | Attaches the specified managed policy to the specified IAM group |
| iam:ListAccessKeys | Returns information about the access key IDs associated with the specified IAM user |
| iam:CreatePolicyVersion | Creates a new version of the specified managed policy |
| iam:UpdateLoginProfile | Changes the password for the specified IAM user |
| iam:CreateAccessKey | Creates a new AWS secret access key and corresponding AWS access key ID for the specified user |
| iam:UpdateAccessKey | Changes the status of the specified access key from Active to Inactive, or vice versa. |
| iam:DeactivateMFADevice | Deactivates the specified MFA device and removes it from association with the username for which it was originally enabled |
Changes to Logging & Monitoring Configurations
Threat actors may disable resource monitoring or delete logs to avoid detection or deter incident investigations.
| cloudtrail:DeleteTrail | Deletes a trail – disabling the delivery of CloudTrail events to an Amazon S3 bucket, CloudWatch Logs, or Amazon EventBridge |
|---|---|
| cloudtrail:StopLogging | Suspends the recording of AWS API calls and log file delivery for the specified trail |
| cloudtrail:UpdateTrail | Updates the settings that specify delivery of log files |
| cloudtrail:DeleteEventDataStore | Deletes a CloudTrail Lake Event Date Store |
| GuardDuty:DeleteDetector | Deletes an Amazon GuardDuty detector and disables GuardDuty in a particular region |
| GuardDuty:DeletePublishingDestination | Deletes the publishing destination, where findings are exported to |
| accessanalyzer:DeleteAnalyzer | Deletes the specified analyzer, disabling the IAM access analyzer service for that region. |
| config:DeleteConfigRule | Deletes the specified AWS Config rule and all of its evaluation results |
| config:DeleteConfigurationRecorder | Deletes the AWS Config configuration recorder |
| config:DeleteDeliveryChannel | Deletes the AWS Config delivery channel |
| config:StopConfigurationRecorder | Stops recording configurations and configuration changes for the specified recording group |
S3 Bucket Configuration Changes
Threat actors may modify or delete S3 bucket configurations in order to exfiltrate data.
| S3:ListBuckets | Returns a list of all buckets owned by the authenticated sender of the request |
|---|---|
| S3:CreateBucket | Creates a new bucket |
| S3:DeleteBucketPublicAccessBlock | Removes the PublicAccessBlock configuration for an Amazon S3 bucket |
| S3:PutBucketPolicy | Adds or updates a policy on a bucket |
| S3:DeleteBucketPolicy | Deletes the policy from the bucket |
| S3:PutObjectAcl | Sets the access control list (ACL) permissions for an object in an Amazon S3 bucket |
| S3:DeleteObjectAcl | Delete the access control list (ACL) of an object |
| S3:PutBucketCORS | Sets the CORS configuration for your bucket |
| S3:DeleteBucketCORS | Deletes the CORS configuration information set for the bucket |
| S3:PutBucketEncryption | Configure default encryption and Amazon S3 Bucket Keys for an existing bucket |
| S3:DeleteBucketEncryption | Resets the default encryption for the bucket as server-side encryption with Amazon S3 managed keys (SSE-S3) |
Other Actions
Here are some other actions that you should highlight during your investigation
| kms:DisableKey | Sets the state of a KMS key to disabled. This change temporarily prevents use of the KMS key for cryptographic operations. |
|---|---|
| kms:ScheduleKeyDeletion | Schedules the deletion of a KMS key. |
| kms:PutKeyPolicy | Attaches a key policy to the specified KMS key. Key policies are the primary way to control access to KMS keys. |
| kms:CreateKey | Creates a unique customer managed KMS key in your AWS account and Region. |
| EC2:DescribeInstances | Describes EC2 instances within your account. |
| EC2:RunInstances | Launches EC2 instances within your account. |
| EC2:CreateVpc | Creates a VPC within your account. |
| EC2:DescribeVpcs | Describes VPCs within your account. |
| EC2:CreateSecurityGroup | Creates a security group. A security group acts as a virtual firewall for your instance to control inbound and outbound traffic. |
| EC2:DeleteSecurityGroup | Deletes a security group. |
| RDS:CreateDBInstance | Creates an RDS database instance. |
| RDS:DeleteDBInstance | Deletes an RDS database instance. |