You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
To evaluate the performance of this inefficient regular expression matching with varying input contents, the following commands can be executed within every PoC_i folder:
$ npm install # Install necessary dependencies for the minimal proof of concept environment.
$ time node poc.js # Run the script with maliciously constructed string and record the running time.
$ time node normal_string.js # Run the script with normal strings of same length and record the running time.
In the most severe case, on my machine, the maliciously crafted string took the following time, and caused CPU usage to reach 98% during program execution:
real 8m7.094s
However, a normal string of the same length only took the following time:
real 0m0.072s
user 0m0.040s
sys 0m0.024s
This reveals a significant efficiency problem with the regular expression used in the program under certain conditions.
Proposed Solution:
A simple strategy could be to limit the length of the string being matched by the regular expression, thereby preventing excessive time consumption during regex matching. To completely avoid the issue, the pathological part of the regular expression that causes catastrophic backtracking should be modified.
Background Information:
Here are some real-world examples of issues caused by ReDoS vulnerabilities:
In 2019, Cloudflare experienced a service disruption lasting approximately 27 minutes due to a ReDoS vulnerability that allowed crafted input to overwhelm regex processing, resulting in significant performance degradation and temporary service outage (source: Cloudflare Incident Report).
Stack Overflow was affected by a ReDoS vulnerability in 2016, causing multiple instances of service degradation and temporary outages of up to 34 minutes during peak traffic periods due to inefficient regular expression patterns (source: Stack Overflow Incident Report).
Thank you for your attention to this matter. Your evaluation and response to this potential security concern would be greatly appreciated.
Best regards,
Current behavior
No response
Expected behavior
No response
Context
No response
Your environment
No response
Search keywords: ReDoS
The text was updated successfully, but these errors were encountered:
Thanks for the nice write up. Would you like to explore the changes by providing a PR? I wouldn't prioritize this as work fro the team, but we may accept a community PR if it solves an issue.
Hi @mnajdova! I worked on the PR #44627 for this issue recently, fixing the ReDoS problem mentioned in this issue and providing test cases for these ReDoS problems. It has passed all checks but still requires 'At least 1 approving review is required by reviewers with write access.' If there are any further needs, please contact me.
mj12albert
changed the title
Potential ReDoS Vulnerability or Inefficient Regular Expression in Project: Need for Assessment and Mitigation
[core] Potential ReDoS Vulnerability or Inefficient Regular Expression in Project: Need for Assessment and Mitigation
Dec 4, 2024
mj12albert
added
core
Infrastructure work going on behind the scenes
and removed
docs
Improvements or additions to the documentation
labels
Dec 4, 2024
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
Note
@uniqueqidian How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.
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.
material-ui/docs/src/modules/components/Demo.js
Line 476 in f977402
material-ui/packages/mui-codemod/src/v5.0.0/root-ref.js
Line 9 in f977402
material-ui/packages/mui-codemod/src/v5.0.0/root-ref.js
Line 6 in f977402
material-ui/packages/markdown/parseMarkdown.js
Line 219 in f977402
PoC Files and Comparisons:
PoC_1.zip
PoC_2.zip
PoC_3.zip
PoC_4.zip
To evaluate the performance of this inefficient regular expression matching with varying input contents, the following commands can be executed within every PoC_i folder:
In the most severe case, on my machine, the maliciously crafted string took the following time, and caused CPU usage to reach 98% during program execution:
However, a normal string of the same length only took the following time:
This reveals a significant efficiency problem with the regular expression used in the program under certain conditions.
Proposed Solution:
A simple strategy could be to limit the length of the string being matched by the regular expression, thereby preventing excessive time consumption during regex matching. To completely avoid the issue, the pathological part of the regular expression that causes catastrophic backtracking should be modified.
Background Information:
Here are some real-world examples of issues caused by ReDoS vulnerabilities:
Thank you for your attention to this matter. Your evaluation and response to this potential security concern would be greatly appreciated.
Best regards,
Current behavior
No response
Expected behavior
No response
Context
No response
Your environment
No response
Search keywords: ReDoS
The text was updated successfully, but these errors were encountered: