[fix] Vulnerability GHSA-x5gf-qvw8-r2rm#6015
[fix] Vulnerability GHSA-x5gf-qvw8-r2rm#6015chaymankala wants to merge 1 commit intoUnitech:masterfrom
Conversation
I know from working on some internal parts of this project in the past that it can take a while for pull requests to be merged. That's no reason to waste everyone's time with AI slop. |
|
@OIRNOIR PS: I used multiple agents and I verified what AI generated before I pushed, I did not do this blindly. Also, you can include your first point in CONTRIBUTING.md, if maintainers feel the same way, they will merge it. |
🔒 Security Fix: ReDOS Vulnerability in Config.js (CVE-2025-5891)
Summary
This PR fixes a Regular Expression Denial of Service (ReDOS) vulnerability in
/lib/tools/Config.jsthat could allow attackers to cause excessive CPU consumption and potentially crash PM2 applications.🚨 Vulnerability Details
Affected Code
The vulnerability exists in the
_valid()function (lines 181-185) where a complex regular expression with nested quantifiers is used to parse configuration strings:This regex pattern exhibits exponential time complexity when processing specially crafted input strings, leading to catastrophic backtracking.
Attack Scenario
An attacker could:
🛠️ Fix Implementation
This PR implements multiple layers of protection:
1. Regex Complexity Validation
/([+*]{2,}|(\(.{0,10}\)){3,})/2. Input Sanitization
3. Defensive Programming
validateJSON()function📋 Changes Made
/lib/tools/Config.jsvalidateJSON()✅ Testing
🔗 References
📈 Impact
This fix:
🚀 Deployment
Safe to deploy immediately - this is a security-critical fix with no breaking changes.