CVE-2020-28426

7.3 HIGH

📋 TL;DR

CVE-2020-28426 is a command injection vulnerability in the kill-process-on-port npm package that allows attackers to execute arbitrary commands on the host system. The vulnerability exists in the a.getProcessPortId function, which improperly sanitizes user input before passing it to system commands. Any application using this package is affected.

💻 Affected Systems

Products:
  • kill-process-on-port npm package
Versions: All versions
Operating Systems: All operating systems where Node.js runs
Default Config Vulnerable: ⚠️ Yes
Notes: The vulnerability is present in all versions of the package and requires the vulnerable function to be called with user-controlled input.

📦 What is this software?

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise allowing remote code execution, data theft, lateral movement, and complete control of the affected server.

🟠

Likely Case

Local privilege escalation or execution of arbitrary commands within the application's context, potentially leading to data exposure or service disruption.

🟢

If Mitigated

Limited impact due to proper input validation, sandboxing, or network segmentation preventing command execution.

🌐 Internet-Facing: MEDIUM - Requires the vulnerable function to be exposed to user input via web interface or API.
🏢 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: ✅ No
Complexity: LOW

Exploitation requires the attacker to control input to the vulnerable function, which typically requires some level of access or the function to be exposed via API.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: N/A

Vendor Advisory: https://snyk.io/vuln/SNYK-JS-KILLPROCESSONPORT-1055458

Restart Required: No

Instructions:

1. Remove kill-process-on-port package from your project. 2. Use alternative methods for port management. 3. Update package.json to remove the dependency. 4. Run npm uninstall kill-process-on-port.

🔧 Temporary Workarounds

Input Validation Wrapper

all

Create a wrapper function that validates and sanitizes all input before passing to kill-process-on-port functions

// Example: const safeGetProcessPortId = (input) => { if (!/^\d+$/.test(input)) throw new Error('Invalid input'); return originalFunction(input); }

Alternative Port Killing

all

Replace kill-process-on-port with native OS commands or other secure libraries

// Linux: kill -9 $(lsof -t -i:PORT)
// Windows: netstat -ano | findstr :PORT && taskkill /PID PID /F

🧯 If You Can't Patch

  • Implement strict input validation and sanitization for all user inputs passed to the vulnerable function
  • Run the application with minimal privileges and in a sandboxed/containerized environment

🔍 How to Verify

Check if Vulnerable:

Check package.json or node_modules for kill-process-on-port dependency: grep -r 'kill-process-on-port' package.json

Check Version:

npm list kill-process-on-port

Verify Fix Applied:

Verify the package is removed: npm list kill-process-on-port should return 'empty'

📡 Detection & Monitoring

Log Indicators:

  • Unusual process spawns from Node.js application
  • Suspicious command execution patterns
  • Failed port killing attempts with malformed input

Network Indicators:

  • Unexpected outbound connections from the application server
  • Command and control traffic patterns

SIEM Query:

process.name:node AND (process.args:*kill* OR process.args:*lsof* OR process.args:*netstat*) AND NOT process.args:expected_pattern

🔗 References

📤 Share & Export