Credential Rotation and Revocation

Invalidating an exposed credential and replacing it everywhere it is consumed, without an outage — the only step that actually ends a secret leak, and the one most programs never finish.

How it works

Detection, ticket closure and file deletion change nothing for an attacker; only invalidation does. The data shows how rarely that happens:

  • 64% of secrets confirmed valid in 2022 were still valid in January 2026 (GitGuardian).
  • Truffle Security disclosed 21,981 live keys from GitLab/Bitbucket; 81% still worked six months later.
  • Flare: 75% of developers who removed a secret from a Docker image never rotated it.
  • 2,600 valid TLS certs mapped to leaked private keys (GitGuardian/Google): 4,300 disclosure emails, 9% response; only 24 revoked via CRL. 84 still valid in Jan 2026.
  • CISA’s leaked GovCloud keys stayed valid 48h after the repo was pulled.
  • GitGuardian’s Enterprise Good Samaritan program (Jun–Nov 2026, 4,064 high-impact leaks at 1,588 companies): 62% of credentials valid at discovery still worked after the company was emailed, 77.8% of public leaks stayed online, 35% replied, and the median leak had been public 320 days. The commit author is often not the owner: 5% came from suppliers or contractors, and the CISA contractor’s repo ignored nine developer alerts but came down within 26 hours once CISA itself was reached. Publish a monitored disclosure channel with someone accountable behind it (GitGuardian).
  • Provider fixes don’t revoke customer secrets. Microsoft closed the Azure API Management Classic management-plane path on 19 Nov 2026 but said the fix “does not automatically invalidate credentials” already taken (Named Values, IdP/OIDC client secrets, subscription keys, management tokens); NSM told users to replace them all and verify instance runtime versions (BleepingComputer, SecurityWeek).
  • Short-lived tokens minted by an attacker can’t be revoked by rotating stored secrets: after the agent-framework stealer requested OIDC and IMDS tokens, Elastic advised rotating long-lived secrets and reviewing activity for the short-lived ones (Elastic).

Why it stalls: rotation itself is mechanical; the hard part is finding every copy and every consumer. GitGuardian’s worked example: one leaked production key had 13 copies (hardcoded fallback, config file, a stale pipeline variable that overrode the vault, a Jira ticket…) and the team knew about one. Revoke first and the next deploy breaks; update only the vault and the pipeline keeps using the old variable.

Metric

time_to_revoke = confirmed_invalidation_ts - validation_ts

Track it alongside MTTD/MTTR; MTTR can close on a ticket while the key still works.

Rotation patterns

PatternMechanismOutage risk
Dual-credential overlapTwo active keys (AWS access keys, key-pair auth): issue new, migrate consumers, validate, disable oldLow
Staged rotation (AWS Secrets Manager)Lambda steps create → set → test → finish; versions AWSPENDING → AWSCURRENT → AWSPREVIOUS for rollbackLow if the function validates the target DB/user and the pending secret before promotion (OWASP)
Dynamic / leasedVault/STS mint per-consumer creds; lease expiry revokes (Vaults and Secret Stores)Very low
Single-credential swap with revertPlatforms allowing one password per account: rotate, owner validates, temporary revert path if it breaksMedium — revert path is what keeps owners willing to rotate
Mounted-secret refreshSecrets Store CSI Driver --enable-secret-rotation=true; app must re-read the file or restartMedium

Incident runbook (leaked credential)

  1. Validate read-only (who/what is it: aws sts get-caller-identity), record timestamp.
  2. Scope: permissions, consumers, every copy (code, CI vars, vault, tickets, chat, images, endpoints), owner.
  3. Revoke/rotate in blast-radius order — cloud keys and roles first; issue the replacement into a secret manager or an OIDC role, not a new .env line.
  4. Confirm the old credential fails; review provider logs from the exposure time, not the detection time.
  5. Clean up history/artifacts afterwards (Secrets in Git History).

For mass events, platforms push keys to issuers for bulk revocation: Railway sent leaked customer keys to GitHub, GitLab, Anthropic, OpenAI, OpenRouter and Stripe, rotated all its own keys twice, and paused deploys; >100,000 users may have had keys revoked upstream. Truffle Security’s revocation program and the GitHub partner program let issuers auto-revoke what scanners find.

Inventory first (SCALER)

For service accounts at scale: Scale (discover accounts and where creds spread, using login history) → Classify (tie to app) → Assign (named owner) → Lifecycle (expiry with warnings) → Enforce → Rotate. Skipping a stage reappears later as an outage. Pre-rotation checklist: valid? exposed where? scope? consumers? vaulted? duplicates? owner? rollback plan?

Sources