CVE-2022-0841

9.8 CRITICAL

📋 TL;DR

This CVE describes an OS command injection vulnerability in the npm-lockfile package versions 2.0.3 and 2.0.4. Attackers can execute arbitrary commands on systems using these vulnerable versions by injecting malicious input. This affects any application or system that uses these specific versions of the npm-lockfile package.

💻 Affected Systems

Products:
  • npm-lockfile
Versions: 2.0.3 and 2.0.4
Operating Systems: All operating systems where npm-lockfile runs
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects npm-lockfile versions 2.0.3 and 2.0.4 specifically. Earlier and later versions are not vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise allowing attackers to execute arbitrary commands with the privileges of the application using npm-lockfile, potentially leading to data theft, ransomware deployment, or complete system takeover.

🟠

Likely Case

Remote code execution allowing attackers to run commands on affected systems, potentially leading to data exfiltration, lateral movement, or installation of backdoors.

🟢

If Mitigated

No impact if patched versions are used or if input validation prevents command injection.

🌐 Internet-Facing: HIGH - If vulnerable package is used in internet-facing applications, attackers can exploit remotely without authentication.
🏢 Internal Only: MEDIUM - Internal systems using vulnerable versions could be exploited by authenticated users or through other attack vectors.

🎯 Exploit Status

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

The vulnerability is publicly documented with proof-of-concept available, making exploitation straightforward for attackers.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2.0.5 and later

Vendor Advisory: https://github.com/ljharb/npm-lockfile/commit/bfdb84813260f0edbf759f2fde1e8c816c1478b8

Restart Required: No

Instructions:

1. Check current npm-lockfile version: npm list npm-lockfile
2. If version is 2.0.3 or 2.0.4, update: npm update npm-lockfile
3. Verify update: npm list npm-lockfile should show version 2.0.5 or higher

🔧 Temporary Workarounds

Input Validation

all

Implement strict input validation and sanitization for any user input passed to npm-lockfile functions

Package Lock

all

Pin npm-lockfile to version 2.0.5 or higher in package.json

npm install npm-lockfile@^2.0.5

🧯 If You Can't Patch

  • Implement strict input validation and sanitization for all user inputs
  • Run npm-lockfile in a sandboxed environment with minimal privileges

🔍 How to Verify

Check if Vulnerable:

Run: npm list npm-lockfile | grep npm-lockfile and check if version is 2.0.3 or 2.0.4

Check Version:

npm list npm-lockfile | grep npm-lockfile

Verify Fix Applied:

After updating, run: npm list npm-lockfile | grep npm-lockfile and confirm version is 2.0.5 or higher

📡 Detection & Monitoring

Log Indicators:

  • Unusual command execution patterns
  • Suspicious process creation from npm-lockfile context
  • Error logs showing command injection attempts

Network Indicators:

  • Unexpected outbound connections from systems using npm-lockfile
  • Command and control traffic patterns

SIEM Query:

process.name:npm-lockfile AND (process.cmdline:*;* OR process.cmdline:*|* OR process.cmdline:*`*)

🔗 References

📤 Share & Export