-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix:Potential ReDoS Vulnerability or Inefficient Regular Expression in Project: Need for Assessment and Mitigation #5971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
那 写段 nodejs 脚本执行任意命令或者跑个死循环,就可以提 nodejs 官方提 BUG 了吗? 看了一下你的 gist 中的 POC,都是类似的,拿这个套路在 github 上刷 PR 吗? |
// If first type is Array, but current is String, try to split them. | ||
if(scht.length > 1 && type != scht[0] && type == '[object String]'){ | ||
if(scht[0] == '[object Array]') { | ||
// unfortunately, js does not support lookahead RegExp (/(?<!\\)\s+/) now (until next ver). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment should be removed because the commit uses lookbehind assertions. The NodeJS implementation of the feature is in 8.10+ (2018-03-06) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Lookbehind_assertion
#6031 this merge is giving issues. |
The new regular expression has problems, and for the problem mentioned before, it cannot cut the parameters correctly. ![]() @Unitech Please revert this pull request. |
Sorry for the impact on the project, this was caused by an extra space, but it happened to not be covered by the test, and then fixed it in the new PR |
![]() |
Steps to reproduce
Hello,
I am writing to report a potential Regular Expression Denial of Service (ReDoS) vulnerability or Inefficient Regular Expression in the project. When using specially crafted input strings in the context, it may lead to extremely high CPU usage, application freezing, or denial of service attacks.
Location of Issue:
The vulnerability is related to a regular expression used in the following validation file, which may result in significantly prolonged execution times under certain conditions.
https://github.com/mmmsssttt404/pm2/blob/d0e7801184bcf98b7c93ffecc77c623df6ffa22f/lib/tools/Config.js#L204
PoC Files and Comparisons:

gist:https://gist.github.com/mmmsssttt404/407e2ffe3e0eaa393ad923a86316a385
use time:
Proposed Solution:
Change the regular expression to
change:
steps:
1.git clone https://github.com/mmmsssttt404/pm2.git
2.cd pm2
3.git checkout development
4.npm install
5.change regex
6.bash test/unit.sh
Thank you for your attention to this matter. Your evaluation and response to this potential security concern would be greatly appreciated.
Best regards,
Search keywords: ReDoS