CVE-2018-16460
📋 TL;DR
This vulnerability allows remote command injection in the ps package for Node.js when an attacker controls the PID parameter. It enables arbitrary command execution on the host system. Any Node.js application using vulnerable ps package versions is affected.
💻 Affected Systems
- ps package for Node.js
📦 What is this software?
Ps by Umbraengineering
⚠️ Risk & Real-World Impact
Worst Case
Full system compromise with root-level arbitrary command execution leading to data theft, ransomware deployment, or complete system takeover.
Likely Case
Remote code execution allowing attacker to run commands with the same privileges as the Node.js process, potentially leading to lateral movement within the network.
If Mitigated
Limited impact if running with minimal privileges and proper input validation, though still dangerous due to command execution capability.
🎯 Exploit Status
Exploitation is straightforward - attacker simply needs to inject shell commands into the PID parameter. Multiple public PoCs exist.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 1.0.0 and later
Vendor Advisory: https://www.npmjs.com/advisories/750
Restart Required: Yes
Instructions:
1. Update package.json to require ps version >=1.0.0. 2. Run 'npm update ps' or 'yarn upgrade ps'. 3. Restart the Node.js application.
🔧 Temporary Workarounds
Input Validation and Sanitization
allImplement strict input validation on PID parameters to only accept numeric values
// JavaScript example: if (!/^\d+$/.test(pid)) throw new Error('Invalid PID')
Package Removal
allRemove the ps package if not essential and use alternative process management methods
npm uninstall ps
yarn remove ps
🧯 If You Can't Patch
- Run Node.js application with minimal privileges (non-root user)
- Implement network segmentation to limit blast radius if exploited
🔍 How to Verify
Check if Vulnerable:
Check package.json or run 'npm list ps' to see installed version
Check Version:
npm list ps | grep ps
Verify Fix Applied:
Verify ps version is >=1.0.0 using 'npm list ps' or check package.json
📡 Detection & Monitoring
Log Indicators:
- Unusual process spawns from Node.js application
- Suspicious command execution patterns in system logs
Network Indicators:
- Unexpected outbound connections from Node.js process
- Command and control traffic patterns
SIEM Query:
process.name:node AND process.args:*ps* AND process.args:*;* OR process.args:*&* OR process.args:*|*