npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

check-compromised-npm-packages

v1.4.0

Published

Scan your project for compromised npm packages

Downloads

433

Readme

Check Compromised

A simple Node.js tool to scan your project for compromised npm packages.

What it does

Scans your node_modules and package-lock.json for installed package versions and compares them against a known list of compromised versions. Exits with error code 1 if any compromised packages are found.

Why this tool complements npm audit

npm audit is great for finding known vulnerabilities, but it has some limitations with supply chain attacks like the one this tool was created for. This incident involved malicious versions that had no CVE at the time, so audit would report "0 vulnerabilities" while potentially running malicious code.

Where npm audit falls short

  • Scope: Focuses on CVEs and known vulnerabilities, not live malicious versions
  • Timing: There's often a delay before advisories are published, giving malicious packages time to spread
  • Granularity: Uses range-based detection rather than exact version matching
  • Coverage: Doesn't catch supply chain techniques like malicious postinstall scripts or token theft

Where npm audit still helps

  • Finding CVE-style vulnerabilities after they're disclosed
  • Setting policy gates in CI for known severities
  • Verifying you're not regressing to vulnerable version ranges

Usage

Via npx (recommended)

# Check for compromised packages
npx check-compromised-npm-packages

# Output results as JSON
npx check-compromised-npm-packages --json

# Show the list of known compromised packages
npx check-compromised-npm-packages --list

Local usage

# Check for compromised packages
node check-compromised.js

# Output results as JSON
node check-compromised.js --json

# Show the list of known compromised packages
node check-compromised.js --list

Setup

Place a compromised.json file in your project root with the format, or re-use mine :)

{
  "packages": [
    { "name": "@ctrl/tinycolor", "badVersions": ["4.1.1", "4.1.2"] },
    { "name": "angulartics2", "badVersions": ["14.1.2"] }
  ]
}

Current list of compromised packages: compromised.json

Sources:

Understanding the threat: Install script vulnerabilities

As documented in the npm blog, malicious packages can execute scripts during installation that can:

  • Self-replicate: Include themselves in new packages and publish them to the registry
  • Steal credentials: Access environment variables, tokens, and other sensitive data
  • Spread laterally: Compromise other packages owned by the same user
  • Execute arbitrary code: Run any malicious code during the install process

This is why --ignore-scripts is crucial - it prevents these attack vectors from executing during installation.

Origin

This tool was created in response to the @ctrl/tinycolor and 40+ NPM packages compromised supply chain attack.

The compromised.json file will be updated as more compromised packages are discovered to enhance detection capabilities.