pkgscan.dev · Documentation

How to check an npm package for malware before installing it

Most npm malware is not a vulnerability. It is an install script or an obfuscated file that runs with your user's permissions. npm audit will not report it, because audit only matches known advisories. This page explains what pkgscan checks, what the result means, and what it still cannot see.

Updated 2026-11-05

Why npm audit is not a malware check

npm audit compares your dependency tree against the GitHub Advisory Database. A package that steals environment variables and posts them to a new domain usually has no advisory yet, so audit says nothing. The most common delivery mechanisms are:

Scan an npm package with pkgscan

You can submit an npm package three ways. All three return the same per-engine report, and every result is public — no account is needed to read it.

  1. Registry package. Paste pkg:npm/[email protected] in the search bar, or open /pkg/npm/{name}@{version}. pkgscan downloads the exact version from the npm registry and scans the tarball.
  2. Upload a tarball. Drop the .tgz you already have. Useful for private packages, a package you vendored, or a suspicious file from a mirror.
  3. SHA-256 lookup. Open /file/{sha256} to see whether that exact artifact was scanned before, and by which engines.
# Same report the web UI shows, from a script or CI job
curl -s https://www.pkgscan.dev/api/pkg/npm/[email protected] \
  -H "Authorization: Bearer pkg_YOUR_KEY"

# Start a fresh scan of a registry package
curl -s -X POST https://www.pkgscan.dev/api/scan/from-generic-purl \
  -H "Authorization: Bearer pkg_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"purl":"pkg:npm/[email protected]"}'

Which engines run on an npm package

EngineWhat it contributesInput it needs
ArgusYeeth Security's content-analysis malware engine. Reads the code, not the package metadata.Package bytes
GuardDogDataDog's static rule set for install hooks, obfuscation, credential access, and exfiltration patterns.Package bytes + npm identity

How to read the verdict

pkgscan separates two questions that other scanners merge into one red badge: is this package malicious? and does this package have known security issues? Only Argus and SkillSpector are treated as malware engines. OSV, Grype, and deps.dev report vulnerabilities. GuardDog runs as a heuristic engine: its hits appear as security issues, not as a malware verdict.

Inspect a package yourself in one minute

# Download without installing or running scripts
npm pack [email protected] --ignore-scripts

# Read the lifecycle scripts without extracting the whole package
tar -xzOf lodash-4.17.21.tgz package/package.json | python3 -m json.tool

# Look at what a suspicious install script would touch
tar -xzOf lodash-4.17.21.tgz package/package.json \
  | grep -E '"(pre|post)?install"|\"main\"'

If the package has a postinstall, extract it and read the file it calls. Network calls to a bare IP, curl | sh, and base64-decoded code are the signals that matter most.

What pkgscan does not cover for npm

Related: how pkgscan detects malicious packages, the detection provider comparison.

Check a package or file now: scan it on pkgscan.dev.