Skip to content
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

Vulnerable Regular Expression #66

Closed
cristianstaicu opened this issue Sep 5, 2017 · 2 comments
Closed

Vulnerable Regular Expression #66

cristianstaicu opened this issue Sep 5, 2017 · 2 comments

Comments

@cristianstaicu
Copy link

There are multiple regular expression used for parsing the user agent which are vulnerable to ReDoS, e.g.:

/(?=.*\bAndroid\b)(?=.*\bSD4930UR\b)/i

The slowdown is relatively serious because multiple such regexs are checked against the user agent: for 40.000 characters around 22 seconds matching time. I would suggest one of the following:

  • remove the regex,
  • anchor the regex,
  • limit the number of characters that can be matched by the repetition,
  • limit the input size.

If needed, I can provide an actual example showing the slowdown.

@sberney
Copy link

sberney commented Jul 6, 2018

You could create a PR for this

@kaimallea
Copy link
Owner

Fixed by #77

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

No branches or pull requests

3 participants