Toutes les vulnérabilités
CRITICALOpSeccurated

OPSEC-CIRCLECI-2023

CI/CD · CircleCI

Résumé

CircleCI runs the build pipelines for thousands of engineering teams, which means it holds their deepest secrets: the deploy keys, API tokens, and credentials that move code to production. In December 2022, all it took to reach those was malware on one engineer's laptop. An infostealer that antivirus never caught lifted a valid, 2FA-protected login session straight out of the engineer's browser, letting the attacker walk in as that engineer with the second factor already satisfied. They reached production stores of customer secrets, forcing CircleCI to tell every customer to rotate every credential they had ever stored. It is the lesson that a stolen session cookie bypasses MFA, and that one infected laptop can compromise thousands of pipelines.

How it happened

The entry point was infostealer malware on a CircleCI engineer's laptop, which the company's antivirus did not detect. The malware stole a valid SSO session cookie, and crucially, that session was already backed by two-factor authentication. Because a session cookie represents an already-authenticated session, replaying it (session hijacking) let the attacker impersonate the engineer and bypass the second factor entirely, no re-authentication required. The engineer had privileges to generate production access tokens, which the attacker used to reach the secret stores.

With that access, the attacker exfiltrated data from a subset of production stores, including customer environment variables, tokens, and keys, the secrets that thousands of customers had stored in CircleCI to run their builds. The data had been encrypted at rest, but that gave no protection, because the attacker dumped the encryption keys straight out of a running process. CircleCI rotated all customer Project and Personal API tokens along with GitHub and Bitbucket OAuth tokens, and urged every customer to rotate any secret used in the exposure window, 16 December 2022 to 4 January 2023. The company did not detect the breach itself: a customer flagged suspicious GitHub OAuth activity on 29 December, twelve days after the laptop was first infected. Fewer than five customers reported downstream unauthorized access, but every customer had to act as if theirs was exposed.

The damage

The practical fallout was an industry-wide scramble: thousands of companies forced to rotate every credential they had stored in CircleCI, even though few were directly exploited. That is the nature of a CI/CD vendor, it concentrates thousands of organisations' secrets in one place, so a single breach becomes a fleet-wide event. It was the same concentration risk as the Codecov attack, reached by a different route.

Why CircleCI still matters

CircleCI leaves two lessons. First, session cookies bypass MFA: a stolen session is "already logged in," so the second factor is never re-checked, which is why sessions should be bound to device posture and kept short-lived (CircleCI's own structural fix was to add step-up authentication so a stolen session alone can no longer reach production). Second, infostealers on engineer endpoints are a top breach vector that signature antivirus misses, so behavioural endpoint detection (EDR) matters. And on the secrets side, prefer short-lived, OIDC-federated tokens over long-lived secrets stored in the vendor, scope them per project, and rotate everything after any CI vendor breach. It is a sibling of the Codecov compromise.

Comment le corriger

  • Assume every secret stored in or used through the platform is exposed: rotate all customer tokens, keys, and OAuth grants, and tell customers to rotate theirs across the exposure window.
  • Invalidate all sessions and shorten session lifetimes, since a stolen session cookie was the entry point.
  • Rebuild the infected endpoint and hunt for what the infostealer accessed beyond the session.

Comment l’éviter

  • Prefer short-lived OIDC-federated tokens over long-lived secrets stored in the CI vendor; rotate every stored credential after any CI vendor breach.
  • Scope CI secrets to least privilege and per-project so one platform compromise cannot expose every pipeline.
  • Bind SSO sessions to device posture and shorten session lifetimes so a stolen session cookie expires fast.
  • Deploy stealer-malware detection (EDR) on engineer endpoints, not signature antivirus alone.
  • Audit third-party OAuth grants and revoke unused CI integrations to shrink the blast radius of a token leak.

Références

Vulnérabilités liées

Tout OpSec →