Executive brief
markdown-it is a widely used markdown parser that converts markdown text into HTML. A vulnerability in its linkify feature allows attackers to craft specially formatted input containing long sequences of asterisks followed by a non-matching character, causing the parser to consume excessive CPU resources and become unresponsive. This can lead to denial-of-service attacks against any web application or service that processes user-supplied markdown content.
Technical details
The vulnerability is a Regular Expression Denial of Service (ReDoS) vulnerability in the linkify function, specifically in the regex pattern /*+$/ used to strip trailing asterisks from detected URLs. The vulnerable code exists in versions 13.0.0 through 14.1.0. An attacker can supply a string like "https://test.com?" followed by thousands of asterisks and a non-matching character (e.g., 'a'), which causes catastrophic backtracking in the regex engine as it attempts to match the pattern. The attack requires no authentication and can be triggered remotely by any user who can submit markdown content to an application using the vulnerable library with linkify enabled. Processing a maliciously crafted input can cause the application to hang, consuming significant CPU resources. The vulnerability was fixed in version 14.1.1 by optimizing the regex pattern to avoid excessive backtracking.
Affected products
- markdown-it markdown-it 13.0.0 to 14.1.0
Timeline
- 2025-07-05: disclosed
- 2026-02-12: advisory
- 2026-02-13: patched: Fixed in version 14.1.1
References
- https://github.com/markdown-it/markdown-it/commit/4b4bbcae5e0990a5b172378e507b33a59012ed26
- https://gist.github.com/ltduc147/c9abecae1b291ede4f692f2ab988c917
- https://github.com/markdown-it/markdown-it
- https://github.com/markdown-it/markdown-it/blob/14.1.0/lib/rules_inline/linkify.mjs
- https://security.snyk.io/vuln/SNYK-JS-MARKDOWNIT-10666750