CVE-2017-16021: garycourt uri-js ReDoS in parse method

CVE-2017-16021 · Severity: low · CVSS 3.1 · Published 2018-07-24

The uri-js library, a popular tool for parsing and validating web addresses (URLs) in JavaScript applications, is vulnerable to a denial-of-service attack. An attacker can provide a specially crafted, long URL that causes the application to consume 100% of its processor power indefinitely. This can lead to the application becoming unresponsive, potentially crashing the service and disrupting business operations.

Technologies: uri-js (npm). Vendors: npm.

Quick answers

Is CVE-2017-16021 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2017-16021 being exploited in the wild.
How severe is CVE-2017-16021?
Low severity, with a CVSS score of 3.1, published 24 July 2018.
Which products and versions are affected?
uri-js (npm) SEMVER:introduced=0,fixed=3.0.0.
Is there a fix for CVE-2017-16021?
Yes. uri-js (npm): upgrade to 3.0.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2017-16021 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2017-16021?
Check whether you run uri-js (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • uri-js (npm): upgrade to 3.0.0 or later
    npm install uri-js@3.0.0

Technical details

The uri-js library (versions prior to 3.0.0) contains a Regular Expression Denial of Service (ReDoS) vulnerability within its URL validation logic. The root cause is an inefficiently constructed regular expression used in the .parse() method to implement RFC 3986 compliance. When a specifically crafted long string (e.g., a URL with many repeated path segments) is passed to this method, the regex engine experiences exponential backtracking, leading to 100% CPU utilization and a process hang. This is reachable by any network attacker who can influence the input to the parse function. The issue is fixed in version 3.0.0.

Affected products

  • garycourt uri-js < 3.0.0

Identifiers

  • CVE-2017-16021
  • GHSA-333w-rxj3-f55r

Timeline

  • 2017-09-13: disclosed: Issue reported on GitHub repository
  • 2018-06-04: advisory: NVD published CVE-2017-16021
  • 2018-07-24: advisory: GitHub Advisory published

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.