Remix.run Logo
33a 4 days ago

We also caught this right away at Socket,

https://socket.dev/blog/npm-author-qix-compromised-in-major-...

While it sucks that this happened, the good thing is that the ecosystem mobilized quickly. I think these sorts of incidents really show why package scanning is essential for securing open source package repositories.

4 days ago | parent | next [-]
[deleted]
Yoric 4 days ago | parent | prev | next [-]

So how do you detect these attacks?

33a 4 days ago | parent | next [-]

We use a mix of static analysis and AI. Flagged packages are escalated to a human review team. If we catch a malicious package, we notify our users, block installation and report them to the upstream package registries. Suspected malicious packages that have not yet been reviewed by a human are blocked for our users, but we don't try to get them removed until after they have been triaged by a human.

In this incident, we detected the packages quickly, reported them, and they were taken down shortly after. Given how high profile the attack was we also published an analysis soon after, as did others in the ecosystem.

We try to be transparent with how Socket work. We've published the details of our systems in several papers, and I've also given a few talks on how our malware scanner works at various conferences:

* https://arxiv.org/html/2403.12196v2

* https://www.youtube.com/watch?v=cxJPiMwoIyY

Yoric a day ago | parent | next [-]

So, from what I understand from your paper, you're using ChatGPT with careful prompts?

ATechGuy 3 days ago | parent | prev [-]

You rely on LLMs riddled with hallucinations for malware detection?

jmb99 3 days ago | parent | next [-]

I'm not exactly pro-AI, but even I can see that their system clearly works well in this case. If you tune the model to favour false positives, with a human review step (that's quick), I can image your response time being cut from days to hours (and your customers getting their updates that much faster).

ATechGuy 3 days ago | parent [-]

You are assuming that they build their own models.

Culonavirus 3 days ago | parent | prev | next [-]

He literally said "Flagged packages are escalated to a human review team." in the second sentence. Wtf is the problem here?

ATechGuy 3 days ago | parent [-]

What about packages that are not "flagged"? There could be hallucinations when deciding to (or not) "flag packages".

orbital-decay 3 days ago | parent [-]

>What about packages that are not "flagged"?

You can't catch everything with normal static analysis either. LLM just produces some additional signal in this case, false negatives can be tolerated.

ATechGuy 3 days ago | parent [-]

static analysis DOES NOT hallucinate.

tripzilch a day ago | parent | next [-]

well, you've never had a non-spam email end up in your spam folder? or the other way around?

when static analysis does it, it's called a "misclassification"

Twirrim 3 days ago | parent | prev [-]

So what? They're not replacing standard tooling like static analysis with it. As they mention, it's being used as additional signal alongside static analysis.

There are cases an LLM may be able to catch that their static analysis can't currently catch. Should they just completely ignore those scenarios, thereby doing the worst thing by their customers, just to stay purist?

What is the worst case scenario that you're envisioning from an LLM hallucinating in this use case? To me the worst case is that it might incorrectly flag a package as malicious, which given they do a human review anyway isn't the end of the world. On the flip side, you've got LLM catching cases not yet recognised by static analysis, that can then be accounted for in the future.

If they were just using an LLM, I might share similar concerns, but they're not.

wiseowise 3 days ago | parent | prev | next [-]

> We use a mix of static analysis and AI. Flagged packages are escalated to a human review team.

“Chat, I have reading comprehension problems. How do I fix it?”

atanasi 2 days ago | parent [-]

Reading comprehension problems can often be caught with some static analysis combined with AI.

Mawr 3 days ago | parent | prev [-]

"LLM bad"

Very insightful.

veber-alex 4 days ago | parent | prev [-]

AI based code review with escalation to a human

Yoric 4 days ago | parent [-]

I'm curious :)

Does the AI detect the obfuscation?

33a 4 days ago | parent | next [-]

It's actually pretty easy to detect that something is obfuscated, but it's harder to prove that the obfuscated code is actually harmful. This is why we still have a team of humans review flagged packages before we try to get them taken down, otherwise you would end up with way too many false positives.

Yoric 3 days ago | parent [-]

Yeah, what I meant is that obfuscation is a strong sign that something needs to be flagged for review. Sadly, there's only a thin line between obfuscation and minification, so I was wondering how many false positives you get.

Thanks for the links in your other comment, I'll take a look!

justusthane 4 days ago | parent | prev [-]

Probably. It’s trivial to plug some obfuscated code into an LLM and ask it what it does.

spartanatreyu 4 days ago | parent [-]

Yeah, but just imagine how many false positives and false negatives there would be...

hsbauauvhabzb 4 days ago | parent | prev [-]

[flagged]

josephg 3 days ago | parent | next [-]

Apparently it found this attack more or less immediately.

It seems strange to attack a service like this right after it actively helped keep people safe from malware. I'm sure its not perfect, but it sounds like they deserve to take a victory lap.

hsbauauvhabzb 3 days ago | parent [-]

I don’t think celebrating a company who has a distinct interest in prolonging a problem while they profit off it is a good thing, no.

josephg 3 days ago | parent [-]

They're profiting off helping to solve the problem through early warning and detection. And by keeping their customers safe from stuff like this.

Seems good to me. I want more attention and more tooling around this problem. You seem mad at them for helping solve a real problem?

fn-mote 4 days ago | parent | prev | next [-]

You could at least offer some kind of substantive criticism of the tool (“socket”).

hsbauauvhabzb 4 days ago | parent [-]

Do I need any? Automated tools cannot prevent malicious code being injected. While they can make attempts to evaluate common heuristics and will catch low hanging malware, they are not fool proof against highly targeted attacks.

Either way, the parent post is clearly ambulance chasing rather than having a productive conversation, which should really be about whether or not automatically downloading and executing huge hierarchal trees of code is absolutely fucking crazy, rather than a blatant attempt to make money off an ongoing problem without actually solving anything.

33a 4 days ago | parent | next [-]

When we find malware on any registry (npm, rubygems, pypi or otherwise), we immediately report it to the upstream registry and try to get it taken down. This helps reduce the blast radius from incidents like this and mitigates the damage done to the entire ecosystem.

You can call it ambulance chasing, but I think this is a good thing for the whole software ecosystem if people aren't accidentally bundling cryptostealers in their web apps.

And regarding not copying massive trees of untrusted dependencies: I am actually all for this! It's better to have fewer dependencies, but this is also not how software works today. Given the imperfect world we have, I think it's better to at least try to do something to detect and block malware than just complain about npm.

hsbauauvhabzb 4 days ago | parent [-]

So instead you prolong the problem while making money? Nice!

jondwillis 3 days ago | parent [-]

I’m all for thinking about second, or third, or fourth order effects of behavior, but unless you have proof that Socket is doing something like lobbying that developers keep using NPM against their own best interests, frankly, I don’t know what your point here is.

josephg 3 days ago | parent | prev | next [-]

> Do I need any? Automated tools cannot prevent malicious code being injected. While they can make attempts to evaluate common heuristics and will catch low hanging malware, they are not fool proof against highly targeted attacks.

So just because a lock isn't 100% effective at keeping out criminals we shouldn't lock our doors?

hsbauauvhabzb 3 days ago | parent [-]

Im not sure how that relates to the company ambulance chasing on what should be a public service announcement without a shade of advertising.

That’s like lock companies parading around when their neighbour is murdered during a burglary but they weren’t because they bought a Foobar(tm) lock.

LocalH 3 days ago | parent | prev [-]

The more tools that exist to help find vulnerabilities, the better, as long as they're not used in a fully automated fashion. Human vetting is vital, but using tools to alert humans to such issues is a boon.

hsbauauvhabzb 4 days ago | parent | prev [-]

For those interested, points associated with this post spiked to at least 4 then dropped back to one. Take of that what you will.