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.
Dependabot impersonation
July 2023 · Contained
With developers' stolen personal access tokens, an automated script pushed commits made to look like Dependabot's to hundreds of repositories, adding a workflow that sent the repository's secrets out and a password stealer to every JavaScript file.
- Way in
- Leaked token
- Access held
Full summary
Between 8 and 11 July 2023 hundreds of public and private GitHub repositories received commits that looked like Dependabot's. They were not: the attacker had developers' personal access tokens and wrote the author name themselves, which git allows. Each commit added a workflow, hook.yml, that ran on push and sent the repository's secrets to an outside server, and appended code to every .js file that captured passwords typed into web forms. Checkmarx confirmed with victims that their tokens had been stolen, and believes they were taken by a malicious package on the developer's machine, but says it cannot know. A token does not need 2FA, and at the time only enterprise accounts could see in the audit log what a personal access token had done.
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.
Checkmarx talked to victims and confirmed their personal access tokens had been stolen. How is not known; Checkmarx thinks the most likely route is a malicious package on the developer's machine sending the token out. A token works from any computer without 2FA.
What breaks this step
- Disable classic PATs organization-wide, forcing migration to fine-grained PATs
- Set an organization-wide maximum PAT lifetime (90 days is a reasonable default)
- Secret scanning and push protection enabled
- Set `persist-credentials: false` on actions/checkout wherever later steps do not push
- Require organization owner approval for fine-grained PATs.
- Never upload the checkout workspace as an artifact.
From 8 July 2023 an automated script used the tokens to push commits to hundreds of repositories, with the author set to look like Dependabot. The real Dependabot was not involved; git lets the pusher write any author name.
Each commit added .github/workflows/hook.yml, which ran on push and sent the repository's Actions secrets to the attacker's server at wagateway.
What breaks this step
- CODEOWNERS in place, required on sensitive paths
- Rulesets applied: push restriction, tag protection, sensitive file-path protection
- Inventory every Actions secret and its visibility/scope; the results are usually surprising
- Cloud credentials migrated from static keys to OIDC federation, scoped to repo + branch
- Put production secrets in environments with required reviewers
The same changes appended code to every .js file in the project that loaded a script from the attacker's server and captured passwords submitted in web forms, so the project's own users were the next victims.
At the time, what a personal access token did was only visible in the audit log of enterprise accounts, so most victims could not check whether their token had been used. Checkmarx published on 27 September 2023 and advised moving to fine-grained tokens.
Frameworks
Part of
Contained. First seen July 2023. Mapping by ghtier, not yet reviewed. Threat landscape
Sources
Reported by: Checkmarx noted that PAT activity logging was only visible to enterprise accounts at the time