Executive brief
word-wrap is a popular JavaScript utility library used to format and wrap text at specified character widths. A flaw in its regular expression pattern can be exploited to cause severe CPU consumption and application hangs when processing specially crafted input, potentially leading to denial of service.
Technical details
The vulnerability is a Regular Expression Denial of Service (ReDoS) flaw in the word-wrap library's result variable regex pattern. All versions prior to 1.2.4 contain an insecure regular expression that exhibits catastrophic backtracking when processing certain malformed input patterns. An attacker can supply specially crafted strings that trigger exponential regex evaluation, causing CPU exhaustion and application unavailability. The vulnerability requires no authentication and is exploitable via network-reachable input handling. A fix was released in version 1.2.4 via commit 420dce9.
Affected products
- jonschlinkert word-wrap All versions before 1.2.4
Timeline
- 2023-06-22: disclosed: Vulnerability disclosed
- 2023-06: patched: Fix released in version 1.2.4