Skip to content

About

A critical Path Traversal vulnerability exists in the @npmcli/bin-links library due to insufficient sanitization of the bin field in package.json. By crafting a malicious package with traversal sequences (e.g., ../../), an attacker can escape the intended node_modules/.bin directory during installation.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚨 Unpatched Critical RCE: Path Traversal in @npmcli/bin-links

🛡️ Discoverer: Nguyen Vo Anh Khoa (khoadevvn)

🇻🇳 Origin: Vietnam

🌐 Community: Nexus VN

⚠️ Status: UNPATCHED (0-Day)

📅 Reported to GitHub: Dec 20, 2025 (HackerOne #3473583)


📝 Summary

A critical Path Traversal vulnerability exists in the @npmcli/bin-links library (a core component used by the npm CLI v11.6.0 and earlier).

The vulnerability resides in the lib/get-paths.js and lib/index.js files due to insufficient sanitization of the bin field in package.json. By crafting a malicious package with traversal sequences (e.g., ../../), an attacker can escape the intended node_modules/.bin directory during installation.


🔍 Technical Analysis

The library uses path.resolve() on untrusted input from package.json without verifying if the resulting path remains within the expected boundaries.

Vulnerable Code Snippet:

Located in lib/get-paths.js:

for (const bin of Object.keys(pkg.bin)) {
  const b = resolve(binTarg, bin); // <--- VULNERABILITY: Path Traversal
  binSet.push(b);
  if (isWindows) {
    binSet.push(b + '.cmd');
    binSet.push(b + '.ps1');
  }
}

Mã nguồn này chỉ phục vụ mục đích nghiên cứu và giáo dục. Tôi không chịu trách nhiệm cho bất kỳ hành vi lạm dụng nào

About

A critical Path Traversal vulnerability exists in the @npmcli/bin-links library due to insufficient sanitization of the bin field in package.json. By crafting a malicious package with traversal sequences (e.g., ../../), an attacker can escape the intended node_modules/.bin directory during installation.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages