• Cyber Syrup
  • Posts
  • New Malware Campaign Leverages The Ethereum Blockchain And Smart Contracts

New Malware Campaign Leverages The Ethereum Blockchain And Smart Contracts

Attackers use Ethereum blockchain technology in a unique way to enhance their command-and-control (C2) infrastructure

In partnership with

CYBER SYRUP
Delivering the sweetest insights on cybersecurity.

Need a personal assistant? We do too, that’s why we use AI.

Ready to embrace a new era of task delegation?

HubSpot’s highly anticipated AI Task Delegation Playbook is your key to supercharging your productivity and saving precious time.

Learn how to integrate AI into your own processes, allowing you to optimize your time and resources, while maximizing your output with ease.

New Malware Campaign Leverages The Ethereum Blockchain And Smart Contracts

A recent campaign has been targeting npm (Node Package Manager) developers by releasing hundreds of fake, or "typosquat," versions of legitimate npm packages. This campaign attempts to trick developers into installing malicious code that eventually delivers cross-platform malware. Interestingly, the attackers use Ethereum blockchain technology in a unique way to enhance their command-and-control (C2) infrastructure, making it harder to detect and block their activities.

In this article, we’ll break down the details of this attack, explain how Ethereum smart contracts fit into it, and discuss why this innovative use of blockchain poses a new kind of threat to the software development community.

What Are Typosquat Attacks?

In a "typosquatting" attack, attackers create fake versions of popular software packages or libraries, with names that closely resemble legitimate packages. The goal is to trick developers into installing these malicious packages by exploiting minor typographical errors, such as a missing or additional letter. In this case, the attackers targeted popular npm libraries like Puppeteer, Bignum.js, and various cryptocurrency libraries.

When developers accidentally install these typosquat packages, malicious code within the packages is executed, infecting their system with malware. According to research from security firms Checkmarx, Phylum, and Socket, this campaign involved at least 287 typosquat packages, and was initially flagged on October 31, 2024.

How the Attack Works

  1. Malicious Packages: The typosquat packages contain obfuscated JavaScript code that executes during or after the installation process, typically when the developer uses npm to download dependencies.

  2. Next-Stage Binary Delivery: Once the JavaScript is executed, it downloads a second-stage binary file from a remote server. The downloaded binary is tailored to the specific operating system (Windows, macOS, or Linux) on which the developer’s machine is running.

  3. Persistence and Data Theft: After installation, the malware establishes persistence on the infected device, allowing it to survive reboots and continue operating undetected. The malware then gathers sensitive information about the compromised machine and transmits this data to a remote server controlled by the attackers.

  4. Blockchain as Command-and-Control: In a twist, the malware’s JavaScript code uses the Ethereum blockchain to communicate with the attackers. By interacting with an Ethereum smart contract using the ethers.js library, the malware retrieves IP addresses for further C2 instructions. This technique makes it challenging to block the malware because the IP addresses can be dynamically updated on the blockchain.

What Is Blockchain and How Is It Being Used?

Understanding Blockchain and Smart Contracts

Blockchain is a decentralized digital ledger that records transactions across multiple computers in a way that makes the records difficult to alter. Ethereum is one of the most widely used blockchain platforms and supports "smart contracts"—self-executing programs that run on the blockchain and can perform tasks autonomously.

In this case, the attackers use Ethereum smart contracts as a tool for distributing C2 server addresses. This approach is unusual because the decentralized and immutable nature of blockchain makes it difficult for cybersecurity teams to take down or block the C2 infrastructure.

Why Using Blockchain for C2 Is Effective

Traditional malware often relies on centralized servers that can be identified and taken down by cybersecurity defenders. By using a decentralized blockchain, attackers benefit in two major ways:

  1. Resilience: Since the blockchain is decentralized and immutable, it’s nearly impossible to take down the C2 infrastructure, as it doesn’t rely on a single point of control.

  2. Dynamic Updates: The attackers can continuously update the IP addresses stored in the smart contract, allowing the malware to find new C2 servers even if previous IP addresses are blocked or taken offline.

Who Is Affected?

This attack mainly affects npm developers who are likely to install these typosquat packages by accident. The specific libraries targeted, such as Puppeteer and cryptocurrency libraries, indicate that the attackers are focusing on developers working with web automation, cryptocurrency, and financial applications.

Given that these tools are widely used, this attack could impact not only individual developers but also companies and organizations that rely on these libraries for their projects. Additionally, the attack leverages cross-platform malware, meaning it can infect systems running different operating systems, such as Windows, macOS, and Linux.

How to Protect Yourself

To avoid falling victim to this kind of attack, developers can take several precautionary steps:

  1. Verify Package Names Carefully: Always double-check package names before downloading, as typosquatting relies on minor differences that are easy to overlook. Make it a habit to copy and paste package names directly from official sources.

  2. Use Trusted Sources and Repositories: Consider using verified and well-maintained libraries from trusted sources. Official repositories often provide security badges or indications of trusted packages.

  3. Enable Security Tools and Monitoring: Use tools like npm audit, Snyk, or Dependabot to scan for vulnerabilities in your dependencies. These tools can alert you if a package has known issues or has been flagged as malicious.

  4. Limit Permissions: Run your development environment with the minimum required permissions. If malware does execute, limited permissions can reduce its impact.

  5. Stay Updated: Monitor updates from security organizations and npm itself for information about newly identified threats. Awareness is a critical part of defense against supply chain attacks.

The Growing Threat of Supply Chain Attacks

This attack highlights the increasing complexity of supply chain attacks, where attackers target dependencies that developers and organizations use to build their software. By inserting malicious code into seemingly legitimate packages, attackers can infiltrate software projects indirectly, potentially affecting end-users and clients. The use of blockchain as a resilient C2 infrastructure adds another layer of sophistication, showing how attackers are continually evolving to evade traditional defenses.

Conclusion

The campaign targeting npm developers with typosquat packages and leveraging blockchain technology for C2 infrastructure is a stark reminder of the importance of vigilance in the development process. As attackers adopt more innovative methods, including blockchain-based tactics, developers must remain aware of these emerging threats and take proactive steps to secure their software supply chains.

By verifying packages, using security tools, and staying informed, developers can reduce their risk of falling victim to such advanced and hard-to-detect attacks. As the cybersecurity landscape evolves, understanding these new tactics becomes essential for safeguarding personal and organizational assets.