CVE-2020-7646

9.8 CRITICAL

📋 TL;DR

CVE-2020-7646 is a path traversal vulnerability in curlrequest npm package versions through 1.0.1 that allows attackers to read arbitrary files on the server by controlling the 'file' parameter. This affects any application using vulnerable versions of curlrequest to handle user-supplied file paths. The vulnerability enables unauthorized file access without authentication.

💻 Affected Systems

Products:
  • curlrequest npm package
Versions: All versions through 1.0.1
Operating Systems: All operating systems running Node.js
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability exists when the application uses curlrequest with user-controlled input for the file parameter. Applications not using this feature may not be vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete server compromise through reading sensitive files like /etc/passwd, SSH keys, configuration files, or database credentials, potentially leading to privilege escalation and lateral movement.

🟠

Likely Case

Unauthorized access to sensitive application files, configuration data, or user information stored on the filesystem, potentially enabling further attacks.

🟢

If Mitigated

Limited impact if proper input validation and file path sanitization are implemented, restricting file access to intended directories only.

🌐 Internet-Facing: HIGH - Any internet-facing application using curlrequest with user-controlled file parameters is directly exploitable without authentication.
🏢 Internal Only: MEDIUM - Internal applications could still be exploited by authenticated users or through other attack vectors, but attack surface is reduced.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation is straightforward - attackers simply need to provide a malicious file path like '../../etc/passwd' to the vulnerable parameter. No special tools or complex techniques required.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.0.2

Vendor Advisory: https://github.com/node-js-libs/curlrequest/security/advisories

Restart Required: Yes

Instructions:

1. Update package.json to specify curlrequest version 1.0.2 or higher. 2. Run 'npm update curlrequest' or 'npm install curlrequest@1.0.2'. 3. Restart the Node.js application. 4. Test that file parameter functionality still works correctly.

🔧 Temporary Workarounds

Input Validation and Sanitization

all

Implement strict input validation to only allow expected file paths and prevent directory traversal sequences

// Example Node.js validation code:
const path = require('path');
const allowedBase = '/var/www/uploads/';
const userInput = req.body.file;
const resolvedPath = path.resolve(allowedBase, userInput);
if (!resolvedPath.startsWith(allowedBase)) {
    throw new Error('Invalid file path');
}

Replace curlrequest with Alternative

all

Replace curlrequest with a maintained alternative like node-fetch or axios that doesn't have this vulnerability

npm uninstall curlrequest
npm install node-fetch

🧯 If You Can't Patch

  • Implement strict input validation and sanitization for all user-controlled file parameters
  • Use application-level file access controls and run the application with minimal file system permissions

🔍 How to Verify

Check if Vulnerable:

Check package.json or run 'npm list curlrequest' to see if version is 1.0.1 or lower. Review code for usage of curlrequest with user-controlled file parameters.

Check Version:

npm list curlrequest | grep curlrequest

Verify Fix Applied:

After updating, run 'npm list curlrequest' to confirm version 1.0.2 or higher. Test that file access functionality works but path traversal attempts are blocked.

📡 Detection & Monitoring

Log Indicators:

  • Unusual file access patterns, multiple failed file access attempts, access to system files from application logs

Network Indicators:

  • HTTP requests containing path traversal sequences like '../' or '..\' in file parameters

SIEM Query:

source="application.logs" AND ("..\" OR "../" OR "/etc/" OR "/root/") AND "file="

🔗 References

📤 Share & Export