Creuto is now an OpenAI Select Partner Read More

Custom Software Development

SAP npm supply chain attack: what CAP stole, how to pin

The SAP npm supply chain attack hid a credential stealer in four CAP and mbt packages. Check your BTP project, then pin installs before the next one.

SAP npm supply chain attack: what CAP stole, how to pin

The SAP npm supply chain attack of 29 April 2026 put a credential stealer inside four official SAP packages, @cap-js/sqlite 2.2.2, @cap-js/postgres 2.2.2, @cap-js/db-service 2.10.1 and mbt 1.2.48, and it ran the moment npm install did. By the end of this post you will know how to check a BTP project for it, and which three build controls would have stopped it.

The question is back because of a different incident. On 27 November 2026 SAP confirmed a security incident after suspicious GitHub activity, following a Der Spiegel report on an internal memo about an attack tracked as "Project Granite". Spiegel's sources allege stolen employee tokens and altered source code on GitHub; SAP has confirmed only suspicious activity and says it found "no evidence of unauthorized access to customer business data". No source links Granite to the April packages. We use April as the precedent because it is the documented case of what reaches a CAP developer's machine when SAP's publishing path is abused.

PackageMalicious version (published, UTC)Clean follow-up (published, UTC)
mbt (Cloud MTA Build Tool)1.2.48 (09:55)1.2.49 (16:15)
@cap-js/sqlite2.2.2 (11:25)2.4.0 (13:46)
@cap-js/postgres2.2.2 (12:14)2.3.0 (13:46)
@cap-js/db-service2.10.1 (12:14)2.11.0 (13:46)

Publish times come from the npm registry's own records and match Snyk's timeline. All four malicious versions have since been removed from the registry. Socket put weekly downloads at roughly 260,000 for @cap-js/db-service, 250,000 for @cap-js/sqlite, 52,000 for mbt and 10,000 for @cap-js/postgres.

What the malicious cap-js packages did on install

Each compromised package added a preinstall hook, node setup.mjs, so the payload ran before your code ever imported anything. According to Socket's analysis, setup.mjs downloaded Bun 1.3.13 from Bun's GitHub releases and used it to run an obfuscated execution.js. Aikido measured that payload at 11.7 MB and noted it exits on a Russian locale.

On a developer machine the stealer went for SSH private keys, AWS, Azure, GCP and Kubernetes credentials, ~/.npmrc, .env files, the output of gh auth token, and AI tool configuration such as ~/.claude.json, per Socket. On a CI runner it read the memory of the Runner.Worker process through /proc, which pulls out secrets that log masking would have hidden. The @cap-js/sqlite variant also tried npm's OIDC token exchange endpoint.

Stolen data was encrypted and pushed to a new public repository in the victim's own GitHub account. BleepingComputer, Socket and Aikido all report the repository description "A Mini Shai-Hulud has Appeared". Wiz's write-up gives a different description, "Checkmarx Configuration Storage", for the same exfiltration step. If you are hunting, search for both.

The payload then used any npm token it found to inject itself into packages the victim maintains, and it planted persistence in two files developers rarely review: a .claude/settings.json SessionStart hook and a .vscode/tasks.json task that runs on folder open. Socket links the campaign to TeamPCP "with medium confidence"; Wiz says "high confidence".

How the attackers got publish rights: two stories, one gap

Early coverage leaned on a hypothesis. BleepingComputer quoted security engineer Adnan Khan that "an NPM token may have been exposed via a misconfigured CircleCI job", and Aikido traced that lead to a short-lived pull request on SAP/cloud-mta-build-tool whose CircleCI build ran attacker-added files. That fits mbt.

For the cap-js packages, SAP's own engineers gave a different account. In cap-js/cds-dbs pull request #1592, opened at 14:02 UTC that day, they wrote that "an unauthorized actor pushed malicious commits that hijacked the release workflow" and that the attacker could publish "because the workflow had publish permissions without any manual approval gate". The fix splits publishing into its own job behind an environment review.

The registry shows the same gap from the outside. Normal cap-js releases, such as @cap-js/sqlite 2.2.1, are published by the GitHub Actions trusted publisher with provenance attestations. Snyk, reading registry data, says the four malicious versions came from the cloudmtabot account instead. If your own team publishes internal packages for BTP, a publish job that any push can trigger is the gap to close first, and it is the same discipline as a release gate on what your build ships.

How to check if SAP npm packages are compromised in your project

Checking a project for Mini Shai-Hulud takes five passes, and the first two take minutes. Wiz and Aikido both recommend searching lockfiles, CI logs, artifact stores and developer machines, not just the current branch.

  1. Lockfiles and installed trees. Run npm ls --all @cap-js/sqlite @cap-js/postgres @cap-js/db-service mbt in each CAP project and grep every package-lock.json in your history for the four versions. Check global installs too: mbt's README tells you to run npm install -g mbt@version, and a global install in a CI image has no lockfile at all.
  2. Files on disk. Look for setup.mjs or execution.js inside those package folders, a tmp.987654321.lock file, and Bun 1.3.13 downloads in CI logs from 29 April onward.
  3. GitHub. Search your organisation and developers' personal accounts for new public repositories with either description above, commits titled "chore: update dependencies", and the string OhNoWhatsGoingOnWithGitHub.
  4. Persistence. Grep repositories for .claude/settings.json hooks running node .vscode/setup.mjs and .vscode/tasks.json tasks running node .claude/setup.mjs.
  5. A later cap-js version. Add @cap-js/openapi 1.4.1 to the search. A separate advisory says that version, published in May 2026, harvested credentials and attempted self-propagation; 1.4.2 is the fix.

Any hit means every credential reachable from that machine or runner is exposed. Aikido's advice is blunt: "Do not limit rotation to npm tokens."

Should we disable npm install scripts?

Yes, for dependencies, with an allowlist, and npm itself has now moved that way. npm 12 ships with allowScripts off by default, so dependency preinstall, install and postinstall scripts no longer run unless the project approves them. pnpm 11 does the same through allowBuilds, with strictDepBuilds defaulting to true so unreviewed build scripts fail the install.

The strongest argument against blocking is that it breaks real packages, and mbt is one of them. The current mbt release has an install script, node install cloud-mta-build-tool, that fetches the actual build binary. So mbt ends up on your allowlist, and how you allowlist it decides whether you were safe.

npm approve-scripts writes version-pinned entries such as mbt@1.2.47 by default. Under that policy, a pinned approval would have skipped 1.2.48's preinstall, because 1.2.48 was never approved. A name-only approval, written with --no-allow-scripts-pin, would have let it run. Keep the default.

Two caveats. The npm docs say --ignore-scripts overrides allow-scripts, so a blanket ignore-scripts=true left in .npmrc quietly stops mbt from installing its binary. And script blocking does nothing against a payload that runs when your code imports the package, which is why it is one control of three.

Lockfile pinning and release age: the hours that mattered

Every malicious version in the SAP npm supply chain attack had a clean successor within about six and a half hours, so the defence that matters is not resolving anything new during that window. Two settings do that.

The first is a committed lockfile installed with npm ci. The npm ci documentation says it "will never write to package.json or any of the package-locks", and exits with an error if the two disagree. A caret range like ^2 only picks up 2.2.2 when someone regenerates the lockfile; with npm ci in CI, that happens in a reviewed pull request, not on a runner at 11:30 UTC.

The second is a minimum release age. npm's min-release-age installs only versions published more than the given number of days ago, and before does the same against a fixed date. InfoQ reports it arrived in npm 11.10.0. pnpm's minimumReleaseAge is measured in minutes and defaults to 1440 in pnpm 11. A one-day delay would have kept a fresh resolve on 29 April off all four versions, and Socket, Aikido and Wiz had published their analyses that same day. The same pinning logic applies to the actions in your pipeline, which GitHub Actions workflow lockfiles now cover.

Provenance checks help for cap-js and stay silent for mbt

npm audit signatures verifies registry signatures and provenance attestations for what you installed. Registry signatures alone will not catch a stolen-token publish: the registry signs name@version:integrity for whatever it accepts, so a malicious version carries a valid one.

Provenance is the more useful signal, but only for packages that normally have it. Recent cap-js releases are published by GitHub Actions with attestations. mbt is not: 1.2.47 and 1.2.49 were published by cloudmtabot with no attestations, so a provenance check cannot tell a good mbt release from a bad one. For SAP-scoped packages, the practical check is a diff: alert when a new @cap-js version arrives without attestations or from a publisher other than the trusted one. Run it after an install with scripts off, or it runs too late.

On the publishing side, npm's trusted publishing replaces long-lived tokens with short-lived OIDC credentials and supports GitHub Actions, GitLab CI/CD and CircleCI cloud, though CircleCI publishes do not generate provenance. It shrinks what a stealer can take, but the sqlite variant's attempt on the OIDC exchange shows it is not a full answer. If you run self-hosted CI, assume breach for any runner that installed the four versions and rebuild it; the same reasoning we applied to the Artifactory vulnerability chain holds here.

Hardening a BTP build after the SAP npm supply chain attack

For a team shipping CAP services and MTA archives to BTP, the order is: confirm you never installed the four versions, rotate if you did, then land three changes in one pull request. Commit lockfiles and switch CI to npm ci. Turn dependency install scripts off with a version-pinned allowlist that names mbt. Set a one-day minimum release age, with an exclusion process for urgent SAP patches.

None of this waits for SAP to say more about Project Granite. If your BTP extensions and the integrations around them are built by pipelines nobody has reviewed since April, our API development and integration team can audit the lockfiles, install-script policy and publish path of your CAP services, and the CI/CD implementation work that follows is the same work.

Frequently asked questions

The SAP npm packages compromised on 29 April 2026 were @cap-js/sqlite 2.2.2, @cap-js/postgres 2.2.2, @cap-js/db-service 2.10.1 and mbt 1.2.48, the Cloud MTA Build Tool. SAP published clean follow-ups the same day: sqlite 2.4.0, postgres 2.3.0, db-service 2.11.0 and mbt 1.2.49.

The malicious cap-js packages ran a preinstall hook that downloaded the Bun runtime and executed an obfuscated payload. It stole SSH keys, cloud and Kubernetes credentials, npm and GitHub tokens, and CI secrets read from runner memory, then uploaded them to a new public GitHub repository in the victim's own account.

Checking a project for Mini Shai-Hulud starts with lockfiles and global installs for the four bad versions, then setup.mjs or execution.js on disk, Bun 1.3.13 downloads in CI logs, new public GitHub repositories with the campaign's description, and unexpected .claude/settings.json or .vscode/tasks.json files in your repositories.

SAP CAP projects should block dependency install scripts and approve only the packages that need them, pinned to exact versions. The mbt build tool needs its install script to fetch its binary, so a version-pinned approval keeps builds working while refusing scripts from any new, unreviewed mbt release.

No published source links SAP's November 2026 Project Granite incident to the April npm package compromise. SAP has confirmed suspicious GitHub activity and says it found no evidence of unauthorized access to customer business data; reported token theft and altered source code remain allegations from Der Spiegel's sources.

Written by

Akash Mohapatra

Akash Mohapatra

Co Founder & Director

29 Nov 2026

·

9 min read

Share

LET'S CONNECT

Connect with Creuto!

Ready to take the first step towards unlocking opportunities, realizing goals, and embracing innovation? We're here and eager to connect.