npm Provenance Is Not Safety: How the ChainDrop Worm Shipped Valid SLSA Attestations, and a CI Pipeline That Survives It
On August 4, 2026, the ChainDrop worm compromised 444 npm packages and published with valid SLSA provenance badges. Provenance proves where code was built, not whether the build was authorized or safe. Here is the full architectural breakdown and a hardened, split-job CI pipeline that survives it.

1. Hook and Thesis: The Provenance Paradox
On August 4, 2026, the ChainDrop worm tore through the JavaScript package ecosystem, compromising a reported 444 packages across 2,212 versions in roughly four hours. When automated supply-chain scanners and security auditing tools inspected the headline releases—including packages within the widely deployed Keyv and Cacheable ecosystems—they encountered a disquieting reality: the trojanised packages arrived with fully valid, cryptographically verified SLSA Level 2+ provenance attestations, generated by GitHub Actions and recorded in the Sigstore transparency log. To an automated policy engine configured to gate releases on cryptographic signatures, the packages looked pristine. To the host machines and CI runners executing them, they were virulent credential harvesters.
This incident shattered a pervasive industry assumption. Provenance and npm Trusted Publishing prove where and how a package was built; they do not prove whether that build was authorized, uncompromised, or benign. An attacker or self-propagating worm running inside an authorized CI workflow can invoke the OpenID Connect (OIDC) token exchange daemon to self-mint publishing credentials on the fly, producing cryptographically authentic malware. Treating an attestation badge as an authorization gate is a fatal category error. Defense cannot rely on metadata; it requires structural CI pipeline engineering: strict job-level credential isolation, install-time script execution fences, release-age cooldown gates, and hard runner egress controls.
---
2. What Provenance, SLSA, and Trusted Publishing Actually Attest
To understand why automated verification failed to flag ChainDrop, we must delineate the exact cryptographic boundaries of the Supply-chain Levels for Software Artifacts (SLSA) specification, Sigstore, and npm Trusted Publishing (which reached General Availability in July 2025).
When an engineer or automated pipeline publishes an npm package with provenance enabled (npm publish --provenance), the npm CLI communicates with GitHub Actions' internal OIDC identity provider. GitHub issues a signed JSON Web Token (JWT) containing cryptographic claims about the execution environment:
- Repository Slug (`repository`): The
owner/repopath executing the job. - Commit SHA (`sha`): The exact git commit hash checked out on the runner.
- Workflow Identity (`job_workflow_ref`): The specific workflow file path and ref (e.g.,
.github/workflows/release.yml@refs/heads/main). - Triggering Event (`event_name`): The GitHub event that dispatched the run (e.g.,
release,push,workflow_dispatch). - Runner Environment: Cryptographic verification that the runner is an official GitHub-hosted virtual machine, not an unvetted third-party server.
This token is exchanged with the Sigstore certificate authority (Fulcio), which issues a short-lived X.509 signing certificate binding the ephemeral signing key to the OIDC identity. The package tarball digest (SHA-256) and the build predicate are signed, submitted to the public Rekor transparency log, and stored in the npm registry as an in-toto attestation manifest.
┌────────────────────────────────────────────────────────────────────────────────────────┐
│ THE PROVENANCE TRUST BOUNDARY │
├─────────────────────────────────────────────┬──────────────────────────────────────────┤
│ WHAT SLSA / SIGSTORE CRYPTOGRAPHICALLY PROVES│ WHAT SLSA / SIGSTORE CANNOT AND DOES NOT │
├─────────────────────────────────────────────┼──────────────────────────────────────────┤
│ • Build originated on a GitHub-hosted VM │ • The committed source code is benign │
│ • Exact Git commit SHA that triggered run │ • Third-party dependencies are unpoisoned │
│ • Path of the executed workflow YAML file │ • The runner environment was uncompromised│
│ • Package tarball SHA-256 matches build │ • Outbound C2 traffic was blocked │
│ • Attestation is timestamped in Rekor log │ • Repository namespace was not hijacked │
└─────────────────────────────────────────────┴──────────────────────────────────────────┘The critical vulnerability lies in the delta between attestation of origin and assertion of integrity. The SLSA attestation guarantees with mathematical certainty that commit abc123 ran inside workflow release.yml on a genuine GitHub runner, and that the resulting tarball has not been altered since that runner packaged it.
However, the attestation is completely agnostic to runtime poisoning. If an infected dependency runs arbitrary shell commands during npm install inside that workflow, modifies compiled build artifacts in memory or on disk, and directs the workflow to package those modified artifacts, the resulting tarball is still legitimately signed. Sigstore faithfully signs whatever the compromised runner outputs.
flowchart TD
subgraph GitHub_Runner["GitHub Actions Runner (Authorized Boundary)"]
A[Git Checkout: Valid SHA] --> B[npm install]
B -->|Lifecycle Script Executes| C[Malicious Worm / Trojan]
C -->|Poisons Filesystem| D[Dist Build / Packaging]
C -->|Queries Internal OIDC| E[ACTIONS_ID_TOKEN_REQUEST_URL]
E -->|Issues Signed JWT| F[GitHub OIDC Provider]
D --> G[npm publish --provenance]
F --> G
end
subgraph npm_Registry["Public npm Registry & Sigstore"]
G -->|Exchanges JWT for Token| H[npm Trusted Publishing]
G -->|Signs Tarball Hash| I[Sigstore Rekor / Fulcio]
H --> J[Package Published: v1.0.1]
I --> K[Valid SLSA Attestation Badge]
end
classDef danger fill:#ff4d4f,stroke:#d9363e,color:#fff;
classDef safe fill:#52c41a,stroke:#389e0d,color:#fff;
classDef neutral fill:#1f1f1f,stroke:#434343,color:#fff;
class C danger;
class K,J safe;
class A,B,D,E,F,G,H,I neutral;---
3. Attack Walk-Through: The ChainDrop Incident
To understand why traditional CI/CD pipelines collapsed during the ChainDrop campaign, we must examine the worm's operational mechanics. First detected on August 4, 2026, the worm was analyzed and named ChainDrop by StepSecurity, while Microsoft Threat Intelligence characterized it as a *"Mini Shai-Hulud variant"*—referencing earlier autonomous self-replicating npm threats.
Across disparate ecosystem reports, the reported scale of the incident varied slightly depending on the monitoring timeframe: StepSecurity documented 444 unique packages and 2,212 versions published within a four-hour window, while initial reporting on August 7 cited "more than 400 packages" across the Keyv and Cacheable dependency trees. Earlier secondary context—such as the March 31, 2026 compromise of axios@1.14.1 and 0.30.4 where a dropper was published via compromised static npm credentials—foreshadowed this vector, but ChainDrop took automation a step further.
Step 1: Ingestion via Package Lifecycle Scripts
ChainDrop achieved initial execution through unpinned transitive dependency updates or direct typo-squats. The threat actor planted a malicious payload inside standard lifecycle scripts—specifically the preinstall or postinstall hooks defined in package.json.
When an unsuspecting developer ran npm install, or when a standard CI workflow executed npm ci, the package manager automatically executed the script with the full privileges of the executing user or runner daemon.
Step 2: Host and Runner Reconnaissance
Once active, the worm inspected its operating environment. It evaluated whether it was executing on a local developer workstation or a CI runner:
- Workstation Reconnaissance: Scanned
~/.npmrcfor static authentication tokens (_authToken), inspected~/.git-credentials, searched~/.ssh/for unencrypted private keys, and dumped environment variables for AWS and cloud credentials. - CI Runner Detection: Inspected environment flags for CI indicators, specifically searching for
GITHUB_ACTIONS=trueand the presence of GitHub Actions runtime socket variables.
Step 3: The OIDC Self-Minting Loop
In modern pipelines adopting npm Trusted Publishing, developers intentionally remove static, long-lived npm tokens (NPM_TOKEN) from their GitHub repository secrets to mitigate credential leakage. Instead, they configure GitHub Actions with OIDC publishing permissions:
# VULNERABLE WORKFLOW CONFIGURATION
permissions:
contents: read
id-token: write # Granted globally across the entire workflow!This architectural decision exposed a catastrophic flaw when combined with unisolated build steps. When permissions: id-token: write is declared at the workflow root, every step in every job—including dependency installation—has ambient access to the runner's internal OIDC token generation service.
The ChainDrop worm queried the internal GitHub Actions token service directly from its preinstall shell script:
# The worm extracts ambient Actions runtime tokens
curl -s -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=npm:registry.npmjs.org" \
-o /tmp/oidc_token.jsonThe worm extracted the signed identity JWT from the response. It then presented this legitimate GitHub-signed token directly to the npm registry API (https://registry.npmjs.org/-/npm/v1/tokens/token/claim).
Because the request originated from the designated repository and workflow, npm's Trusted Publishing backend validated the claims and issued a valid, short-lived publishing bearer token. The worm did not need to steal an existing npm token; it instructed GitHub and npm to issue a brand new one.
Step 4: Rapid Autonomous Propagation
With a valid publishing token in hand, the worm executed its propagation logic:
- Enumerated all packages mapped to the compromised repository or the maintainer's organization.
- Cloned or modified existing source files, incrementing the semantic version patch number in
package.json. - Injected its own
preinstallpayload into the new version's manifest. - Executed
npm publish --provenance.
Because the command ran inside the legitimate GitHub Actions runner on the legitimate commit ref, GitHub Actions happily generated the SLSA attestation, Fulcio issued the certificate, Rekor logged the entry, and npm published the trojanised release with a valid cryptographic provenance badge.
Step 5: C2 Beaconing via EtherHiding
To maintain persistence and coordinate propagation, the worm established command-and-control (C2) communication. According to secondary analyses published by StepSecurity, Microsoft, Unit 42, and Socket, ChainDrop reportedly resolved its command infrastructure via on-chain smart contracts—a technique known as EtherHiding. By retrieving payload instructions and destination addresses directly from immutable blockchain transactions rather than static DNS records or centralized IP addresses, the worm bypassed traditional IP reputation lists and static firewall blocks.
---
4. Second Failure Mode: The Slug-Takeover Flaw (Slugfest)
Even if a development team eliminates ambient CI tokens and prevents script-based self-minting, npm Trusted Publishing harbored a second architectural vulnerability that enabled attackers to ship trojanised code with valid provenance.
In October 2026, security research firm Bloom Security disclosed "Slugfest"—a critical flaw in how npm's Trusted Publishing backend verified GitHub repositories. Bloom reported the issue via HackerOne on June 6, 2026; GitHub validated the finding on June 9, 2026.
The Identity-Binding Architectural Flaw
Trusted Publishing was designed to eliminate static secrets by binding an npm package's publishing rights to a specific GitHub repository path (e.g., owner/repository) and workflow filename.
The underlying flaw was deceptively simple: npm recorded and verified repositories by their human-readable string slug (`owner/repo`), rather than GitHub's permanent, immutable numeric repository ID (`repository_id`).
┌────────────────────────────────────────────────────────────────────────┐
│ THE SLUG VS. NUMERIC ID BINDING FLAW │
├────────────────────────────────────────────────────────────────────────┤
│ 1. Maintainer registers: github.com/acme-corp/core-lib (ID: 98451230) │
│ 2. npm Trusted Publishing configures trust for: "acme-corp/core-lib" │
│ 3. Maintainer renames org or deletes repository. │
│ 4. Attacker registers freed slug: github.com/acme-corp/core-lib │
│ (GitHub assigns NEW numeric ID: 104882914) │
│ 5. npm checks string: "acme-corp/core-lib" == "acme-corp/core-lib" │
│ -> MATCH CONFIRMED. Publish token issued. │
└────────────────────────────────────────────────────────────────────────┘On GitHub, repository slugs are ephemeral. If an organization renames its account, transfers a repository to another maintainer, or deletes an obsolete repository, the original slug becomes immediately available for registration by anyone.
The Exploitation Mechanism
- The attacker scanned the npm registry for packages configured with Trusted Publishing whose backing GitHub repositories had been renamed or deleted. Bloom Security identified over 1,500 vulnerable packages representing more than 10 million cumulative downloads.
- The attacker claimed the vacant GitHub username or organization name, created a repository matching the target slug, and added a workflow file matching the path registered in npm (e.g.,
.github/workflows/publish.yml). - The attacker triggered the workflow. GitHub's OIDC service issued a JWT containing the claim
repository: "victim-org/victim-pkg". - npm compared the string claim against its database. Because the string matched, npm exchanged the JWT for a valid publishing credential.
- The attacker published a trojanised package version. The resulting artifact carried a valid SLSA provenance attestation, because GitHub officially signed the build from the claimed repository. Bloom confirmed that GitLab's Trusted Publishing integration suffered from the exact same namespace-binding vulnerability.
Remediation and Unresolved Questions
On October 2, 2026, GitHub announced a platform-wide mitigation: unvalidated Trusted Publishing configurations now expire 48 hours after creation, preventing attackers from establishing dormant persistence on newly created bindings without immediate authorization.
Maintainers must take immediate defensive action:
- Execute
npm trust list <package-name>across all published packages. - Verify that every listed repository URL resolves to an active, authentic organization that you currently control.
- Always revoke npm Trusted Publishing bindings before renaming, transferring, or deleting a backing GitHub repository.
---
5. Threat Model and Defense Matrix
The ChainDrop worm and the Slugfest vulnerability prove that software supply-chain defense cannot rely on a single control. Each defensive mechanism operates at a distinct stage of the attack lifecycle, and each exhibits definitive blind spots.
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ SUPPLY CHAIN THREAT MODEL & DEFENSE MATRIX │
├───────────────────────┬──────────────┬──────────────┬───────────────┬──────────────────┬─────────────────────────┤
│ ATTACK STAGE │ SLSA / npm │ RELEASE-AGE │ IGNORE-SCRIPTS│ RUNNER EGRESS │ CREDENTIAL & JOB │
│ │ PROVENANCE │ GATE │ (--ignore- │ FILTERING │ ISOLATION │
│ │ │ (Cooldown) │ scripts) │ (Default-Deny) │ (Decoupled Workflow) │
├───────────────────────┼──────────────┼──────────────┼───────────────┼──────────────────┼─────────────────────────┤
│ 1. Dependency Pull │ Does not │ MITIGATES │ Does not │ Does not │ Does not │
│ (Infected Package) │ help │ (Quarantines │ help │ help │ help │
│ │ │ fresh drops) │ │ │ │
├───────────────────────┼──────────────┼──────────────┼───────────────┼──────────────────┼─────────────────────────┤
│ 2. Install-Time Exec │ Does not │ Does not │ MITIGATES │ Does not │ Does not │
│ (Lifecycle Scripts) │ help │ help │ (Neutralizes │ help │ help │
│ │ │ │ preinstall) │ │ │
├───────────────────────┼──────────────┼──────────────┼───────────────┼──────────────────┼─────────────────────────┤
│ 3. Credential Theft │ Does not │ Does not │ Partially │ Does not │ MITIGATES │
│ (Env / Disk Scraping) │ help │ help │ mitigates │ help │ (Zero ambient secrets │
│ │ │ │ │ │ in build jobs) │
├───────────────────────┼──────────────┼──────────────┼───────────────┼──────────────────┼─────────────────────────┤
│ 4. OIDC Self-Minting │ Does not │ Does not │ Partially │ Does not │ MITIGATES │
│ (Internal Token API) │ help │ help │ mitigates │ help │ (No id-token: write │
│ │ │ │ │ │ in build jobs) │
├───────────────────────┼──────────────┼──────────────┼───────────────┼──────────────────┼─────────────────────────┤
│ 5. Trojanised Publish │ Does not │ Does not │ Does not │ Does not │ MITIGATES │
│ (npm publish) │ help │ help │ help │ help │ (Publish job runs zero │
│ │ (Signs worm!)│ │ │ │ untrusted code) │
├───────────────────────┼──────────────┼──────────────┼───────────────┼──────────────────┼─────────────────────────┤
│ 6. C2 & Exfiltration │ Does not │ Does not │ Does not │ MITIGATES │ Does not │
│ (EtherHiding / Drops) │ help │ help │ help │ (Blocks outbound │ help │
│ │ │ │ │ TCP/UDP calls) │ │
└───────────────────────┴──────────────┴──────────────┴───────────────┴──────────────────┴─────────────────────────┘---
6. A CI Pipeline That Survives It
To construct a pipeline resilient against worms of ChainDrop's caliber, organizations must abandon monolithic workflow designs. The fundamental security objective is complete physical and temporal separation between untrusted code execution (dependency installation, compiling, testing) and credentialed publishing.
6a. Decoupled Two-Job Workflow Architecture
The production-ready GitHub Actions workflow below enforces strict separation:
- Job 1 (`build_and_test`): Runs dependency installation and testing. It operates with strictly read-only permissions (
permissions: contents: read). It possesses zero OIDC token permissions (id-token: none). If an infected dependency runs malicious code, it cannot mint an npm token because the runner daemon refuses to provide an OIDC identity token. The job packages the application into an immutable tarball (npm pack) and uploads it as a workflow artifact. - Job 2 (`publish_release`): Runs strictly on official release tags. It holds
permissions: id-token: write, but it executes inside a protected GitHub Environment requiring mandatory human approval. Critically, it never runs `npm install` or `npm ci`. It downloads the pre-built tarball, checks out the exact git ref for attestation binding, and publishes the immutable artifact directly.
name: Secure Build & Publish Pipeline
on:
push:
branches: [main]
tags: ['v*.*.*']
pull_request:
branches: [main]
# Default least-privilege: zero ambient permissions across the workflow
permissions: {}
jobs:
# =========================================================================
# JOB 1: UNPRIVILEGED BUILD AND TEST
# Runs untrusted code (npm install, test suites, build scripts).
# Holds ZERO publishing credentials and CANNOT mint OIDC tokens.
# =========================================================================
build_and_test:
name: Build, Lint & Test
runs-on: ubuntu-latest
permissions:
contents: read # Strictly read-only repository checkout
steps:
- name: Checkout Source Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false # Prevents GITHUB_TOKEN leakage to disk
- name: Setup Node.js Runtime
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 22.x
cache: 'npm'
- name: Install Dependencies (Scripts Disabled)
run: |
# Enforce lifecycle script blocking during install
npm ci --ignore-scripts
- name: Compile Allowlisted Native Binaries
run: |
# Only rebuild explicitly vetted packages that require C++ compilation
# If your dependency tree has no native addons, omit this step entirely
if npm list sharp >/dev/null 2>&1; then
npm rebuild sharp --ignore-scripts=false
fi
- name: Execute Code Quality & Test Suites
run: |
npm run lint
npm test
- name: Package Immutable Release Tarball
if: startsWith(github.ref, 'refs/tags/v')
run: |
# Generate the standalone .tgz artifact
TARBALL_NAME=$(npm pack)
echo "TARBALL_PATH=${TARBALL_NAME}" >> $GITHUB_ENV
- name: Upload Build Artifact
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2b6cb776c53e # v4.4.3
with:
name: release-tarball
path: ${{ env.TARBALL_PATH }}
retention-days: 1
if-no-files-found: error
# =========================================================================
# JOB 2: ISOLATED CREDENTIALED PUBLISH VAULT
# Holds id-token: write, but NEVER runs npm install or third-party code.
# Runs inside a protected GitHub Environment requiring manual sign-off.
# =========================================================================
publish_release:
name: Publish to npm Registry
needs: [build_and_test]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment:
name: npm-production # Protected environment with mandatory peer approval
permissions:
id-token: write # Required for Sigstore & npm Trusted Publishing
contents: read # Required to inspect git metadata for SLSA provenance
steps:
- name: Checkout Release Tag Metadata
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Setup Node.js Runtime
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 22.x
registry-url: 'https://registry.npmjs.org'
- name: Retrieve Packaged Tarball
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: release-tarball
path: ./dist-tarball
- name: Publish Tarball with Provenance
run: |
# Locate the downloaded .tgz archive
TARBALL_FILE=$(ls ./dist-tarball/*.tgz)
echo "Publishing $TARBALL_FILE with SLSA provenance..."
# Publish strictly the pre-packaged binary archive
# ZERO dependencies are installed or executed in this step
npm publish "$TARBALL_FILE" --provenance --access public.git metadata to ensure that the commit being attested matches the commit associated with the GitHub Actions OIDC claims.---
6b. Install-Time Fences & Package Manager Quarantines
Decoupling CI jobs secures the publishing pipeline, but it does not protect development machines or testing runners from executing malicious code during npm install. Teams must configure package managers to neutralize lifecycle scripts and quarantine newly minted releases.
1. Blocking Lifecycle Scripts Globally
Maintainers should enforce script blocking in project-level configuration files:
# .npmrc (Place in repository root)
ignore-scripts=true
audit=true
save-exact=trueWhen ignore-scripts=true is active, commands like npm install and npm ci will bypass all preinstall, install, and postinstall scripts. If a specific package requires native compilation (e.g., esbuild, sharp), run an explicit allowlist rebuild:
# Install dependencies with scripts suppressed
npm ci --ignore-scripts
# Selectively compile only explicitly vetted packages
npm rebuild esbuild sharp --ignore-scripts=false2. Minimum Release Age Quarantines (The Cooldown Gate)
The vast majority of trojanised packages and worm campaigns are discovered, reported, and unpublished by registries within 24 to 48 hours of release. Implementing a release-age gate prevents automated tools and developers from pulling package versions published within a designated quarantine window.
However, cross-tooling inconsistency poses a dangerous operational trap. Different package managers measure release age in completely different time units:
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ PACKAGE MANAGER RELEASE-AGE CONFIGURATION │
├────────────────┬───────────────────────────┬───────────────┬────────────────────────────────────────────┤
│ PACKAGE MANAGER│ CONFIGURATION KEY │ TIME UNIT │ CONFIGURATION FILE │
├────────────────┼───────────────────────────┼───────────────┼────────────────────────────────────────────┤
│ npm (11.10+) │ min-release-age │ DAYS │ .npmrc │
│ pnpm (10/11) │ minimumReleaseAge │ MINUTES │ pnpm-workspace.yaml (or config.yaml) │
│ Bun │ minimumReleaseAge │ SECONDS │ bunfig.toml ([install] section) │
│ Yarn (Berry) │ npmMinimalAgeGate │ DURATION STR │ .yarnrc.yml │
└────────────────┴───────────────────────────┴───────────────┴────────────────────────────────────────────┘> [!CAUTION]
> The Monorepo Footgun: In a pnpm monorepo, configuring minimumReleaseAge: 2 under the assumption that it represents two days will actually set a quarantine of two minutes—providing zero protection against supply chain worms. Two days in pnpm requires minimumReleaseAge: 2880.
Here are the verified configuration snippets across modern package managers:
For npm (`.npmrc`):
# Delay installation of packages published less than 2 days ago
min-release-age=2
# Exclude internal organizational scopes from the age gate
min-release-age-exclude[]=@myorg/*For pnpm (`pnpm-workspace.yaml`):
# 2880 minutes = 48 hours (2 days)
minimumReleaseAge: 2880
minimumReleaseAgeStrict: true
# Only allow C++ native compilation for audited packages
onlyBuiltDependencies:
- esbuild
- sharp
# Bypass age gate for internal scoped packages
minimumReleaseAgeExclude:
- '@myorg/*'For Bun (`bunfig.toml`):
[install]
# Bun supports human-readable duration strings or raw seconds
minimumReleaseAge = "2d" # or 172800
# Exclude internal scopes from release gate
minimumReleaseAgeExcludes = ["@myorg/*"]For Yarn Berry (`.yarnrc.yml`):
# Enforce a 48-hour quarantine cooldown
npmMinimalAgeGate: "2d"
# Pre-approved internal packages
npmPreapprovedPackages:
- "@myorg/*"---
6c. CI Runner Egress Filtering
The ChainDrop worm relied on outbound network access to resolve its EtherHiding C2 contracts and exfiltrate harvested credentials. In standard GitHub-hosted runners, outbound internet access is completely unrestricted. Any process executing on the runner can open raw TCP sockets, query arbitrary external APIs, or upload environment variables to remote servers.
Hardening CI requires implementing default-deny egress filtering. Whether using eBPF-based runner security agents, proxy gateways, or custom network security groups:
- Default-Deny Policy: Block all outbound TCP and UDP traffic from the runner by default.
- Explicit Registry Allowlisting: Permit outbound HTTPS (port 443) strictly to designated endpoints:
* registry.npmjs.org (for package retrieval and publishing) * api.github.com and github.com (for source retrieval) * actions.githubusercontent.com (for Actions runtime and OIDC coordination)
- Block Direct IP Connections: Terminate connections attempting to communicate with raw IP addresses, non-standard ports, or known blockchain RPC endpoints used for EtherHiding C2 resolution.
When a malicious preinstall script attempts to transmit credentials or establish a reverse shell, an egress-filtered runner drops the packets immediately, containing the threat within the isolated execution sandbox.
---
6d. Credential Hygiene and Ambient Token Elimination
Organizations must eliminate long-lived, ambient publishing tokens across their developer base:
- Ban Ambient `_authToken` Entries: Developers should never maintain static publishing tokens in local
~/.npmrcfiles on personal laptops. If local publishing is strictly required, require ephemeral tokens generated via WebAuthn / hardware security keys (FIDO2/YubiKey). - Mandate Granular Automation Tokens: Where OIDC is technically unsupported (such as legacy deployment systems), configure granular access tokens restricted strictly to specific package scopes and bound to approved egress CIDR blocks.
- Automated Secret Scanning: Enable GitHub Secret Scanning and push protection to automatically revoke tokens if they are committed to repository files.
---
6e. Maintainer Audit Checklist: Securing Trusted Publishing
To protect your packages against the Bloom Security slug-takeover vulnerability:
- Audit Active Trust Configurations: Run the npm CLI inspection command across all organizational packages:
bash npm trust list <package-name>
- Verify Backing Repositories: Ensure that every listed GitHub repository URL points to an active, valid repository within an organization that you currently own and control.
- Pre-Rename Revocation Protocol: If you plan to transfer, rename, or delete a GitHub repository, delete the Trusted Publishing binding in npm first:
bash npm trust revoke <package-name> --all
- Re-Authenticate Post-Transfer: After renaming or transferring a repository, establish a fresh Trusted Publishing binding from the new repository URL to ensure the binding is cryptographically registered against current GitHub platform identifiers.
---
7. Consumer-Side Verification: Necessary but Not Sufficient
For software developers consuming third-party dependencies, verifying SLSA provenance is an essential hygiene practice—but engineers must understand precisely what verification accomplishes.
Verifying Provenance Locally
Consumers can verify that an installed package matches its public attestation using the npm CLI:
# Verify cryptographic signatures and SLSA attestations across dependencies
npm audit signaturesTo inspect an individual package's attestation record in the Sigstore transparency log:
# Using the GitHub CLI to inspect the SLSA attestation
gh attestation verify ./node_modules/<package-name>/package.json \
--owner <expected-github-org>The Boundary: Why Verification Is Necessary but Insufficient
Understanding the difference between the two attack vectors highlights why client-side verification has limits:
- Why Verification Detects Slug Takeovers (Slugfest): If an attacker exploits a deleted repository slug to publish a malicious package, the attestation will explicitly identify the attacker's repository (e.g.,
attacker-account/target-pkg). A consumer checking that the repository matches the legitimate maintainer's organization (--owner legitimate-org) will detect the discrepancy and reject the build. - Why Verification Fails to Detect ChainDrop: Because ChainDrop compromised the runner executing the legitimate workflow in the legitimate maintainer's repository, the attestation correctly names the authentic repository and commit. Client-side signature verification passes 100% cleanly.
Provenance verification confirms authenticity of origin. It does not confirm absence of malice.
---
8. Incident Response Runbook: When a Runner or Token Leaks
If your CI monitoring detects unauthorized outbound network traffic, an unexpected package version release, or signs of runner tampering, execute this incident response runbook immediately:
┌────────────────────────────────────────────────────────────────────────────────────────┐
│ SUPPLY CHAIN INCIDENT RESPONSE PHASES │
├─────────────┬──────────────────────────────────────────────────────────────────────────┤
│ PHASE 1 │ Revoke active Actions workflow runs; disable OIDC token permissions. │
├─────────────┼──────────────────────────────────────────────────────────────────────────┤
│ PHASE 2 │ Quarantine self-hosted runner VMs; capture volatile memory & disk dumps. │
├─────────────┼──────────────────────────────────────────────────────────────────────────┤
│ PHASE 3 │ Deprecate compromised versions on npm; release clean increment. │
├─────────────┼──────────────────────────────────────────────────────────────────────────┤
│ PHASE 4 │ Publish GitHub Security Advisory (GHSA); request CVE; notify community. │
└─────────────┴──────────────────────────────────────────────────────────────────────────┘Phase 1: Containment and Token Invalidation
- Cancel Running Workflows: Immediately abort all in-flight GitHub Actions runs across the organization:
bash gh run list --status in_progress --json databaseId -q ".[].databaseId" | \ xargs -I {} gh run cancel {}
- Revoke Ambient npm Tokens: Navigate to
npmjs.com -> Access Tokensand immediately revoke all active automation and publish tokens. - Disable Workflow OIDC Permissions: Push a commit to the affected repository setting
permissions: {}globally to prevent subsequent runs from generating OIDC tokens.
Phase 2: Runner Quarantine and Forensics
- Isolate Runner Instances: If using self-hosted or persistent runners, disconnect them from the local network immediately. Do not terminate the instances until memory captures and disk snapshots are secured for forensic analysis.
- Analyze Egress Logs: Inspect VPC flow logs, firewall records, and DNS proxy queries to identify external IP addresses or blockchain RPC endpoints contacted by the runner.
Phase 3: Registry Remediation
- Deprecate Malicious Versions: Mark the trojanised releases as deprecated with an explicit security warning:
bash npm deprecate <package-name>@<malicious-version> "CRITICAL: Compromised release. Do not install. See GHSA-xxx."
- Emergency Unpublishing: If the package was published within the last 72 hours and meets npm's unpublishing criteria, contact npm registry support immediately to request package removal to prevent automated downstream syncing.
- Publish Clean Patch: From an isolated, verified clean workstation, compile and publish a clean patch version (e.g.,
v1.0.2) to ensure that downstream consumers pinning caret (^) ranges automatically roll forward to a benign build.
Phase 4: Attestation and Ecosystem Disclosure
- Publish GitHub Security Advisory (GHSA): Draft an advisory detailing the compromised versions, the attack vector, and affected namespaces.
- Request CVE Assignment: Submit the advisory to the GitHub Advisory Database to ensure vulnerability scanners and dependabot trigger downstream remediation alerts globally.
---
9. Honest Limits and Engineering Trade-Offs
Hardening software supply chains requires balancing security guarantees against developer velocity. Every defensive control introduces specific engineering trade-offs:
- The Friction of `ignore-scripts`: Suppressing lifecycle scripts globally breaks legitimate packages that rely on postinstall scripts to download pre-compiled native binaries (e.g.,
sharp,esbuild,canvas,sqlite3). Teams must maintain explicit rebuild allowlists in their CI scripts, introducing maintenance overhead whenever dependencies are updated. - Release-Age Gates vs. Emergency Hotfixes: While a 48-hour release-age quarantine protects against rapid worm outbreaks, it simultaneously blocks developers from pulling urgent, legitimate zero-day patches. Teams must establish documented, emergency bypass mechanisms (e.g.,
npm install <pkg> --min-release-age 0) with required architectural sign-offs. - Dormant Attackers Bypass Age Gates: Release-age gates are entirely ineffective against patient threat actors who publish a benign package version, wait two weeks for the cooldown period to expire, and trigger a payload dynamically via external C2 commands.
- Pipeline Execution Latency: Decoupling CI pipelines into separate build, test, package, and publish stages—combined with artifact upload/download steps and GitHub Environment approval gates—adds between 45 and 90 seconds to release cycles. For teams accustomed to single-step deployments, this represents intentional, necessary operational friction.
- The Limits of Human Review: Requiring human approvals on GitHub Environments protects against automated worm propagation, but human reviewers cannot manually audit 50,000 lines of minified, obfuscated JavaScript contained in transitive dependency trees. Structural boundaries, not human fatigue, must enforce isolation.
---
10. Conclusion: 5 Prioritized Architectural Actions
The ChainDrop worm and the Slugfest flaw dismantled the comforting myth that cryptographic provenance guarantees software safety. Provenance is a forensic audit trail, not a protective shield. It answers *where* an artifact came from, but remains blind to *what* that artifact does.
To protect production infrastructure from the next generation of supply-chain worms, engineering teams should execute these five prioritized architectural actions:
┌────────────────────────────────────────────────────────────────────────────────────────┐
│ PRIORITIZED PIPELINE HARDENING ACTIONS │
├────┬─────────────────────────────┬─────────────────────────────────────────────────────┤
│ # │ ARCHITECTURAL ACTION │ SECURITY IMPACT / ROI │
├────┼─────────────────────────────┼─────────────────────────────────────────────────────┤
│ 01 │ Decouple Build and Publish │ Eliminates ambient OIDC token access during install.│
│ 02 │ Enforce ignore-scripts=true │ Blocks arbitrary code execution on developer PCs/CI.│
│ 03 │ Deploy Release-Age Gates │ Enforces mandatory community quarantine cooldown. │
│ 04 │ Audit npm trust list │ Eliminates orphaned, take-over-vulnerable slugs. │
│ 05 │ Restrict Runner Egress │ Terminates C2 communication and secret exfiltration.│
└────┴─────────────────────────────┴─────────────────────────────────────────────────────┘- Decouple CI Build and Publish Jobs Immediately: Strip all
id-token: writepermissions from jobs runningnpm installor test suites. Isolate publishing behind a protected GitHub Environment that executes zero external code and publishes pre-packaged tarballs. - Enforce `ignore-scripts=true` Across All Environments: Add
ignore-scripts=trueto the root.npmrcof every repository. Explicitly allowlist and rebuild only audited native dependencies. - Activate Minimum Release Age Quarantines: Configure
min-release-age=2in npm,minimumReleaseAge: 2880in pnpm, orminimumReleaseAge = "2d"in Bun. Ensure your team understands the time-unit differences across package managers. - Audit Trusted Publishing Bindings: Run
npm trust listacross all owned packages. Revoke trust configurations for any repository that has been deleted, renamed, or transferred. - Implement Default-Deny Runner Egress: Restrict CI runner outbound traffic strictly to approved package registries and GitHub API endpoints, dropping arbitrary TCP/UDP connections to external C2 infrastructure.
---
11. Frequently Asked Questions (FAQ)
Does npm provenance protect developers from malicious maintainers or compromised accounts?
No. Provenance cryptographically proves that an artifact was produced by a specific repository commit inside a declared CI/CD workflow. If a legitimate maintainer's account is compromised, or if a rogue maintainer intentionally commits malicious code to the repository, the CI/CD pipeline will build the artifact and generate a 100% valid SLSA provenance attestation. Provenance verifies identity and origin; it does not verify intent or software safety.
Why was ChainDrop able to ship packages with valid SLSA provenance badges?
ChainDrop compromised the CI runner during the npm install step via an unisolated lifecycle script (preinstall). Because the workflow held global permissions: id-token: write, the worm queried GitHub Actions' internal OIDC service, received a legitimate signed token, exchanged it with npm's Trusted Publishing backend for a fresh publishing token, and executed npm publish --provenance. Because the publish command executed inside the authorized GitHub runner under the declared workflow, GitHub Actions and Sigstore generated valid SLSA provenance.
What is the primary footgun when configuring release-age gates in monorepos?
The primary footgun is unit mismatch across package managers. npm measures min-release-age in days, pnpm measures minimumReleaseAge in minutes, and Bun measures minimumReleaseAge in seconds. If a developer migrating from npm to pnpm sets minimumReleaseAge: 2, they have established a 2-minute cooldown instead of a 2-day cooldown, completely nullifying the security benefit of the release-age gate.
Does running `npm ci --ignore-scripts` break packages that rely on native binaries like `sharp` or `esbuild`?
Yes. Packages with native C++ or Go bindings rely on lifecycle scripts to download pre-compiled binaries or invoke node-gyp. Running --ignore-scripts skips this compilation step, which can cause runtime module loading errors. To resolve this without sacrificing security, maintain an explicit allowlist in your CI pipeline by running npm ci --ignore-scripts followed by npm rebuild <package-name> --ignore-scripts=false for audited native packages.
What was the Bloom Security "Slugfest" vulnerability in npm Trusted Publishing?
Slugfest was a namespace-binding vulnerability where npm authenticated GitHub repositories by their human-readable string slug (owner/repo) rather than GitHub's permanent, immutable numeric repository ID (repository_id). When maintainers deleted or renamed repositories, attackers could register the vacated slug, create a matching workflow, and obtain publishing credentials from npm with valid SLSA provenance pointing to the attacker's repository.
How does splitting GitHub Actions into two jobs prevent OIDC token theft?
In GitHub Actions, permissions can be scoped to individual jobs. By assigning permissions: contents: read to the build_and_test job and granting permissions: id-token: write strictly to an isolated publish job, untrusted dependencies executing during npm install in the build job cannot access the runner's internal OIDC daemon. The publish job never runs npm install, ensuring that no third-party code ever executes within the credentialed environment.


