Skip to content

Commit 1484d71

Browse files
author
HackTricks News Bot
committed
Add content from: Mini Shai-Hulud: FAQ on the TeamPCP npm and PyPI supply-chai...
1 parent 8cb43f6 commit 1484d71

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

  • src/pentesting-ci-cd/github-security/abusing-github-actions

src/pentesting-ci-cd/github-security/abusing-github-actions/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,32 @@ GitHub exposes a cross-workflow cache that is keyed only by the string you suppl
516516
gh-actions-cache-poisoning.md
517517
{{#endref}}
518518

519+
### OIDC trusted publishing compromise & provenance limits
520+
521+
Cache poisoning and `pull_request_target` abuse become much more impactful when the **release workflow publishes through OIDC trusted publishing** instead of a static registry token:
522+
523+
1. A low-trust workflow (`pull_request_target`, `issue_comment`, bot command, etc.) writes a **malicious binary/script** into a cache key later restored by the privileged release workflow.
524+
2. The release job restores and executes that binary while holding **`id-token: write`** or an already-minted registry session.
525+
3. The attacker steals the short-lived identity material, usually by either:
526+
- directly requesting a GitHub OIDC token from `ACTIONS_ID_TOKEN_REQUEST_URL` with `ACTIONS_ID_TOKEN_REQUEST_TOKEN`, or
527+
- dumping the runner worker process memory / tool-specific token cache after the publish helper requested the token.
528+
4. The stolen OIDC token is exchanged with the registry trusted-publishing / federation endpoint for **real publish credentials**, so the malicious package is published by the victim's own CI/CD pipeline.
529+
530+
This is important because **npm provenance and Sigstore attestations only prove that the package was produced by the expected build workflow**. They do **not** prove that the workflow was free from attacker-controlled code. If the attacker compromises the trusted builder itself, the backdoored package can still receive valid provenance.
531+
532+
Practical implications during an assessment:
533+
534+
- Look for release jobs with **`permissions: id-token: write`** plus `npm publish`, `pnpm publish`, `changesets`, or custom publish wrappers.
535+
- Treat `ACTIONS_ID_TOKEN_REQUEST_URL`, `ACTIONS_ID_TOKEN_REQUEST_TOKEN`, runner memory, and CLI token caches as **equivalent credential sources** once code execution is obtained in the release context.
536+
- Do not assume `npm audit signatures` / provenance verification will detect a package built by a **compromised but legitimate** workflow.
537+
538+
**Mitigations**
539+
540+
- Keep untrusted workflows and release workflows on **separate cache namespaces** and never restore executable tooling from a cache written by PR-triggerable jobs.
541+
- Minimize `id-token: write` to the exact publish step/job and avoid exposing OIDC-capable helpers earlier in the workflow.
542+
- Rebuild/rehash restored binaries or download them from a verified source before execution; do not execute toolchains directly from cache paths.
543+
- Treat provenance as an **origin signal**, not a standalone safety signal; combine it with workflow hardening, dependency diffing, and runtime validation.
544+
519545
### Artifact Poisoning
520546

521547
Workflows could use **artifacts from other workflows and even repos**, if an attacker manages to **compromise** the Github Action that **uploads an artifact** that is later used by another workflow he could **compromise the other workflows**:
@@ -910,5 +936,9 @@ An organization in GitHub is very proactive in reporting accounts to GitHub. All
910936
- [OpenGrep playground releases](https://github.com/opengrep/opengrep-playground/releases)
911937
- [A Survey of 2024–2025 Open-Source Supply-Chain Compromises and Their Root Causes](https://words.filippo.io/compromise-survey/)
912938
- [Weaponizing the Protectors: TeamPCP’s Multi-Stage Supply Chain Attack on Security Infrastructure](https://unit42.paloaltonetworks.com/teampcp-supply-chain-attacks/)
939+
- [Mini Shai-Hulud: Frequently asked questions about the TeamPCP npm and PyPI supply chain campaign](https://www.tenable.com/blog/mini-shai-hulud-frequently-asked-questions)
940+
- [Events that trigger workflows - GitHub Docs](https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows)
941+
- [Trusted publishing for npm packages | npm Docs](https://docs.npmjs.com/trusted-publishers/)
942+
- [Generating provenance statements | npm Docs](https://docs.npmjs.com/generating-provenance-statements/)
913943

914944
{{#include ../../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)