Executive brief
simple-markdown is a JavaScript library for parsing Markdown content. A regular expression in the autolink parsing logic is vulnerable to denial of service through specially crafted input patterns, where a 5KB malicious document could take over 7 seconds to parse, consuming CPU resources and disrupting service availability.
Technical details
The vulnerability is a Regular Expression Denial of Service (ReDoS) in the autolink pattern matching of simple-markdown.js, caused by inefficient regex complexity (O(n³) in affected versions). The vulnerable pattern fails to properly handle malformed input like "<<<<<<<<<<:/:/:/:/:/:/:/:/:/:/" which triggers catastrophic backtracking. The attack is remotely exploitable without authentication or user interaction—any attacker who can provide markdown input to an application using simple-markdown can trigger excessive CPU consumption. The vulnerability was fixed in version 0.6.1 (commit 015a719bf5cdc561feea05500ecb3274ef609cd2) by refactoring the autolink regex to reduce complexity from O(n³) to O(n²).
Affected products
- simple-markdown simple-markdown 0.6.0 and prior; fixed in 0.6.1
Timeline
- 2019-09: disclosed: Public GitHub PR disclosure
- 2019-09-26: patched: Fix merged in commit 015a719bf5cdc561feea05500ecb3274ef609cd2
- 2023-02-12: advisory: GitHub advisory GHSA-j533-2g8v-pmpg published