AWS Credentials Committed to a Public GitHub Repository

An access key ID and secret committed in a config file were found by an automated scanner within 4 minutes, leading to $34,000 in EC2 charges overnight.

Overview

An AWS key pushed to a public GitHub repository was found by scanners in 4 minutes and ran up $34,200 of GPU mining before it was revoked.

What happened

A developer writing a tutorial blog post committed a sample config file to a public repository. It held a real AWS access key left over from local testing. The plan was to remove it before publishing, but the push to the public branch came first.

From the push, events moved fast.

  • The developer pushed the config file to the public branch.
  • Four minutes later, automated scanners found the key.
  • Three hours later, the developer noticed and revoked the key.
  • The attacker's instances ran up 14 hours of EC2 charges, $34,200 in all.
  • Cleaning up and recovering took 3 days.

Key concepts

  • Credential scanning
  • IAM least privilege
  • Secret rotation
  • AWS Secrets Manager

Interview questions

  • You discover an AWS access key has been committed to a public GitHub repository. Walk me through your incident response.

Sign up free to read the full topic

More War Stories topics

Start free on Cariara · Coding problems · System design studio