An AWS access key is leaked. What is the response?
IntermediateConceptVulnerability Management and Incident Response
Answer
- Deactivate the key immediately:
aws iam update-access-key --access-key-id AKIA... --status Inactive --user-name ci-bot. - Revoke active sessions it may have created (attach a deny policy with
aws:TokenIssueTimecondition, or "Revoke active sessions" for roles). - Search CloudTrail for every call made with that key ID since the leak: new users, keys, roles, EC2 instances in unusual regions, S3 reads.
- Remove any persistence the attacker created and check billing for crypto-mining.
- Delete the key, fix the root cause, and move that workload to role-based temporary credentials.
AWS may also open a support case and attach AWSCompromisedKeyQuarantineV3 to the user automatically when it finds a key in a public repo.
More on Vulnerability Management and Incident Response
What are the stages of a vulnerability management lifecycle?BeginnerHow do you build a risk-based prioritisation policy for vulnerabilities?IntermediateWhat remediation SLAs are typical by severity?BeginnerHow should a vulnerability exception (risk acceptance) process work?IntermediateHow do you patch vulnerabilities in running containers?IntermediateDependabot vs Renovate: how do they differ?Beginner