Novel Supply Chain Attack: npm Malicious Packages Using Ethereum Smart Contracts for Stealthy C2 Communication

·

Introduction

Between October 31 and November 3, 2024, the Tianwen Software Supply Chain Analysis Platform detected a sophisticated attack targeting the npm ecosystem. This attack leveraged Ethereum smart contracts to conceal malicious command-and-control (C2) infrastructure while deploying multi-stage payloads to compromise victim systems.

Developed by Qi An Xin Technology's Star Atlas Lab, the Tianwen platform provides continuous monitoring of Python, npm, and other major development ecosystems, identifying numerous malicious packages and attack patterns.


Attack Timeline Analysis

Initial Testing Phase (October 2024)

Mass Deployment Phase (Late October - Early November 2024)

Attackers launched 34 additional malicious packages with these characteristics:


Technical Breakdown

Obfuscated Payload Delivery

All packages contained identical obfuscated code that:

  1. Fetched dynamic C2 addresses from Ethereum smart contracts
  2. Downloaded platform-specific payloads:

    • Windows: node-win.exe
    • Linux: node-linux
    • macOS: node-macos
// Simplified payload download logic
const getDownloadUrl = (c2Address) => {
  switch(os.platform()) {
    case 'win32': return `${c2Address}/node-win.exe`;
    case 'linux': return `${c2Address}/node-linux`;
    case 'darwin': return `${c2Address}/node-macos`;
  }
}

Ethereum Smart Contract C2 Mechanism

Attackers used contract address 0xa1b40044EBc2794f207D45143Bd82a1B86156c6b with:

// Contract interaction example
const contract = new ethers.Contract(
  '0xa1b40044EBc2794f207D45143Bd82a1B86156c6b', 
  ['function getString(address) public view returns (string)'],
  provider
);

C2 Address Rotation History

DateAddressPurpose
Sep-23http://localhost:3001Initial testing
Sep-24http://45.125.67.172:1228First live test
Oct-21http://45.125.67.172:1337Active during haski deployment
Oct-26http://194.53.54.188:3001Currently active endpoint

👉 See real-time blockchain transactions


Attack Attribution

Indicators of Russian Origin


Key Security Implications

  1. Blockchain-Abusing Tactics: First documented case using smart contracts for dynamic C2 in supply chain attacks
  2. Evasion Advantages:

    • No gas costs for read operations
    • Fully decentralized infrastructure
    • Real-time address updates
  3. Detection Challenges:

    • Traditional IP/DNS blocking becomes ineffective
    • Requires blockchain transaction monitoring

👉 Learn about advanced threat detection


FAQs

Q: How can developers protect against such attacks?

A: Implement these protective measures:

Q: Why is this attack method significant?

A: It represents an evolutionary leap in malware C2 techniques by:

Q: What should organizations do if they've installed these packages?

A: Immediate actions include:

  1. Isolate affected systems
  2. Rotate all credentials
  3. Conduct memory analysis for payload artifacts
  4. Review blockchain interactions from compromised hosts

Conclusion

This attack demonstrates the increasing sophistication of software supply chain threats, combining:

The Tianwen Software Supply Chain Security Platform continues to monitor such advanced threats across open-source ecosystems.


IOCs (Indicators of Compromise)

Smart Contracts

Network Indicators

File Hashes

👉 Full IOC database available here