CVE-2024-53866
📋 TL;DR
This vulnerability in pnpm package manager allows malicious npm packages to bypass security controls and execute arbitrary code during installation. It affects all users running pnpm versions before 9.15.0, particularly those using workspaces with the ignore-scripts setting, which fails to prevent code execution as expected.
💻 Affected Systems
- pnpm
📦 What is this software?
Pnpm by Pnpm
⚠️ Risk & Real-World Impact
Worst Case
Complete system compromise via arbitrary code execution during package installation, potentially leading to data theft, ransomware deployment, or persistent backdoor installation.
Likely Case
Malicious packages executing scripts during installation to steal credentials, install malware, or modify system configurations.
If Mitigated
Limited impact if using separate cache directories per workspace or isolated environments, though still vulnerable to cache poisoning attacks.
🎯 Exploit Status
Exploitation requires convincing users to install a malicious package, but the attack chain is straightforward once the package is installed.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 9.15.0
Vendor Advisory: https://github.com/pnpm/pnpm/security/advisories/GHSA-vm32-9rqf-rh3r
Restart Required: No
Instructions:
1. Update pnpm globally: npm install -g pnpm@9.15.0
2. Update pnpm in each project: pnpm add -g pnpm@9.15.0
3. Clear global cache: pnpm store prune
4. Regenerate lockfiles in all workspaces
🔧 Temporary Workarounds
Use separate cache directories
allIsolate each workspace by using unique cache and store directories to prevent cross-workspace contamination.
export PNPM_STORE_DIR=/unique/path/for/workspace
export PNPM_CACHE_DIR=/unique/cache/path
🧯 If You Can't Patch
- Implement strict package source controls and only install from trusted internal registries
- Run pnpm in isolated containers or virtual machines with no persistent cache between runs
🔍 How to Verify
Check if Vulnerable:
Check pnpm version: pnpm --version. If version is less than 9.15.0, you are vulnerable.
Check Version:
pnpm --version
Verify Fix Applied:
Confirm pnpm version is 9.15.0 or higher: pnpm --version
📡 Detection & Monitoring
Log Indicators:
- Unexpected script execution during pnpm install
- Cache directory modifications from unexpected sources
- Package installation failures with script execution errors
Network Indicators:
- Downloads from unexpected package repositories
- Unusual network traffic patterns during package installation
SIEM Query:
Process execution where parent process contains 'pnpm' and command contains unexpected script names or suspicious patterns