Skip to Content
mlab docs

Is my dependency vulnerable?

Check a project's dependencies for known vulnerabilities with vuln.mlab.sh and for malicious code with postmortem, read CVSS, EPSS and KEV, and decide what to fix first.

Your project uses open-source packages, and those packages use others. A news story mentions a vulnerable library, or you just want to know where you stand. This tutorial answers two different questions:

QuestionToolHow it works
Does one of my dependencies have a known vulnerability (a published CVE)?vuln.mlab.sh SBOM scanYour lockfile is checked against public vulnerability databases (OSV, NVD).
Does one of my dependencies contain malicious code (a hijacked or fake package)?postmortemRuns offline on your machine and looks for the patterns of supply-chain attacks.

They complement each other: a package can be malicious without any CVE, and a CVE says nothing about hidden malicious code. Do both.

What you'll need

  • Your project's lockfile: the file your package manager writes with the exact version of every dependency. For example package-lock.json, yarn.lock or pnpm-lock.yaml (Node.js), poetry.lock or requirements.txt (Python), Cargo.lock (Rust), composer.lock (PHP), Gemfile.lock (Ruby), go.sum (Go). An SBOM (software bill of materials, a list of every component) in CycloneDX or SPDX format works too.
  • For postmortem: a macOS or Linux machine, and the project's installed dependencies on disk (for example node_modules/).
  • No account is needed for a first scan.

Part 1: known vulnerabilities

Scan the lockfile

Open vuln.mlab.sh/scan and give it your lockfile. It is parsed in your browser, and every dependency is checked.

Without an account, a scan covers up to 512 packages; a free account raises it to 1024, a paid plan to 4096. If your file has more, the scan says it was cut: the packages past the cut were not scanned, which does not mean they are clean.

Prefer the command line? The same scan runs with one request:

curl -s -X POST "https://vuln.mlab.sh/api/v2/scan?filename=package-lock.json" \
  --data-binary @package-lock.json

See SBOM scan (API) for every supported file and option.

Read the three scores

Each vulnerability comes with up to three signals. They answer different questions:

SignalQuestion it answersHow to read it
CVSSHow bad would it be?A severity score from 0 to 10 (low, medium, high, critical). It describes the worst case, not your case.
EPSSHow likely is it to be exploited?A probability from FIRST, a forum of security teams, that attackers will use it soon. Higher means more likely.
KEVIs it already being exploited?The CVE is in a catalogue of vulnerabilities exploited in the wild: CISA KEV (United States) or the EU KEV (ENISA).

To see all three for one CVE, search its ID (for example CVE-2021-44228) on vuln.mlab.sh. The record also has a risk_score: 100 for a known-exploited CVE, otherwise CVSS weighted by EPSS.

Check what was not covered

Some entries cannot be checked: a dependency pulled from git or a local path, a requirement without an exact version. The scan lists them apart. An entry that could not be scanned is not a clean result: look at those by hand.

Part 2: malicious code

Install postmortem

On macOS or Linux, with Homebrew:

brew tap mlab-sh/postmortem https://github.com/mlab-sh/postmortem.git
brew install postmortem

Prebuilt binaries and build instructions are on the postmortem page.

Scan the project

postmortem ./my-project
postmortem ./my-project --html -o report.html

The first line prints the result in the terminal. The second writes a single-file HTML report you can attach to a ticket. postmortem makes no network calls: your code never leaves your machine.

Read the findings

Each finding names the dependency, a severity and a category:

CategoryWhat it found
install_hookCode that runs automatically when the package is installed, a common way to start an attack
obfuscationCode made deliberately hard to read
iocWeb addresses, IP addresses or crypto wallets embedded in the code
sensitive_apiUse of risky functions: running commands, opening network connections

A finding is a lead, not a verdict: many legitimate packages run commands or open connections. What should worry you is a mix, for example an install hook that downloads something from an unknown address.

What to fix first

  1. Malicious code first. A package flagged by postmortem with strong signals should be removed or pinned back to a known-good version, and the machines that installed it checked.
  2. Then anything exploited in the wild (KEV), whatever its CVSS. Attackers are already using it.
  3. Then by severity, then by EPSS. This is the order vuln.mlab.sh itself uses when it ranks findings: known-exploited, then severity, then EPSS.
  4. Fix by upgrading. Move to a version that fixes the vulnerability, run your tests, and scan again to confirm.

If a vulnerability does not apply to how you use the package, write down why, so the next person who sees it does not start over. In SBOM monitoring, mark it not_affected and it will not alert again.

What to do next

  • Keep watching. On Pro, Team and Enterprise, SBOM monitoring rescans your lockfile for you and emails you within minutes when a new vulnerability hits one of your dependencies.
  • Scan on every change. The GitHub Action checks your lockfiles on every push or pull request, and postmortem can fail a build with its exit code or publish results to GitHub Code Scanning (SARIF output).
  • Follow a product, not a file. Watchlists alert you on new CVEs for a vendor or product.

On this page