Home/Refreshers/Incident response on AWS: refresher
Incident response on AWS
What CloudTrail records by default, how to follow a key or a role session, and the first moves for each kind of compromise.
Remember
- Event history keeps 90 days of management events per Region with no trail. Data events, such as S3 reads, need a trail and cost extra.
- AKIA is a long-term user key. ASIA is temporary; the AssumeRole event that issued it records it in responseElements.
- sourceIdentity names the person and survives every chained role.
- Revoking a role's sessions denies every credential issued before now. It does not work on service-linked roles.
- Identity Center role sessions last up to 12 hours after the user is disabled. Keep a deny in place that long.
Commands
| Everything one key did | aws cloudtrail lookup-events --lookup-attributes AttributeKey=AccessKeyId,AttributeValue=<key> |
| New access keys | aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=CreateAccessKey |
| Deactivate a key | aws iam update-access-key --user-name <user> --access-key-id <key> --status Inactive |
| Snapshot every volume | aws ec2 create-snapshots --instance-specification InstanceId=<id> |
Watch out
- Changing a security group does not end open connections. A network ACL does.
- Termination protection does not stop an Auto Scaling group or a Spot interruption.
- Event history is per Region. Check the ones you do not use.
Check it worked
A test access key made in a sandbox account appears in the lookup within minutes.