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 #10

Closed
cristianstaicu opened this issue Sep 5, 2017 · 2 comments · Fixed by #11
Closed

Vulnerable Regular Expression #10

cristianstaicu opened this issue Sep 5, 2017 · 2 comments · Fixed by #11

Comments

@cristianstaicu
Copy link

The following regular expression used for parsing the HTTP header is vulnerable to ReDoS:

/(?:charset|encoding)\s*=\s*['"]? *([\w\-]+)/i

The slowdown is moderate: for 30.000 characters around 4 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.

@fengmk2
Copy link
Member

fengmk2 commented Sep 5, 2017

Yes, thanks for your report! We will fix this high security problem as soon as possible!

@fengmk2
Copy link
Member

fengmk2 commented Sep 5, 2017

Can you send me the example to my email fengmk2#gmail.com?

fengmk2 added a commit that referenced this issue Sep 7, 2017
only allow max 10 spaces and 100 charset string

closes #10
fengmk2 added a commit that referenced this issue Sep 7, 2017
only allow max 10 spaces and 100 charset string

closes #10
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 a pull request may close this issue.

2 participants