Executive brief
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.
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
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