Does SCA detect malware? (sometimes but, 2024 edition)

Does SCA detect malware? (sometimes but, 2024 edition)

Recently, I was asked recently if Software Composition Analysis (SCA) tools detect malware. I had seen some evidence it does, but I thought I’d try out a recent case looking at @solana/web3.js (thanks Paul McCarty for bringing it to my attention).

TLDR (Too Long Didn’t read):

The methodology used was simple and took about 30 minutes:

I did NOT do an npm install, as this would most likely run the malware, however, this would failed anyway as the package had been removed from npm.

Here are the quick “findings” based on 30 minutes of playing around:

Running snyk on the vulnerable package with:

snyk test @solana/web3.js@1.95.7

Resulted in a not found, rather than this was exploitable

Looking at the vulnerable NPM package on NPM itself https://www.npmjs.com/package/@solana/web3.js/v/1.95.7
resulted in a not found, as it had been removed (a reliable source told me).

A developer may get more vague information on packages affected by Malware. Libraries with vulnerabilities are still findable, those with malware seem to be removed.

In some quick Q&A slack conversations, Malware in libraries appears to be handled differently.

There’s current thinking that everyone should have an organisation-wide open source inventory capability so we can solve use cases at an organisation level like:

Parting thoughts

I’ll need to do a broader analysis of a few more use cases with different package managers.

It does look like there is some SCA coverage of malware, BUT two knowledgeable people I spoke with indicated there are challenges.

Given your code repositories, how easy is it to find all the usages of a vulnerable package?

What’s been your experience with malware in libraries versus vulnerabilities?