
Scanner: CVE-2026-31802 npm tar path traversal — Python checker for arbitrary file write via npm pack
Detects npm packages vulnerable to CVE-2026-31802, a path traversal vulnerability in the tar npm package that allows arbitrary file writes during archive extraction.
package-lock.json for vulnerable tar versionsnode_modules for installed vulnerable packagestargit clone https://github.com/ridhinva/npm-tar-traversal-scanner.git
cd npm-tar-traversal-scanner
pip3 install -r requirements.txt
python3 npm_tar_scanner.py
python3 npm_tar_scanner.py /path/to/project
python3 npm_tar_scanner.py --lock-file /path/to/package-lock.json
python3 npm_tar_scanner.py --bulk /path/to/projects/
python3 npm_tar_scanner.py --report json --output report.json
python3 npm_tar_scanner.py --report csv --output report.csv
python3 npm_tar_scanner.py --test-exploit /path/to/project
| Package | Vulnerable Range | Fixed In |
|---|---|---|
tar | < 6.2.1 | 6.2.1 |
tar | 7.0.0-alpha.0 - 7.0.0-alpha.5 | 7.0.0-alpha.6 |
package-lock.json to extract dependency treetar package version against known vulnerable rangestar is a direct or transitive dependency../ path entries[!] CVE-2026-31802 - npm tar Path Traversal Scanner
[+] Scanning: /home/user/my-project
[!] VULNERABLE: [email protected] (locked in package-lock.json)
Path: node_modules/tar
Dependency chain: my-project -> node-gyp -> tar
Severity: HIGH - Arbitrary file write during extraction
Fix: Update to [email protected] or later
@c_y_p_h3r
For authorized security testing and educational purposes only.