CVE-2017-16137: debug library regular expression denial of service

CVE-2017-16137 · Severity: low · CVSS 3.1 · Published 2018-08-09

The debug library is a widely-used Node.js logging utility (86+ million weekly downloads). A flaw in its %o formatter allows untrusted input to trigger excessive CPU consumption, potentially blocking the event loop and causing application slowdowns or outages. The vulnerability requires 50,000+ characters of malicious input to noticeably impact performance, making it a lower-risk but still actionable issue for systems accepting large unvalidated user input.

Technologies: debug (npm). Vendors: npm.

Quick answers

Is CVE-2017-16137 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2017-16137 being exploited in the wild.
How severe is CVE-2017-16137?
Low severity, with a CVSS score of 3.1, published 9 August 2018.
Which products and versions are affected?
debug (npm) SEMVER:introduced=0,fixed=2.6.9.
Is there a fix for CVE-2017-16137?
Yes. debug (npm): upgrade to 2.6.9 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2017-16137 attacked?
It is attacked over the network.
Am I affected by CVE-2017-16137?
Check whether you run debug (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

  • debug (npm): upgrade to 2.6.9 or later
    npm install debug@2.6.9

Technical details

A regular expression denial of service (ReDoS) vulnerability exists in the debug library's %o formatter when processing untrusted input. The vulnerable regex can enter catastrophic backtracking when given specially crafted long strings, consuming CPU and blocking the Node.js event loop. The vulnerability was originally patched but was accidentally reintroduced in later versions (3.2.0 and 4.0.0). Attack requires passing unsanitized input through debug() with the %o formatter; typical use cases with sanitized or developer-controlled input are unaffected. Affected versions: <2.6.9, 3.0.0–3.0.x, 3.2.0–3.2.6, and 4.0.0–4.3.0. Patches are available in versions 2.6.9, 3.1.0+, 3.2.7+, and 4.3.1+.

Affected products

  • TJ Holowaychuk debug 0–2.6.8, 3.0.0–3.0.x, 3.2.0–3.2.6, 4.0.0–4.3.0

Identifiers

  • CVE-2017-16137
  • GHSA-gxpj-cx7g-858c

Timeline

  • 2018-08-09: disclosed: Initial advisory published (CVE-2017-16137)
  • 2020-11-28: exploited: Regression rediscovered in version 3.2.0 and later; vulnerability visibility notice issued

References

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