CVE-2021-25916
📋 TL;DR
CVE-2021-25916 is a prototype pollution vulnerability in the patchmerge npm package versions 1.0.0 through 1.0.1. This allows attackers to modify object prototypes, potentially leading to denial of service or remote code execution. Anyone using vulnerable versions of patchmerge in their Node.js applications is affected.
💻 Affected Systems
- patchmerge
📦 What is this software?
Patchmerge by Patchmerge Project
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution leading to complete system compromise, data theft, or ransomware deployment.
Likely Case
Denial of service through application crashes or instability, with potential for limited code execution in specific configurations.
If Mitigated
Limited impact with proper input validation and sandboxing, potentially only causing application errors.
🎯 Exploit Status
Prototype pollution vulnerabilities are well-understood and often have public proof-of-concept exploits available.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 1.0.2 and later
Vendor Advisory: https://github.com/pjshumphreys/patchmerge/commit/5b383c537eae7a00ebd26d3f7211dac99ddecb12
Restart Required: Yes
Instructions:
1. Update package.json to specify patchmerge version 1.0.2 or later. 2. Run 'npm update patchmerge' or 'npm install patchmerge@latest'. 3. Restart your Node.js application.
🔧 Temporary Workarounds
Input Validation and Sanitization
allImplement strict input validation to reject malformed objects that could trigger prototype pollution.
Object.freeze() on Prototypes
allFreeze Object.prototype and other critical prototypes to prevent pollution.
Object.freeze(Object.prototype);
🧯 If You Can't Patch
- Remove patchmerge dependency entirely if not essential
- Implement network segmentation and restrict application access
🔍 How to Verify
Check if Vulnerable:
Check package.json or package-lock.json for patchmerge version 1.0.0 or 1.0.1
Check Version:
npm list patchmerge
Verify Fix Applied:
Verify patchmerge version is 1.0.2 or later in package.json and node_modules
📡 Detection & Monitoring
Log Indicators:
- Unexpected application crashes
- Unusual prototype modification errors
- Memory exhaustion warnings
Network Indicators:
- Unusual outbound connections from Node.js process
- Unexpected process spawning
SIEM Query:
process.name:node AND (event.action:crash OR error.message:"prototype" OR error.message:"pollution")
🔗 References
- https://github.com/pjshumphreys/patchmerge/commit/5b383c537eae7a00ebd26d3f7211dac99ddecb12
- https://www.whitesourcesoftware.com/vulnerability-database/CVE-2021-25916
- https://github.com/pjshumphreys/patchmerge/commit/5b383c537eae7a00ebd26d3f7211dac99ddecb12
- https://www.whitesourcesoftware.com/vulnerability-database/CVE-2021-25916