On 18 May 2026, someone pushed 5,718 commits into 5,561 GitHub repositories in roughly six hours. None of them touched application code. Every one of them added or rewrote a GitHub Actions workflow designed to steal the secrets that CI pipelines carry: cloud keys, deploy tokens, SSH keys and more.
The campaign was named Megalodon after the identifier its payload sent home, and it was first documented by SafeDep. What makes it worth a closer look is not the malware. It is the access. The attacker did not break GitHub. They logged in, in effect, with credentials developers had already lost, and the strongest evidence points to infostealer logs as the source.
The anatomy of Megalodon
According to SafeDep’s analysis, all 5,718 malicious commits landed between about 11:36 and 17:48 UTC on 18 May. They were pushed straight to the default branch, with no pull request and no merge commit, under forged author names such as build-bot, auto-ci, ci-bot and pipeline-bot. Commit messages were bland on purpose: “ci: add build optimization step”, “build: improve ci performance” and similar.
The commits came in two variants:
- SysDiag (the mass variant). Added a new workflow file that ran on every push and on
pull_request_targetevents. Any normal activity in the repository would fire it. - Optimize-Build (the targeted variant). Replaced existing workflows with one that only runs on
workflow_dispatch, meaning it sits dormant until someone triggers it through the GitHub API or the Actions UI.
Both carried a base64-encoded bash payload. SafeDep and StepSecurity describe it collecting environment variables, AWS and GCP credentials, cloud metadata endpoints, SSH keys, Docker and npm auth files, Kubernetes configs, Vault and Terraform credentials, shell history and the runner’s GITHUB_TOKEN. It also grepped the source tree against more than 30 secret patterns and requested a GitHub Actions OIDC token, which SafeDep notes could let the attacker impersonate the workflow’s cloud identity. Everything was shipped to a server at 216.126.225.129 on port 8443.
How the attacker got write access
GitHub itself was not breached. To push a commit to someone else’s default branch you need a credential with write access, and the researchers agree on the likely type. SafeDep’s assessment is that the commits were pushed “using a compromised PAT or deploy key”, and Wiz’s incident write-up reaches the same view: compromised personal access tokens or deploy keys.
Where did those tokens come from? Hudson Rock cross-referenced GitHub usernames associated with the affected repositories against its infostealer database and reported that 331 of 978 unique usernames, over 33%, matched computers infected by infostealers. The Cloud Security Alliance’s research note concludes that the PATs or deploy keys were “most likely acquired by infostealer malware from developer machines prior to the campaign”.
That is a strong link, not a complete one. A third of matched usernames leaves room for other sources, and nobody has published how every token was obtained. But the pattern is familiar. An infostealer on a developer’s laptop takes the browser’s saved passwords and session cookies, including any for github.com, and many families also grab files from the disk. Those end up in stealer logs that are sold or shared in bulk, and a GitHub token in a log is a ready-made key to every repository that developer can write to.
Why six hours was enough
The speed follows directly from the access. A valid token needs no exploit, no phishing and no password guessing. The attacker’s job was reduced to running a script: authenticate, push a workflow file, move to the next repository.
Three things made each push cheap:
- No review stood in the way. StepSecurity points to repositories with weak branch protection, where a direct push to the default branch went through without a pull request.
- The payload ran itself. The SysDiag variant triggered on push, so the very commit that planted it could set it off.
- Nothing looked broken. As StepSecurity put it: “The attacker never touched your application code, only your pipeline. Most repositories had no idea it happened.” The dormant Optimize-Build variant was quieter still, leaving normal CI behaviour unchanged until the attacker chose to fire it.
Defenders, by contrast, had to notice an innocuous-looking CI commit among thousands of normal ones. That gap between attacker and defender effort is the real lesson of the six-hour window.
The wider implications: who is at risk
The damage did not stop at the repositories. SafeDep found that versions 2.18.6 to 2.18.12 of the npm package @tiledesk/tiledesk-server carried the targeted backdoor. The legitimate maintainer published them from the compromised repository without knowing, so the npm account itself was never touched. Anyone installing those versions inherited the problem.
Several groups should treat Megalodon as directly relevant:
- Organisations whose developers hold classic PATs or deploy keys with broad write access, especially where those developers also work from personal or unmanaged machines.
- Teams that keep long-lived cloud secrets in GitHub Actions, or that federate Actions to AWS, GCP or Azure through OIDC, since the payload went after both.
- Open source maintainers and their downstream users, because a poisoned repository can turn into a poisoned package release, as the Tiledesk case shows.
- Anyone without branch protection on default branches, which is what allowed direct pushes to go unreviewed.
Hudson Rock also notes that the attack followed the open-sourcing of TeamPCP’s Shai Hulud framework weeks earlier. SafeDep’s view, quoted by CSA, is that Megalodon was most likely a different actor copying TeamPCP’s behaviour. Either way the point stands: the tooling for this kind of campaign is now widely available, and the raw material is whatever stolen developer credentials are circulating.
Detection and response: what to do now
If you run code on GitHub, start by checking whether you were hit, then close the routes that made Megalodon possible.
Check for compromise
- Search commit history for commits on 18 May 2026 from the forged authors, including the addresses build-bot@github-ci.com and ci-pipeline@actions-bot.com listed by StepSecurity, and for workflows named SysDiag or Optimize-Build.
- Audit every file under
.github/workflowsfor changes nobody can account for, especially workflows requestingid-token: write. - Check the Actions tab for unexpected
workflow_dispatchruns, as SafeDep advises, since the dormant variant only shows itself when triggered. - Review cloud audit logs for token requests or role assumptions you cannot explain if you use OIDC federation.
- Check dependencies, including any use of the affected Tiledesk versions.
Contain and rotate
- Revert the malicious commits and rotate every secret your Actions runners could reach, not only the ones you think were used.
- Revoke and reissue personal access tokens, deploy keys and SSH keys for affected accounts, from a clean device. Rotating from an infected machine hands the new token straight back to the stealer.
- Review authorised OAuth apps and GitHub Apps at user and organisation level, and remove anything unused or unfamiliar. GitHub’s OAuth app access restrictions let organisations control which apps can reach their data.
- Treat the developer’s machine as compromised if their identity appears in a stealer log. Rebuild it and revoke active sessions, not just passwords, as covered in our stealer log triage guide.
Harden for next time
- Move to fine-grained personal access tokens with an expiry date and access limited to the repositories that need it. GitHub’s token documentation explains the difference from classic tokens.
- Enforce SAML single sign-on for your organisation, so tokens must be explicitly authorised for it and access ends when someone leaves your identity provider. See GitHub’s SAML SSO guidance.
- Protect default branches with required pull request reviews, and require code owner review for anything under
.github/workflows. - Enable secret scanning and push protection, so fewer secrets sit in source for a payload like this to grep out.
- Set minimal
permissions:on every workflow and pin third-party actions to full commit SHAs, both recommended by the Cloud Security Alliance. CSA also recommends OIDC federation over stored static cloud secrets, which keeps cloud credentials short-lived.
Watch for the credentials before they are used
Every step above is reactive unless you know a developer’s credentials have leaked before someone runs a script against them. That is where external monitoring earns its place. DarkInvader’s leaked credentials monitoring flags your staff and domains when they surface in stealer logs and breach data, and dark web monitoring watches the forums and Telegram channels where those logs are traded. A developer identity appearing in a fresh log is the moment to revoke their tokens, ahead of any account takeover, not after a SysDiag workflow appears in your history.
Summary
Megalodon was a credential problem dressed up as a supply chain attack. Thousands of repositories were backdoored in an afternoon because valid write tokens, most likely harvested by infostealers, met default branches that accepted direct pushes and pipelines that ran whatever they were given. The fixes are not exotic: short-lived, narrowly scoped tokens, SSO, branch protection on workflow files, fewer static secrets in CI, and early warning when a developer’s machine ends up in a stealer log.
Frequently Asked Questions
What was the Megalodon GitHub attack?
An automated campaign on 18 May 2026 that pushed 5,718 malicious commits into 5,561 GitHub repositories in about six hours, according to SafeDep. Each commit added or replaced a GitHub Actions workflow that stole CI secrets, cloud credentials, SSH keys and tokens and sent them to an attacker-controlled server.
How are infostealers connected to Megalodon?
Researchers assess that the attacker used compromised personal access tokens or deploy keys. Hudson Rock found that 331 of 978 unique usernames associated with affected repositories matched infostealer-infected computers, and the Cloud Security Alliance concluded the tokens were most likely taken by infostealer malware from developer machines.
How do I check if my repositories were affected?
Look for commits on 18 May 2026 from authors such as build-bot or pipeline-bot, workflows named SysDiag or Optimize-Build, unexplained changes under .github/workflows, and unexpected workflow_dispatch runs in the Actions tab. If you find any, revert them and rotate every secret your runners could access.
Is rotating a GitHub token enough after a stealer log hit?
No. If the token came from an infected machine, that machine can steal the replacement too. Rebuild or clean the device first, then rotate tokens and keys, revoke active sessions and review authorised OAuth apps.
Want to know when your developers’ credentials appear in stealer logs? Start Free Trial.














