Skip to content

[core] Potential ReDoS Vulnerability or Inefficient Regular Expression in Project: Need for Assessment and Mitigation #65

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

Merged
merged 3 commits into from
Jun 11, 2025

Conversation

mmmsssttt404
Copy link
Contributor

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.

if (m.post.match(/,.*\}/)) {

PoC Files and Comparisons:
gist:https://gist.github.com/mmmsssttt404/37a40ce7d6e5ca604858fe30814d9466
use time:
{50256729-A698-49A6-956C-8C3A4AD1C09C}
Proposed Solution:
Change the regular expression to

,(?!,).*\}

change:
https://github.com/mmmsssttt404/brace-expansion/blob/a5b98a4f30d7813266b221435e1eaaf25a1b0ac5/index.js#L157

{B146D730-72F0-41D8-8478-6488D50BEF79}

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

@Soneliem
Copy link

Can this PR be reviewed and merged considering this: GHSA-v6h2-p8h4-qcjw
@juliangruber

@jespinosadf
Copy link

jespinosadf commented Jun 11, 2025

Hi @juliangruber, please accept the PR :D

@watson
Copy link

watson commented Jun 11, 2025

@isaacs I think you have admin write permissions to this repo as well?

@juliangruber juliangruber merged commit 0b6a978 into juliangruber:main Jun 11, 2025
@juliangruber
Copy link
Owner

https://github.com/juliangruber/brace-expansion/releases/tag/v4.0.1

@silverwind
Copy link

Could this be backported to v2 and v3 releases?

@viceice
Copy link

viceice commented Jun 11, 2025

please also v1 because it's trasitively used by minimatch (especially by popular eslint package)

juliangruber added a commit that referenced this pull request Jun 11, 2025
)

* Create redos.js

* Update index.js

* Update test/redos.js

---------

Co-authored-by: Julian Gruber <[email protected]>
@juliangruber
Copy link
Owner

https://github.com/juliangruber/brace-expansion/releases/tag/v3.0.1

@someonestolemyusername

This comment was marked as abuse.

juliangruber added a commit that referenced this pull request Jun 11, 2025
)

* Create redos.js

* Update index.js

* Update test/redos.js

---------

Co-authored-by: Julian Gruber <[email protected]>
@juliangruber
Copy link
Owner

https://github.com/juliangruber/brace-expansion/releases/tag/v2.0.2

juliangruber added a commit that referenced this pull request Jun 11, 2025
)

* Create redos.js

* Update index.js

* Update test/redos.js

---------

Co-authored-by: Julian Gruber <[email protected]>
@juliangruber
Copy link
Owner

https://github.com/juliangruber/brace-expansion/releases/tag/v1.1.12

@juliangruber
Copy link
Owner

@someonestolemyusername pull requests improving the test welcome

@qwilr-altonius
Copy link

Danke @juliangruber!

@viceice
Copy link

viceice commented Jun 11, 2025

Now the advisory needs to be updated, tried it, but it seems i did a mistake 😕

@breadadams
Copy link

Thanks for backporting the fix @juliangruber! I noticed it's been released on GitHub, but not published to npm yet.

Is that something you're working on still?

@watson
Copy link

watson commented Jun 11, 2025

@breadadams it has been released to npm as well

@juliangruber
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.