[GHSA-x6fg-f45m-jf5q] Regular Expression Denial of Service in semver#7101
Closed
ljharb wants to merge 1 commit intoljharb/advisory-improvement-7101from
Closed
[GHSA-x6fg-f45m-jf5q] Regular Expression Denial of Service in semver#7101ljharb wants to merge 1 commit intoljharb/advisory-improvement-7101from
ljharb wants to merge 1 commit intoljharb/advisory-improvement-7101from
Conversation
|
Could you provide the commits to where the changes are made? |
There was a problem hiding this comment.
Pull request overview
Narrows the affected version range for GHSA-x6fg-f45m-jf5q (CVE-2015-8855) to reflect that semver 1.0.x is not vulnerable to the ReDoS issue.
Changes:
- Update the advisory’s affected range to start at semver 1.1.0 instead of 0
- Refresh the advisory’s
modifiedtimestamp to reflect the metadata update
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Author
|
whoops, the actual commit that introduced it is npm/node-semver@5c4c9f6, between v1.0.3 and v1.0.5 - i'll close this and reopen a proper one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates
Comments
The affected version range for this advisory should be narrowed. Versions 1.0.0 through 1.0.14 of semver are NOT vulnerable to CVE-2015-8855.
The vulnerability is a Regular Expression Denial of Service (ReDoS) caused by \s* whitespace quantifiers in the version parsing regex. In semver 1.0.x, the main regex pattern is:
[v=]*([0-9]+).([0-9]+).([0-9]+)
This regex has NO whitespace quantifiers and therefore cannot exhibit catastrophic backtracking on whitespace-padded inputs.
In semver 1.1.0, the regex was changed to:
\s*[v=]\s([0-9]+).([0-9]+).([0-9]+)
The added \s* quantifiers create the backtracking vulnerability when combined with the alternation in range parsing.
Behavioral testing confirms this:
The correct affected range should be >= 1.1.0, < 4.3.2 (not >= 0, < 4.3.2).