🔑 Rotation Risks

What Happens If You Don't Rotate API Keys
Real Risks, Real Breaches

A key you never rotate is a key that's valid forever, including the version of it that leaked to a public commit two years ago. Here's what attackers actually do with stolen keys, why detection rarely saves you, and what scheduled rotation actually limits.

The scale of the leak problem

Detection-only strategies are losing. Limiting the exposure window is the control that scales.

12.8M

new secrets detected in public GitHub commits in a single year

GitGuardian State of Secrets Sprawl 2024

Under 1 min

typical time from committing an AWS key publicly to first probe attempt

Truffle Security and GitGuardian honeypot research

$4.88M

average cost of a data breach involving compromised credentials

IBM Cost of a Data Breach Report 2024

What an attacker actually does with a stolen key

The damage varies by key type. The pattern is consistent.

🤖

OpenAI / Anthropic keys

Inference runs against your quota or balance until exhausted. A single weekend on a leaked key with no spend cap can cost $5,000 to $50,000 depending on the model.

☁️

AWS / GCP / Azure keys

Spin up GPU or compute fleets to mine cryptocurrency or to launch attacks. Bills hit five or six figures before detection. Cloud providers sometimes waive charges, sometimes don't.

💳

Payment processor keys

Create test charges to validate the key, then move on to fraudulent charges, refunds routed to attacker cards, and exfiltration of customer payment metadata.

📨

Email / messaging API keys

SendGrid, Twilio, Mailgun keys get used for phishing campaigns from your verified sender domain. Your IP and domain reputation tank. Your customers receive phishing emails.

🗄️

Database and admin tokens

Read access to user records, password hashes, API logs. Quiet exfiltration is the norm, often discovered months later when records show up on a breach forum.

📊

Analytics and SaaS tokens

Stripe metrics, Mixpanel data, Segment streams. Competitive intelligence is the goal: attacker reads your funnel, revenue, churn, and customer list at their leisure.

How keys actually leak (it's rarely just git)

Every team writes a strict policy banning secrets in source control. Most teams hold that line. Keys still leak. The reason: there are more leak channels than the obvious one.

Where leaks actually happen

  • Git history: committed years ago, removed from HEAD, still searchable in the repo's history
  • Public forks: contractor forked the repo, committed a key, made the fork public
  • Error logs: a stack trace dumps the key into Sentry, Datadog, or CloudWatch
  • Browser dev tools: recorded during user research or screen shares
  • Frontend bundles: a "secret" key shipped to the browser instead of the backend
  • CI / CD logs: echo $API_KEY in a build script, log retained indefinitely
  • Support tickets: screenshots, paste of an env file, "here's my config" message
  • Contractor laptops: .env files persist long after the contract ends
  • Database backups: a config table exported with a backup, dropped on shared storage
  • Compromised dependencies: a malicious package exfiltrates process.env on install

You cannot reasonably close every channel. Rotation is the compensating control. It says: we accept that leaks happen, and we cap the useful lifetime of every key so the leak eventually goes cold on its own.

The cost math for skipping rotation

A 90-day rotation costs roughly 30 minutes of engineering time per key, every 90 days. For a team with 20 production keys, that's about 10 hours per quarter. The cost of one successful breach is in IBM's most recent report: $4.88 million on average.

That math is heavily skewed for any team with revenue: spending 10 hours a quarter to meaningfully reduce the probability of a seven-figure incident is one of the cheapest risk reductions available. The reason it doesn't happen consistently isn't cost. It's memory. People forget tasks scheduled 90 days out.

Limit the window. Rotate before the next leak.

See the main API key rotation reminder page for the full picture, or read the rotation checklist for the process that runs every 90 days.

Set a 90-day reminder. The leak might already be live. The next rotation closes it.

Create a Reminder

Done in seconds. No sign-up required.

Common questions about API key leak consequences

What happens if an API key gets leaked?

A scraper finds it within minutes. Public GitHub commits, in particular, are continuously crawled by bots that test exposed keys against the matching service. Once validated, the key gets used or sold. For OpenAI and cloud provider keys, attackers run inference or mining workloads on your account. For data API keys, they extract whatever the key can read.

How fast are leaked keys exploited?

Research from Truffle Security and GitGuardian has shown that a freshly committed AWS access key in a public repo is typically probed within minutes. Some report exploitation in under a minute. The attack surface is automated, so the lag is essentially zero.

What can an attacker do with a stolen API key?

Whatever the key is scoped to do. For OpenAI: run inference until your quota or balance is exhausted. For AWS: spin up GPU instances for mining or launch attacks from your infrastructure. For Stripe live keys: create charges, refund to attacker cards, exfiltrate customer payment metadata. For database keys: read or modify customer data.

Why doesn't my API provider just stop the abuse?

Major providers do detect some abuse and suspend keys when patterns trip their fraud systems, but detection lags hours to days, and the bill is often already in the thousands. Cloud providers will sometimes waive charges for first-time leaks if you have proof of when the leak happened and how quickly you rotated. Sometimes is not always.

If I never push secrets to git, am I safe?

You're safer. You are not safe. Keys also leak through error logs sent to external monitoring services, screenshots in support tickets, browser dev-tools network panels recorded during user research, contractor laptops, third-party CI logs, leaked database backups, and dependency packages that exfiltrate env vars. Rotation is the assumption-of-compromise control.

Does scheduled rotation actually help?

It caps the useful life of any stolen key. A key compromised on day one of a 90-day cycle has at most 90 days of attack value. Without rotation, the attack window is forever. You can't catch every leak, but you can limit how long each one stays profitable.

Close the Window on the Next Leak

Set a free 90-day API key rotation reminder. No account. Just an email that follows up until you've actually rotated.

Create API Key Rotation Reminder

Last modified: