CVE-2018-13797

9.8 CRITICAL

📋 TL;DR

CVE-2018-13797 is a critical command injection vulnerability in the Node.js macaddress module that allows attackers to execute arbitrary commands on affected systems. The vulnerability occurs because the module uses exec() instead of execFile() without proper input sanitization. Any application using vulnerable versions of this module is affected.

💻 Affected Systems

Products:
  • node-macaddress
Versions: All versions before 0.2.9
Operating Systems: All operating systems running Node.js
Default Config Vulnerable: ⚠️ Yes
Notes: Only vulnerable if the application passes user-controlled input to macaddress functions.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise with remote code execution, allowing attackers to install malware, exfiltrate data, or pivot to other systems.

🟠

Likely Case

Remote code execution with the privileges of the Node.js process, potentially leading to data theft, service disruption, or lateral movement.

🟢

If Mitigated

Limited impact if proper input validation and sandboxing are implemented, though the vulnerability still exists.

🌐 Internet-Facing: HIGH - Applications exposed to the internet with user-controlled input to macaddress functions are highly vulnerable.
🏢 Internal Only: MEDIUM - Internal applications could be exploited through authenticated users or other attack vectors.

🎯 Exploit Status

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

Exploitation is straightforward if user input reaches vulnerable functions. The vulnerability is well-documented with public proof-of-concept examples.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.2.9 and later

Vendor Advisory: https://github.com/scravy/node-macaddress/releases/tag/0.2.9

Restart Required: Yes

Instructions:

1. Update package.json to require macaddress >=0.2.9. 2. Run 'npm update macaddress' or 'yarn upgrade macaddress'. 3. Restart the Node.js application.

🔧 Temporary Workarounds

Input Validation

all

Implement strict input validation for any parameters passed to macaddress functions

Process Sandboxing

linux

Run Node.js application with minimal privileges and in a containerized environment

docker run --read-only --cap-drop=ALL -u nobody node:alpine

🧯 If You Can't Patch

  • Implement strict input validation and sanitization for all user inputs
  • Run the application with minimal privileges and in a sandboxed environment

🔍 How to Verify

Check if Vulnerable:

Check package.json or run 'npm list macaddress' to see if version is below 0.2.9

Check Version:

npm list macaddress | grep macaddress

Verify Fix Applied:

Verify macaddress version is 0.2.9 or higher with 'npm list macaddress'

📡 Detection & Monitoring

Log Indicators:

  • Unusual command execution patterns
  • Suspicious child process creation from Node.js
  • Error logs showing command injection attempts

Network Indicators:

  • Unexpected outbound connections from Node.js process
  • Command and control traffic patterns

SIEM Query:

process.name:node.exe AND process.parent.name:node.exe AND process.cmdline:*cmd.exe* OR process.cmdline:*powershell*

🔗 References

📤 Share & Export