# Stolen publish credentials backdoor packages

Untrusted code reaching publish tokens; orphan commits, PR gaps, unverified commits, burst PRs

_Area: Software supply chain and CI/CD. Seen in 4 disclosed reports; latest 2026-11-12. Updated 2026-12-01._

## How it works
Publishing rights are a bearer capability: whoever holds the token or PAT can ship a release. The broken assumption is that only trusted maintainers and trusted CI jobs can reach that capability. When a token with publish rights is reachable from a job that runs untrusted code (a fork PR, a postinstall hook, a contributor's laptop), or is phished off a developer, the attacker inherits the maintainer's identity and the registry accepts the package as legitimate. The same holds for repo write access: a stolen token can push commits, add workflow steps, or plant an orphan commit that only the attacker references by SHA.

## Where it shows up
- `pull_request_target` (or `workflow_run`) workflows that check out and execute PR head code while base-repo secrets are in scope [E1](https://bugbountylibrary.com/r/blog%3Asecuritylabs-datadoghq-com-articles-compromised-asyncapi-npm-packages.md)
- Publish tokens, marketplace PATs, or npm OIDC trusted-publishing reachable from contributor accounts or broad org PATs [E1](https://bugbountylibrary.com/r/blog%3Asecuritylabs-datadoghq-com-articles-compromised-asyncapi-npm-packages.md)[E2](https://bugbountylibrary.com/r/blog%3Astepsecurity-io-blog-nx-console-vs-code-extension-compromised.md)
- Commits unreachable from any branch, fetchable only by SHA (orphan/dead-drop commits) [E2](https://bugbountylibrary.com/r/blog%3Astepsecurity-io-blog-nx-console-vs-code-extension-compromised.md)
- Workflow steps or npm `postinstall` hooks that dump `${{ toJSON(secrets) }}` or runner/cloud env [E4](https://bugbountylibrary.com/r/blog%3Aaikido-dev-blog-compromised-github-accounts-push-ci-secret-stealer-to-tens-of-thousands-of-repositories.md)
- Commits whose author and GPG key don't match, shown as unverified [E3](https://bugbountylibrary.com/r/blog%3Awiz-io-blog-threat-actors-target-crypto-orgs.md)
- Bursts of identically titled PRs from one account; runs whose logs are deleted right after [E4](https://bugbountylibrary.com/r/blog%3Aaikido-dev-blog-compromised-github-accounts-push-ci-secret-stealer-to-tens-of-thousands-of-repositories.md)

## How to review
For every job that can publish or push, trace what code it executes and which secrets are in scope. The invariant: untrusted input (fork PR code, PR titles, dependency scripts) must never execute in a context holding publish or write credentials. Check that `pull_request_target` jobs don't checkout PR head, that publish tokens are scoped to a protected environment with required reviewers, and that release identity is verifiable (signed commits, provenance). On the registry side, confirm the published artifact's provenance matches the expected builder.

## How finders spotted it
- Noticed 36 spam PRs clustered minutes before the compromise, spotted a numbering gap (no PR #2155) hiding the malicious PR, then used the Actions API on the run to unmask the deleted fork owner and recover the commit; a prior contributor PR had already flagged the pwn-request [E1](https://bugbountylibrary.com/r/blog%3Asecuritylabs-datadoghq-com-articles-compromised-asyncapi-npm-packages.md)
- Reconstructed the attack from the published VSIX diff, the orphan commit SHA, and deobfuscation of the payload; the team caught the rogue publish in 11 minutes via anomalous marketplace activity [E2](https://bugbountylibrary.com/r/blog%3Astepsecurity-io-blog-nx-console-vs-code-extension-compromised.md)
- Correlated GitHub audit logs and Vigilant Mode unverified-commit badges with GPG-key/author mismatch to trace pushes to a compromised endpoint [E3](https://bugbountylibrary.com/r/blog%3Awiz-io-blog-threat-actors-target-crypto-orgs.md)
- GitHub search surfaced 61,839 probe PRs in ~26 hours; sampling 1,500 repos showed 10.6% execution with logs deleted in 156 of 159 [E4](https://bugbountylibrary.com/r/blog%3Aaikido-dev-blog-compromised-github-accounts-push-ci-secret-stealer-to-tens-of-thousands-of-repositories.md)

## Variants seen
- CI pwn-request via `pull_request_target` stealing a release bot PAT, then npm publish [E1](https://bugbountylibrary.com/r/blog%3Asecuritylabs-datadoghq-com-articles-compromised-asyncapi-npm-packages.md)
- Contributor PAT scraped earlier, reused to push an orphan commit and publish a VS Code extension [E2](https://bugbountylibrary.com/r/blog%3Astepsecurity-io-blog-nx-console-vs-code-extension-compromised.md)
- Phishing/RAT on a developer endpoint harvesting GitHub and npm creds, then trojanized SDK [E3](https://bugbountylibrary.com/r/blog%3Awiz-io-blog-threat-actors-target-crypto-orgs.md)
- Stolen tokens mass-injecting workflows/postinstall hooks across ~61k repos [E4](https://bugbountylibrary.com/r/blog%3Aaikido-dev-blog-compromised-github-accounts-push-ci-secret-stealer-to-tens-of-thousands-of-repositories.md)

## Impact and severity
Critical: backdoored packages reach downstream developers and harvest AWS/GCP/kube/npm/Slack creds, SSH keys, browser passwords, wallets [E1](https://bugbountylibrary.com/r/blog%3Asecuritylabs-datadoghq-com-articles-compromised-asyncapi-npm-packages.md); stolen OIDC tokens enable publishing downstream packages with valid signed provenance [E2](https://bugbountylibrary.com/r/blog%3Astepsecurity-io-blog-nx-console-vs-code-extension-compromised.md); a single endpoint compromise turned a public SDK into a propagation vector [E3](https://bugbountylibrary.com/r/blog%3Awiz-io-blog-threat-actors-target-crypto-orgs.md); ~6,500 repos executed the stealer, with cloud OIDC roles harvested to pivot [E4](https://bugbountylibrary.com/r/blog%3Aaikido-dev-blog-compromised-github-accounts-push-ci-secret-stealer-to-tens-of-thousands-of-repositories.md). Impact rises with token scope, reuse of previously compromised accounts, and valid provenance masking the backdoor.

## Seen in real software
Open-source packages and projects, and products, where this pattern was found. If the target runs one, compare the version it runs with the fix.
- **@asyncapi/generator** 3.3.1: Compromised AsyncAPI npm packages: inside a CI supply-chain attack. Report: https://bugbountylibrary.com/r/blog%3Asecuritylabs-datadoghq-com-articles-compromised-asyncapi-npm-packages.md
- **Nx Console** (main.js) 18.95.0, fixed in 18.100.0: Nx Console VS Code Extension Compromised. Report: https://bugbountylibrary.com/r/blog%3Astepsecurity-io-blog-nx-console-vs-code-extension-compromised.md
- **@velora-dex/sdk** (dist/index.js) 9.4.1: Commit to Compromise: A New Threat Actor Targeting the Cryptocurrency Industry's Software Development Infrastructure. Report: https://bugbountylibrary.com/r/blog%3Awiz-io-blog-threat-actors-target-crypto-orgs.md

## Evidence
- E1: https://bugbountylibrary.com/r/blog%3Asecuritylabs-datadoghq-com-articles-compromised-asyncapi-npm-packages.md
- E2: https://bugbountylibrary.com/r/blog%3Astepsecurity-io-blog-nx-console-vs-code-extension-compromised.md
- E3: https://bugbountylibrary.com/r/blog%3Awiz-io-blog-threat-actors-target-crypto-orgs.md
- E4: https://bugbountylibrary.com/r/blog%3Aaikido-dev-blog-compromised-github-accounts-push-ci-secret-stealer-to-tens-of-thousands-of-repositories.md
