CVE-2020-15779

7.5 HIGH

📋 TL;DR

This path traversal vulnerability in socket.io-file allows attackers to write files outside the intended upload directory by using directory traversal sequences (../) in file names. It affects Node.js applications using socket.io-file version 2.0.31 and earlier. Attackers can potentially overwrite critical system files or deploy malicious code.

💻 Affected Systems

Products:
  • socket.io-file
Versions: <= 2.0.31
Operating Systems: All platforms running Node.js
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerable in default configuration when using file upload functionality.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise via arbitrary file write leading to remote code execution, data destruction, or privilege escalation.

🟠

Likely Case

Unauthorized file writes to sensitive directories, potentially leading to data manipulation, denial of service, or lateral movement.

🟢

If Mitigated

Limited to file writes within controlled directories with proper input validation and file system permissions.

🌐 Internet-Facing: HIGH - Web applications using this package are directly exposed to exploitation via file upload functionality.
🏢 Internal Only: MEDIUM - Internal applications could still be exploited by authenticated users or through other attack vectors.

🎯 Exploit Status

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

Exploitation requires only the ability to upload files via socket.io-file interface.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2.0.32

Vendor Advisory: https://github.com/advisories/GHSA-9h4g-27m8-qjrg

Restart Required: Yes

Instructions:

1. Update socket.io-file to version 2.0.32 or later using npm update socket.io-file. 2. Restart your Node.js application. 3. Verify the update with npm list socket.io-file.

🔧 Temporary Workarounds

Input validation filter

all

Implement server-side validation to reject file names containing path traversal sequences.

// Example Node.js middleware to filter ../ sequences
app.use((req, res, next) => {
  if (req.body.filename && req.body.filename.includes('..')) {
    return res.status(400).send('Invalid filename');
  }
  next();
});

🧯 If You Can't Patch

  • Implement strict file system permissions limiting write access to specific directories only.
  • Deploy web application firewall (WAF) rules to block requests containing path traversal patterns.

🔍 How to Verify

Check if Vulnerable:

Check package.json or run npm list socket.io-file to see if version <= 2.0.31 is installed.

Check Version:

npm list socket.io-file

Verify Fix Applied:

Confirm socket.io-file version is 2.0.32 or higher using npm list socket.io-file.

📡 Detection & Monitoring

Log Indicators:

  • File upload attempts with filenames containing ../ sequences
  • Unexpected file writes outside designated upload directories

Network Indicators:

  • HTTP POST requests to upload endpoints with suspicious filename parameters
  • Socket.io messages with createFile containing path traversal patterns

SIEM Query:

source="application.log" AND ("../" OR "..\" OR "%2e%2e%2f") AND ("upload" OR "createFile")

🔗 References

📤 Share & Export