Security Experts:

Connect with us

Hi, what are you looking for?

SecurityWeekSecurityWeek

Cybercrime

Cryptocurrency-Stealing Code Distributed via Popular Library

The popular EventStream Node.js library was recently modified to fetch malicious code designed to steal crypto-currencies.

Designed as a toolkit to make creating and working with streams easy, the JavaScript package has around two million downloads a week, which makes it a valuable resource to application developers and malicious actors alike.

The popular EventStream Node.js library was recently modified to fetch malicious code designed to steal crypto-currencies.

Designed as a toolkit to make creating and working with streams easy, the JavaScript package has around two million downloads a week, which makes it a valuable resource to application developers and malicious actors alike.

The code library was designed by a Dominic Tarr, who says he hasn’t been using it for years. However, he apparently agreed to transfer the module to another user in September 2018, who modified the library’s dependencies, which eventually resulted in malicious code being delivered to users.

On September 9, the repository’s new maintainer, right9ctrl, added the flatmap-stream library as a dependency of event-stream, but then removed it on September 16, when they also pushed a new version of event-stream, Chris Northwood explains on Medium.

On October 5, NPM user hugeglass pushed flatmap-stream 0.1.1, which had an obfuscated snippet of nefarious code appended to it. The encrypted payload is decrypted if a specific value of description in package.json is present, and was found last week to target a crypto-currency wallet to steal keys.

Specifically, the malicious code in flatmap-stream 0.1.1 was designed to steal coins from Dash Copay Bitcoin, an open-source, multiplatform, multi-signature, secure Bitcoin wallet. The malicious code would only become active when the wallet app is used.

“Currently we have only confirmed that the malicious code was deployed on versions 5.0.2 through 5.1.0 of our Copay and BitPay apps. However, the BitPay app was not vulnerable to the malicious code. We are still investigating whether this code vulnerability was ever exploited against Copay users,” the BitPay Team says in a blog post.

The root cause of the issue is that the original maintainer of event-stream handed over the repository/package to another individual, likely without performing rigorous checks, which eventually resulted in malicious code being added to the library.

“The main takeaway with this attack is that in the world of modern software, it’s turtles all the way down… Just because the code you write is secure, doesn’t mean that the code other developers write for you is. The only way to get ahead of this is to practice deep and continuous abuse-case (i.e., security) testing,” Casey Ellis, CTO at Bugcrowd, told SecurityWeek.

This is not the first time popular repositories, especially those that are no longer maintained, end up being abused for malicious purposes. Such was the case with ESLint earlier this year, as well as with numerous WordPress plugins last year.

Related: Backdoored Module Removed from npm Registry

Related: Hackers Exploit Flaw in GDPR Compliance Plugin for WordPress

Written By

Ionut Arghire is an international correspondent for SecurityWeek.

Click to comment

Daily Briefing Newsletter

Subscribe to the SecurityWeek Email Briefing to stay informed on the latest threats, trends, and technology, along with insightful columns from industry experts.

Expert Insights

Related Content

Cybercrime

Zendesk is informing customers about a data breach that started with an SMS phishing campaign targeting the company’s employees.

Cybercrime

The release of OpenAI’s ChatGPT in late 2022 has demonstrated the potential of AI for both good and bad.

Cybercrime

The FBI dismantled the network of the prolific Hive ransomware gang and seized infrastructure in Los Angeles that was used for the operation.

Malware & Threats

Microsoft plans to improve the protection of Office users by blocking XLL add-ins from the internet.

Cybercrime

A new study by McAfee and the Center for Strategic and International Studies (CSIS) named a staggering figure as the true annual cost of...

Cybercrime

CISA, NSA, and MS-ISAC issued an alert on the malicious use of RMM software to steal money from bank accounts.

Cybercrime

A recently disclosed vBulletin vulnerability, which had a zero-day status for roughly two days last week, was exploited in a hacker attack targeting the...

Application Security

PayPal is alerting roughly 35,000 individuals that their accounts have been targeted in a credential stuffing campaign.