These write-ups are not threat intelligence and are not kept up to date as an incident develops. They are here to show how each attack worked, so you can find and fix the same techniques in your own setup. For the latest on an incident, read its sources.
CircleCI session-cookie theft
December 2022 – January 2023 · Contained
Malware on one engineer's laptop stole a logged-in session that reached CircleCI's production systems and the secrets customers kept there, including the GitHub OAuth tokens CircleCI held for them.
- Access held
Full summary
Malware on a CircleCI engineer's laptop, missed by antivirus, stole a session cookie for the company's SSO. The session had already passed 2FA, so the attacker could act as that engineer from elsewhere. The engineer's normal job included generating production access tokens, and with those the attacker reached databases and stores holding customers' secrets: environment variables, API tokens, SSH and deploy keys, and the GitHub OAuth tokens CircleCI uses to read customers' repositories. The data was encrypted at rest, but the attacker took the encryption keys from a running process. A customer noticed suspicious use of their GitHub OAuth token a week later. CircleCI rotated every customer's GitHub OAuth token and told customers to rotate everything else they had stored in it, because it could not tell which secrets had been used.
How it unfolded
Pick a step to zoom into it. A dashed line is a step the sources do not state. Blue dots are the checklist items that break the step.
Whole path
The whole attack, one row per step. Pick a step on the left, or click a box in its row.
On 16 December 2022 malware infected a CircleCI engineer's laptop. Antivirus did not detect it. It stole a session cookie for a valid SSO session that had already passed 2FA, which let the attacker act as that engineer from a remote location.
What breaks this step
- Enforce MFA for every member (prefer hardware/FIDO2 keys over SMS or app codes)
- Migrate to SAML SSO / Enterprise Managed Users for centralized identity control
- Keep OAuth app access restrictions on and require security/IT approval for new apps
- Enforce an IP allow list for Git and web UI access from trusted ranges
On 19 December the attacker started reconnaissance and reached production. The engineer could generate production access tokens as part of their normal job, and the attacker used that to get into a subset of CircleCI's databases and stores.
On 22 December, the last recorded unauthorised activity, the attacker exfiltrated customer environment variables, tokens and keys, including the GitHub OAuth tokens CircleCI holds for customers. The data was encrypted at rest, but the attacker had pulled the encryption keys out of a running process.
On 29 December a customer told CircleCI about suspicious GitHub OAuth activity, and CircleCI started a review with GitHub. On 30 December it confirmed that customer's GitHub OAuth token had been compromised. CircleCI later told customers to look in their GitHub audit logs for unexpected events such as repo.download_zip.
What breaks this step
- Set an organization-wide maximum PAT lifetime (90 days is a reasonable default)
- Disable classic PATs organization-wide, forcing migration to fine-grained PATs
- Audit and revoke stale PATs, unused SSH keys, and inactive accounts
- Enforce an IP allow list for Git and web UI access from trusted ranges
- Service-account automation migrated from PATs to GitHub Apps
From 04:00 UTC on 31 December CircleCI rotated every customer's GitHub OAuth token, with GitHub raising its API rate limits, and finished at 07:30 UTC on 7 January. On 4 January it cut off the engineer's access, removed production access from nearly all employees and told customers. It revoked all project API tokens on 5 January and personal API tokens created before 5 January on 6 January, and rotated Bitbucket tokens with Atlassian.
CircleCI could not tell which stored secrets had been used, so it asked customers to rotate all of them at the source: environment and context variables, project SSH keys including deploy keys, API tokens and runner tokens. AWS notified customers whose keys may have been exposed. By 13 January fewer than five customers had reported unauthorised access to third-party systems.
Frameworks
Part of
Contained. First seen December 2022, last seen January 2023. Mapping by ghtier, not yet reviewed. Threat landscape
Sources
- postmortemCircleCI incident report for January 4, 2023 security incident
- postmortemCircleCI security alert on 1/4/2023
- postmortemCircleCI: rotating secrets for the January 4th incident
- trackerCircleCI incident (Wiz cloud threat landscape)
Reported by: CircleCI incident report