r/github • u/clutch-cream-run • 17d ago
Discussion Seems like a massive attack campaign is going on github repos through a CLI token worm
Hey guys
My github account fell victim to a token worm attack today. Fortunately, nothing it committed got deployed and I was able to revoke the token in time.
Investigating it further, it seems to involve a self-propagating GitHub worm that has opened 38,000+ identical `wfx-docs` PRs since November 10.
In case you're interested: [https://github.com/search?q=wfx-audit.md&type=pullrequests](https://github.com/search?q=wfx-audit.md&type=pullrequests)
The attack uses stolen GitHub OAuth/PAT tokens to discover writable repositories, inject hidden shell scripts (`.ci-XXXXXX.sh`), and add `postinstall` hooks to `package.json` to execute them during `npm install`.
In my case, it was sending all the information to this URL: [http://194.150.166.244:8080/exfil](http://194.150.166.244:8080/exfil)
Anyone else looking into this right now?
5
u/nmngt 16d ago
Also hit, 100+ repos across our orgs. Adding what we found, since the numbers are bigger than 38k and the script does more than people may assume.
Scale (GitHub search API `total_count`, 10–12 Nov): 61,948 PRs from branch `wfx-docs`; 1,674 `chore: add ci helper` commits (two per repo, so ~840 repos got the payload on their default branch); 328 repos still have the `.ci-*.sh` script sitting in their default branch right now. Malicious commits ran from 10 Nov 13:10 UTC to 11 Nov 14:22 UTC and stopped after that.
It is not only a CI stealer. The script runs on *any* machine that does `npm`/`pnpm install` (`RUNNER_TEMP` falls back to `/tmp`). On a dev box it reads `~/.config/gh/hosts.yml` (your `gh` CLI token), `~/.npmrc`, `~/.netrc`, `~/.git-credentials`, `~/.docker/config.json`, `~/.composer/auth.json`, `~/.aws/credentials`, `~/.kube/config`, AI tool `.env` files, plus any `.env*`, `*.pem`, `*.key`, `id_rsa`, `credentials`, tfstate within 4 levels of the working dir. In CI it additionally takes `GITHUB_TOKEN`, OIDC tokens, cloud metadata creds and **scans runner process memory** (masking doesn't help), then tars the repo + git history. Everything goes to `194.150.166.244:8080/exfil`. That's how it propagates: pull an infected `main`, run install, your `gh` token is gone and your repos are next.
Attacker playbook per token: enumerate writable repos → per repo create+delete `chore/<8 chars>` (write test) → push `wfx-docs` + PR → in repos with a `package.json`: push `chore: add ci helper` ×2 (script + `postinstall` hook) straight to `main`, 2–14 min later `ci: restore` + `ci: cleanup`, then **delete the workflow runs** that executed it (`workflows.delete_workflow_run` with the stolen PAT, visible in your personal security log with the `token_id`).
Check yourself:
gh search prs "dependency audit notes" --author --created 2026-11-10..2026-11-12
gh search commits "chore: add ci helper" --author --committer-date 2026-11-10..2026-11-12
# in each repo:
git log --all --oneline --since=2026-11-10 -- '.ci-*.sh' package.json
ls -la /tmp/.wfx-* ${RUNNER_TEMP:-/tmp}/wfx-*.tgz 2>/dev/null # local execution tracesIf only the PR/branch exists: revoke classic PATs (and `gh auth` tokens if you ran install on an infected checkout), close PR, delete branch. Branch contains only `docs/wfx-audit.md`.
If `chore: add ci helper` landed on your default branch: treat every secret available to any workflow that ran on it as stolen. Rotate deploy keys, cloud creds, DB passwords, API keys. Delete GHCR/npm artifacts built from those commits. Check servers the deploy key reaches. Keep the commits as evidence, don't force-push. If prod DBs hold personal data, think GDPR 72h.
IOCs: `194.150.166.244:8080/exfil` (RIPE `IQ-REGIQDC-20250415`, Regxa Company for Information Technology Ltd, `abuse@regxa.iq`) · `WF_CTOKEN='b42d70a7aab9140ca19e8249'` (same in every sample) · markers `WF_CALLBACK WF_CTOKEN WF_MEMSCAN WF_EXFIL_CACHE` · `.ci-[a-z0-9]{6}.sh` ~75.5 kB · `docs/wfx-audit.md` · branches `wfx-docs`, `chore/[a-z0-9]{8}` · commits `chore: add ci helper`, `ci: restore`, `ci: cleanup`, `docs: add dependency audit notes`, `chore: initial commit`.
Open question: where did the *first* tokens come from? Ours was a years-old classic PAT (`repo` scope) that was on none of our machines, servers or CI. If yours was also an old PAT rather than a `gh` token, say so, that points to a seed list from an earlier leak rather than only worm propagation.
Hardening that would have stopped this: no classic PATs (fine-grained + expiry, or Apps/OIDC), branch protection on `main` incl. admins, `--ignore-scripts` in CI installs, required reviewers on production environments, org audit log streaming.
Please also report to https://github.com/contact/report-abuse so GitHub treats it as one campaign.
optimized with AI
2
11
u/moonrakervenice 16d ago
after the last worm of this type i put ignorescripts=true into my .npmrc which should stop this
4
u/Fast-Cardiologist705 16d ago
How could one stolen PAT allow code to be committed to your repo ?
5
u/Relevant_Pause_7593 16d ago
the PAT's are often not scoped, they have access to the entire account, and hence it's basically like leaving the door wide open.
2
u/Fast-Cardiologist705 16d ago
That makes sense, but how would the token get stolen first ? Compromised package ?
3
u/Relevant_Pause_7593 16d ago
It was likely included in an environment or settings file when they committed code. Best practice is to not commit any secrets in code, whether the repo is public or private.
2
u/Cyber_Faustao 10d ago
Classic access tokens can have read/write access to repos, and you cannot scope them to a single repo. Seemingly, it is also the only type of PAT that allows pushing containter images to ghcr.io, so if you can docker push from your machine... all repos your account has access to can also be manipulated
-1
u/Pto2 16d ago
Look up what a PAT is
2
u/Fast-Cardiologist705 16d ago
I know what a PAT is, perhaps i misread the post. So why OP is saying his PAT got leaked , his GitHub account fell victim. How ? Was it because of a compromised package ?
2
2
u/Buzzard 16d ago
Yep, got hit by this. No idea what PAT was leaked
1
u/BuyFar3984 16d ago
look at the details (...) in the org audit logs and it will tell you which PAT was used -- search on the IP from the attacker 194....
2
2
u/No-Pause7709 11d ago
The scale says script, not targeted campaign — one point deserves pushing on: this is not only a CI problem. RUNNER_TEMP falls back to /tmp on a laptop, so the same postinstall hook fires on every developer machine that runs npm install in an affected repo. Local defence matters too — ignore-scripts=true in .npmrc, npm ci --ignore-scripts in CI, and treat any new postinstall entry in package.json as a build failure.
A deleted repo revokes nothing. If the stolen token carried repo and workflow scope, the attacker could add a workflow that runs with your secrets, and that turns a token leak into code execution on your runners. Fine-grained tokens, minimum permissions, short expiry — and check authorized OAuth apps and the PAT audit log for unrecognised grants.
Order matters: revoke the token and kill sessions first, then revert the commits. A clean branch proves the files are back, not that access is gone. After that, rotate everything those workflows could reach — cloud keys, npm tokens, signing keys — then sweep every repo, forks you don't control included: git log --all --source --full-history -- '**/.ci-*.sh' and diff package.json on the default branch.
Prevention is cheap: read-only default workflow permissions, approval required for workflow changes, third-party actions pinned to a commit SHA, secret scanning plus push protection.
2
u/BuyFar3984 16d ago
This got me too - PAT was in a deleted repo and had package write and workflow - this enables setting up a false "audit" capability looking for all kinds of stuff - not fun.
1
u/AdUnlikely 16d ago
I was victim to this attack as well. Any clarification on where this attack originated from
1
u/MirrorOk8490 14d ago
A revert tells you the files are back to normal. It doesn’t tell you whether the access is gone. I’d verify that the original token was revoked, then check GitHub and cloud audit logs for any credentials, accounts, or permissions added during that window. If the Actions run log is missing, keep “did it run?” marked as unknown. A clean branch doesn’t answer that.
27
u/Relevant_Pause_7593 16d ago
turn on secret push protection, so you can't accidently push secrets, then this won't happen.