Four SAP NPM packages have been injected with malicious code as part of a new supply chain attack, security researchers warn.

The campaign, referred to as Mini Shai-Hulud, is targeting packages linked to the SAP Cloud Application Programming (CAP) ecosystem and SAP cloud deployment workflows.

On April 29, four package versions were flagged as malicious, namely npm mbt 1.2.48, npm @cap-js/db-service 2.10.1, npm @cap-js/postgres 2.2.2, and npm @cap-js/sqlite 2.2.2.

With over 500,000 combined weekly downloads, these packages are SAP’s Cloud MTA Build Tool for building Multi-Target Application archives, and database service packages for CAP software.

These packages, Socket reports, were injected with a preinstall script working as a runtime bootstrapper. When executed, the script fetches a Bun ZIP from a GitHub repository, extracts it, and executes the included Bun binary.

According to Onapsis, the malicious package versions were available for 2-4 hours. They have since been unpublished and clean versions have been released to supersede them.

The malicious code delivered through the compromised packages is an information stealer that targets local credentials, GitHub and NPM tokens, and AWS, Azure, GCP, GitHub Action, Kubernetes, and other cloud secrets.

The malware exfiltrates them through public GitHub repositories that have the hardcoded description “A Mini Shai-Hulud has Appeared”. The malware also includes a propagation mechanism.

According to Aikido, the threat checks for GitHub Actions release workflows and then modifies package tarballs to add the payload, modify their versions, repackage them, and use stolen GitHub Actions tokens to publish them.

SAP’s NPM ecosystem was likely hit through a compromised NPM token that was exposed to pull request builds via CircleCI, Aikido says.

As Onapsis underlines, the Mini Shai-Hulud supply chain attack represents a major threat to developers and organizations that use SAP CAP, which is the framework for S/4HANA extensions, Fiori app backends, MTAs, and integration flows.

“Any SAP customer with JavaScript development may be pulling @sap/* and @cap-js/* packages into their build pipelines, frequently with loose version ranges and lots of transitive dependencies,” Onapsis notes.

All organizations using SAP Business Technology Platform workflows, SAP CAP, or MTA-based deployment pipelines should check if they installed the malicious package versions during the exposure window.

Based on technical overlaps and operational patterns, cybersecurity firm Wiz attributes the incident to the notorious TeamPCP hacking group that claimed several supply chain attacks over the past months.

“This assessment is due to a shared RSA public key used to encrypt the exfiltrated secrets. This means that the same private key would decrypt the payloads, limiting the accessibility of the exfiltrated data to TeamPCP,” Wiz notes.

Related: Critical Gemini CLI Flaw Enabled Host Code Execution, Supply Chain Attacks

Related: Checkmarx Confirms Data Stolen in Supply Chain Attack

Related: Bitwarden NPM Package Hit in Supply Chain Attack