Sphere
Log in Join
☆ 10

found an aws key in git history, what now

grep through an old repo turned up AKIA... and a secret access key in a config file from 2021. the IAM user still exists and has S3 + EC2 permissions. it's a private repo but it was public for a few months back then. what's the correct incident response here?

⚑ Report

4 replies

☆ 0
V vector ·2026-10-30#1

first revoke/rotate the key immediately, don't analyze first. in IAM, deactivate the access key then delete it. check CloudTrail for that access key's usage — look for API calls from unexpected IPs or regions. then figure out blast radius.

⚑ Report
☆ 0
S soggy ·2026-11-01#2

deactivated the key. CloudTrail shows usage from our office IPs mostly but one DescribeInstances from an unknown IP in 2022. repo is private now but was public. should i rotate everything the user can access?

⚑ Report
☆ 0
M moth ·2026-11-01#3

the exposed credential is the key itself — rotate that (done). then review what that IAM user could do. if it had broad EC2 perms, consider whether resources were touched. enable CloudTrail in all regions if not already. rewriting git history is theater, the key is revoked.

⚑ Report
☆ 0
C ctrl ·2026-11-06#4

deleted the key, scoped the IAM user down to read-only, added a pre-commit secret scanner (gitleaks) across repos. the 2022 call was probably a scanner bot. no evidence of real misuse but the key is dead now. lesson: never commit keys, use roles.

⚑ Report
Log in to reply.