28 Comments
User's avatar
Islam Shehata's avatar

Do we know how much did they gain from this?

JD's avatar

I checked some of the BTC, ETH and LTC addresses, but I didn't find any transactions. I haven't checked them all, though.

TechnicallyWeb3's avatar

How far back does this obfuscated code go? I'm seeing in the overrides you recommend the chalk package 5.3.0 from 2 years ago and not 9 months ago, 1 month or 22 days ago. Does this mean the malicious code is in those versions too?

JD's avatar

The malicious code isn't in all the versions published after 5.3.0. The attacker published a new malicious patch version (e.g., 5.3.1) on top of the existing, safe ones.

The recommendation to override with 5.3.0 is a safety measure. It pins your project to the last known-safe version before the incident, preventing your package manager from automatically pulling in the brand-new compromised code.

CR's avatar

do you have evidence of that anywhere?

CR's avatar

do you have evidence of that anywhere?

Simon's avatar

I'm not so sure the solution of pinning versions works.. many of my peer deps use chalk 4 or lower and I get dependency errors when trying to use 5.3.0

Oktokolo's avatar

You can override a version for 4.* and another one for 5.* like that:

"chalk@^4": "4.1.2",

"chalk@^5": "5.3.0",

⚯ Michel de Cryptadamus ⚯'s avatar

do we know if they uploaded a 4.x malicious version of chalk or did they just go with 5.x?

Cammer's avatar

Hi. You mentioned is-core-module, but the author of is-core-module is Jordan Harband (https://github.com/ljharb), not Qix. I went through the code and didn't find anything that indicated any sort of compromise, and both Snyk and Socket haven't identified any vulnerable versions. Additionally, the last version, 2.16.1, was published 9 months ago. Are you sure that package is in fact vulnerable?

Martin Gross's avatar

Since I didn't want to check everything by hand I created a python tool to check for compromised packages:

https://github.com/MartinGross/compromised_npm_package_checker

ggwp10's avatar

Why do they use this kind of variables "_0x2c3d7e", is it for just meaningless obfuscation variables or more than that?

Renato's avatar

So, to actually be affected (to become a victim), there are a few specific conditions that must be met. As I understand it, the malicious code would only trigger if you start a crypto transaction within a website that is running those compromised package versions, correct?

It sounds alarming at first, but given how quickly the issue was discovered and mitigated (congrats on that, by the way), there may not even be many, if any, production systems out there that were truly exposed.

Is my understanding right, or are there other possible scenarios where the attack could have had an impact?

JD's avatar

Your understanding is correct. The scope is limited.

The malware could passively swap a crypto address displayed on any infected website right before you copy it, causing you to unknowingly send funds to the attacker. Furthermore, the threat doesn't vanish just because the malicious package was removed from the NPM registry. The compromised version can get "locked in" to a project's package-lock.json file or persist in cached builds, leaving a project vulnerable long after the initial incident. Therefore, while the window for new infections from the source was small, many systems could still be exposed without a proper dependency audit and cleanup.

Jangle's avatar

Is the "npm audit" command updated to catch the malicious versions of the packages?

Islam Shehata's avatar

npm audit is pretty much useless

epik's avatar

well, Edit Distance algos are rather in the Easy bucket of basic CS interviews, nothing sophisticated there imo

Jordan Harband's avatar

`is-core-module` has never been maintained by anyone but me, and was not involved in this attack, or compromised in any way whatsoever. Please update your article.

JD's avatar

Fixed - sorry.

nu11soft's avatar

This is harsh and bound to happen more and more.

I think that's part of what Deno solves and one of the reason new apple systems give you a new pop up to authorize things every other minute.

It's the sad future we are moving towards.

[Accept Cookies]

Mosh's avatar

But these packages aren’t typically intended for use in the browser, so I’m not sure how the attack would even target it.

Ahmad Abdullahi Adamu's avatar

This happens only if the platform/wallet you are using are constantly updating their packages, right?

JD's avatar

Version 1.3.3 was just removed so the old (non-malware-)Version 1.3.2 is the latest one.

Emerson Broga's avatar

Nice!!! Glad to hear that it has been removed.

Mikaël's avatar

its sole dependency has been contamined too...