CCyberwiki

Software supply chain compromise

Software supply chain compromise
ClassSoftware supply chain
Also known asSupply chain attack
CWECWE-506: Embedded Malicious Code
OWASP Top 10A03:2025 Software Supply Chain Failures
MITRE ATT&CKT1195.002 Compromise Software Supply Chain
Typical severityCritical
AffectsApplications, developer machines and CI/CD pipelines that install packages, GitHub Actions or updates from a source they already trust

In a software supply chain compromise, the attacker changes a legitimate piece of software "prior to receipt by a final consumer".1 The victim installs a package, update, build tool or CI/CD component it already trusts, and the attacker's code comes with it.

Description

A malicious package reaches a project under a new or confusable name. In a supply chain compromise the name is one the project already uses, and the harmful version arrives through the normal update path. The code is put there on purpose, which sets it apart from a flaw in a vulnerable dependency.

The change can go into the source code, into the update or distribution channel, or into a compiled release swapped for a modified copy. A backdoor was added to the signed CCleaner 5.33 on the vendor's own site; NotPetya spread as an update of the accounting program M.E.Doc; SolarWinds Orion customers received trojanized updates.1 The $1.5 billion stolen from Bybit in 2025 went out through wallet software whose harmful code ran only when the target wallet was in use.2

Mechanism

A breached maintainer reaches victims fastest through references that can move. A GitHub Actions workflow can name a third-party action by a tag such as @v45, and anyone who gains access to the repository that holds the action can move or delete that tag.3 The next run fetches whatever commit the tag names on that day:

# .github/workflows/ci.yml
steps:
  - uses: tj-actions/changed-files@v45   # the commit is looked up at run time

Install scripts are the other short path. Most compromised packages have used postinstall scripts, which run on the developer's machine or the CI runner as soon as the package is installed.4

A compromise can also copy itself. The Shai-Hulud worm of 2025 used a post-install script in popular npm packages to collect secrets. When it found npm tokens, it published malicious versions of every package those tokens could reach, and it had reached more than 500 package versions when npm stopped it.2

Notable incidents

In March 2025, attackers changed several version tags of tj-actions/changed-files, an action that lists the files changed in a pull request, so that they pointed to a malicious commit.5 Workflows using the action ran a script that read secrets from the runner's memory and wrote them, base64-encoded twice, into the workflow log, which anyone can read in a public repository. More than 23,000 repositories used the action. The malicious code was live from 14 to 15 March, and version 46.0.1 contains the fix.5 Among the exposed secrets were access keys, GitHub personal access tokens, npm tokens and private RSA keys. CISA reported that an earlier compromise of reviewdog/action-setup@v1 (CVE-2025-30154) may have made the attack possible, and added both CVEs to the KEV catalog.6 The tj-actions record is CVE-2025-30066, with a CVSS score of 8.6.5

Detection

The package name and source look normal, so detection relies on behaviour: an install or update followed by an unexpected shell, curl or wget on first run, or a connection to a host outside an approved list.1 The tj-actions attack was found this way, when a monitoring tool flagged an outbound call from a build job to gist.githubusercontent.com.5

npm audit signatures checks the registry signatures and provenance attestations of installed packages.7 OpenSSF Scorecards flags unpinned actions and broad token permissions.3 Once an advisory gives a time window, the runs inside it are the ones to find, and every secret they exposed has to be rotated.6 The full response is in Responding to a malicious package installation.

Prevention

Pin actions to a commit

A full-length commit SHA is a reference to a third-party action that cannot be moved, since pointing it at other code would take a SHA-1 collision. The SHA should come from the action's own repository, not from a fork. A workflow dependency lockfile, which records the exact commit of every action including nested ones, supersedes SHA pinning where a repository adopts it. Dependabot updates pinned actions and keeps a version comment on the same line current.3

permissions:
  contents: read
steps:
  - uses: actions/checkout@<full 40-character commit SHA>  # v6

Limit what a build step can reach

Actions can read the job's GITHUB_TOKEN through the github.token context. Its default permission can be set to read-only for repository contents and raised per job.3 Code should also never reach production on one person's say, without a second person's review.2 See Principle of least privilege and Secret exposure in CI/CD workflows.

Delay and constrain package updates

The npm registry usually removes a compromised version within hours. pnpm's minimumReleaseAge setting holds back versions younger than a set number of minutes, 1440 by default. pnpm also skips dependency build scripts that are not listed in allowBuilds, so a package that never needed a script cannot start running one in a hijacked release, and trustPolicy: no-downgrade refuses a version whose publishing evidence is weaker than that of earlier releases.4 A committed lockfile stops unplanned upgrades.

# pnpm-workspace.yaml
minimumReleaseAge: 1440
trustPolicy: no-downgrade

Publishing packages

Maintainers can replace long-lived npm tokens with trusted publishing, in which the CI job proves its identity through OpenID Connect and receives a short-lived credential for each publish. It needs npm CLI 11.5.1 and Node.js 22.14.0 or later. npm then recommends the package setting Settings, Publishing access, Require two-factor authentication and disallow tokens.8 Packages published this way from GitHub Actions or GitLab get a provenance attestation that links them to their source and build; npm states that provenance does not guarantee the package is free of malicious code.9

Prompt for a coding agent

Check this repository for supply chain risks. In every GitHub Actions workflow, replace each third-party action referenced by a tag or branch with its full 40-character commit SHA from the action's own repository, and keep the tag as a comment on the same line. Add a top-level permissions block with contents: read and grant more only to the jobs that need it. If the project uses pnpm, set minimumReleaseAge and trustPolicy: no-downgrade in pnpm-workspace.yaml and list in allowBuilds only the packages that need install scripts. Make sure the lockfile is committed. List each file you changed and any action whose SHA you could not confirm.

In SecFlash

SecFlash reports an action or tool referenced by a movable tag as SF-SEC-806 and a workflow whose token has more access than it needs as SF-SEC-804, both on the Security page. An MCP server started through npx or uvx without an exact version is SF-SEC-719, on the same page. A dependency version published to attack its installers is SF-SEC-713 on the Security page and, when a new advisory names it, SF-THR-201 on the Threats page.

See also

References

  1. a b c MITRE (24 October 2025). "Supply Chain Compromise: Compromise Software Supply Chain, T1195.002". MITRE ATT&CK.
  2. a b c "A03:2025 Software Supply Chain Failures". OWASP Top 10:2025. OWASP Foundation.
  3. a b c d GitHub (2026). "Secure use reference". GitHub Docs.
  4. a b "Mitigating supply chain attacks". pnpm documentation.
  5. a b c d GitHub (15 March 2025, updated 22 October 2025). "tj-actions changed-files through 45.0.7 allows remote attackers to discover secrets by reading actions logs" (GHSA-mrrh-fwg8-r2c3, CVE-2025-30066). GitHub Advisory Database.
  6. a b CISA (18 March 2025, revised 26 March 2025). "Supply Chain Compromise of Third-Party tj-actions/changed-files (CVE-2025-30066) and reviewdog/action-setup@v1 (CVE-2025-30154)". Cybersecurity and Infrastructure Security Agency.
  7. back "npm-audit". npm Docs, CLI v11. GitHub.
  8. back "Trusted publishing for npm packages". npm Docs. GitHub.
  9. back "Generating provenance statements". npm Docs. GitHub.