Malicious npm Packages Steal SSH Keys, API Tokens, Cloud Credentials, and Wallet Secrets


A new npm supply chain campaign is targeting blockchain, Web3, and cloud developers by stealing sensitive secrets from developer machines and build environments.

CYFIRMA says it identified 11 suspicious npm packages linked to the operation, including ethers-jss, coinbase-wallet-utils, moralis-sdk, ganach, solidty, stelar-sdk, hardhat-deploy-utils, web3-deploy-helper, defi-sdk-core, ethers-compat, and ethereum-dev-utils.

The campaign targets some of the most valuable developer secrets, including SSH private keys, GitHub tokens, npm tokens, AWS keys, API credentials, Ethereum private keys, mnemonic phrases, seed phrases, and deployment configuration files.

npm Packages Used Install Scripts to Steal Developer Secrets

The attack relies heavily on npm lifecycle scripts. According to the official npm scripts documentation, npm can run preinstall, install, and postinstall scripts during package installation.

That behavior is useful for legitimate setup tasks, but attackers can abuse it. In this campaign, malicious code could run as soon as a developer installed a package, with no extra action required after the install command.

CYFIRMA grouped the activity into multiple clusters. Some packages wrapped legitimate Ethereum development libraries, some used typosquatting, and others used blockchain infrastructure to hide command-and-control details.

Package or clusterMain tacticPrimary risk
ethers-jssMalicious wrapper around Ethereum toolingWallet private key and mnemonic theft
coinbase-wallet-utilsReconnaissance and data exfiltrationHost, user, directory, and environment data theft
moralis-sdkTrojanized copy of a legitimate SDK structureObfuscated postinstall downloader
ganach, solidty, stelar-sdkTyposquatting and smart contract-based infrastructure lookupPlatform-specific payload delivery
ethcompat-related packagesOn-chain data exfiltrationEncrypted credential theft through Ethereum transactions

ethers-jss Targeted Wallet Creation and Recovery

The ethers-jss package posed as a useful Ethereum development package, but researchers found wallet hijacking logic inside it. The malware hooked wallet creation and wallet recovery functions to capture private keys and mnemonic phrases.

That made the package especially dangerous for Web3 developers. If a developer generated or restored a wallet while the malicious package was active, the malware could collect the wallet address, private key, and recovery phrase.

The same package also searched for sensitive files and environment variables. Targets included .env files, Hardhat configuration files, shell configuration files, private keys, cloud secrets, npm tokens, GitHub tokens, Infura keys, and Alchemy keys.

  • SSH private keys stored in the .ssh directory
  • Cloud credentials such as AWS secret keys
  • Developer tokens such as NPM_TOKEN and GITHUB_TOKEN
  • Wallet secrets such as PRIVATE_KEY, MNEMONIC, and SEED_PHRASE
  • Blockchain deployment files such as hardhat.config.js and foundry.toml

moralis-sdk Had the Largest Reported Exposure

The moralis-sdk package created a larger exposure because of its reported download volume. CYFIRMA says the package had accumulated more than 2.7 million downloads at the time of analysis, which increased the potential reach of the campaign.

The package used a staged approach. Version 1.0.0, published on October 28, 2025, appeared to be a clean copy of the legitimate project. Version 1.0.1, published on November 11, 2025, introduced the malicious postinstall code.

Command-and-Control (C2) Configuration (Source – Cyfirma)

The malicious behavior was isolated in postinstall.js. The rest of the package copied legitimate-looking documentation, examples, README content, and project files to reduce suspicion.

Attackers Used Blockchain and Trusted Services

Several packages used more advanced infrastructure techniques. The ganach, solidty, and stelar-sdk packages queried an Ethereum smart contract to retrieve infrastructure details instead of hard-coding a command-and-control server.

This approach can make takedowns harder because infrastructure details can change through blockchain-based configuration. It also gives the malware a way to hide operational details from quick static checks.

Another cluster encrypted stolen credentials and embedded the data inside Ethereum transaction fields. That turned public blockchain infrastructure into an exfiltration channel and made stolen data appear as normal blockchain activity.

TechniqueHow it workedWhy it matters
Lifecycle script executionMalicious code ran during installDevelopers did not need to open or run a separate file
Package impersonationPackages copied trusted project names or structuresDevelopers could mistake them for legitimate tools
Smart contract lookupMalware queried Ethereum for infrastructure dataAttackers avoided obvious hard-coded C2 values
On-chain exfiltrationEncrypted data was placed in Ethereum transactionsCredential theft blended into blockchain activity
Obfuscated downloadersScripts hid payload logic and fetched more codeSecurity tools had fewer static indicators to inspect

Why This Is a Serious Supply Chain Risk

The campaign fits a broader software supply chain attack pattern. MITRE ATT&CK tracks this behavior under T1195.001, which covers compromise of software dependencies and development tools.

The risk extends beyond one developer laptop. A stolen npm token can help attackers publish malicious updates. A stolen GitHub token can expose source code and automation workflows. A stolen cloud key can give attackers access to production infrastructure.

Recent research from Unit 42 shows that modern npm attacks increasingly target CI/CD pipelines, cloud credentials, GitHub tokens, npm tokens, SSH keys, Kubernetes secrets, and HashiCorp Vault secrets.

Developers Should Treat npm Installs as Code Execution

The official npm scripts documentation makes clear that package scripts can run during installation. That means installing an unknown package can be equivalent to executing code from an unknown source.

npm provides an option to reduce this risk. The npm install documentation says ignore-scripts prevents npm from running scripts specified in package.json files, although explicitly run scripts still behave differently.

Cryptocurrency Wallet Hijacking Logic (Source – Cyfirma)

Developers can use npm install –ignore-scripts when testing unfamiliar packages, reviewing new dependencies, or investigating potentially suspicious packages. Teams should also verify whether the package needs install scripts at all before allowing them in CI.

  • Review package names carefully for typosquatting.
  • Check publisher history, repository links, and recent version changes.
  • Use npm install –ignore-scripts for high-risk dependency checks.
  • Keep private keys, seed phrases, and API tokens out of plaintext project files.
  • Rotate credentials immediately if a malicious package may have run.

How Teams Can Respond to Possible Exposure

Teams that installed any of the listed packages should remove them, search developer machines and CI runners for execution traces, and rotate all potentially exposed secrets. That includes SSH keys, npm tokens, GitHub tokens, cloud credentials, wallet keys, RPC provider keys, and deployment secrets.

The CYFIRMA report recommends dependency verification, lifecycle script restrictions, secret management, endpoint monitoring, continuous dependency monitoring, and rapid incident response.

Unit 42 also recommends controls such as package-lock usage, npm ci in CI/CD pipelines, private registry proxying, provenance verification, and strict egress filtering for CI runners. The wider npm threat landscape now shows that package installation can expose much more than application code.

ActionPriorityReason
Remove suspicious packagesHighStops further execution from known malicious dependencies
Rotate exposed credentialsHighStolen secrets can enable account, wallet, and cloud compromise
Audit CI/CD logsHighBuild runners often contain deployment secrets and tokens
Review outbound network trafficMediumCan reveal exfiltration to attacker-controlled infrastructure
Restrict install scriptsMediumReduces automatic execution during dependency installation

Indicators Reported by Researchers

TypeIndicatorDescription
Packageethers-jssMalicious Ethereum wrapper targeting wallet secrets
Packagecoinbase-wallet-utilsReconnaissance and environment data theft package
Packagemoralis-sdkTrojanized SDK package with malicious postinstall logic
PackageganachTyposquatting package using blockchain-based infrastructure lookup
PackagesolidtyTyposquatting package targeting blockchain developers
Packagestelar-sdkTyposquatting package with downloader behavior
IP and port193[.]233[.]201[.]21:3001Remote payload distribution server retrieved through blockchain mechanism
Ethereum smart contract0xa1b40044EBc2794f207D45143Bd82a1B86156c6bUsed to retrieve dynamic infrastructure information
Ethereum wallet0xCBbecC5E5Eb88582e6305cF6ab688f03e02Ce16fUsed to receive exfiltrated credential transactions

The campaign shows how quickly an npm package can become a credential theft tool. For Web3 and cloud teams, dependency review is now a secret protection control, not only a code quality task.

Security teams should map detections to MITRE ATT&CK T1195.001 and review whether their existing controls can detect malicious package installation, suspicious postinstall execution, unexpected access to secret files, and outbound connections from build systems.

The npm install configuration can help reduce risk during package testing, but it does not replace dependency verification, secret rotation, network monitoring, and least-privilege access across developer and CI/CD environments.

FAQ

What is the malicious npm campaign targeting developers?

It is a software supply chain campaign involving multiple suspicious npm packages designed to steal developer secrets, including SSH keys, API tokens, cloud credentials, npm tokens, GitHub tokens, private keys, seed phrases, and wallet mnemonics.

Which npm packages were linked to the campaign?

Researchers linked ethers-jss, coinbase-wallet-utils, moralis-sdk, ganach, solidty, stelar-sdk, hardhat-deploy-utils, web3-deploy-helper, defi-sdk-core, ethers-compat, and ethereum-dev-utils to the campaign.

How did the malicious npm packages run their code?

Several packages abused npm lifecycle scripts such as preinstall and postinstall. These scripts can run automatically during package installation, which means malicious code can execute as soon as a developer installs the package.

Why are Web3 developers at risk?

Web3 developers often store wallet keys, seed phrases, RPC provider keys, deployment secrets, and cloud tokens in local files or environment variables. The malicious packages were designed to search for these secrets and exfiltrate them.

How can developers reduce the risk from malicious npm packages?

Developers should verify package names and publishers, inspect recent updates, use npm install –ignore-scripts when testing unfamiliar dependencies, avoid storing secrets in plaintext files, use secret managers, monitor CI/CD runners, and rotate credentials after any suspected exposure.

Readers help support VPNCentral. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help VPNCentral sustain the editorial team Read more

User forum

0 messages