Supply Chain Campaign Targets SAP npm Packages with Credential-Stealing Malware
Malicious versions of SAP npm packages were published with a preinstall script that downloads and runs a credential-stealing payload. The malware harvests developer and CI/CD secrets from GitHub, npm, cloud providers, and browsers, and exfiltrates them via attacker-controlled GitHub repositories.
Published on wiz.io
Both packages appear to contain the same malicious functionality previously seen in the SAP operation. Analysis is ongoing.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
The malware could steal a wide range of credentials from developers and CI/CD systems, potentially leading to further compromise of repositories and cloud environments.
What the attacker needed
Install an affected package version; npm install runs scripts
The fix
The affected packages should be removed or updated, and all potentially exposed credentials should be rotated.
How it was found
- The attacker publishes a modified version of a legitimate SAP npm package that includes a preinstall script.
- When a developer runs npm install, the preinstall script executes setup.mjs automatically.
- setup.mjs downloads the Bun runtime and runs an obfuscated payload called execution.js.
- The payload collects credentials from the local environment, including GitHub tokens, npm credentials, cloud secrets, Kubernetes tokens, and browser passwords.
- The stolen data is encrypted and exfiltrated to attacker-controlled GitHub repositories via the GraphQL API.
- The malware also attempts to propagate by poisoning other GitHub repositories using stolen tokens.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When you install a package from npm, it can run scripts automatically. Attackers modified popular SAP packages so that during installation, a script downloaded and ran malicious code. That code then stole passwords and tokens from the developer's computer and from cloud services, and sent them to the attacker.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.