Hi, This is about CVE-2026-33079 (bug #1135942), the ReDoS in mistune's quoted link-title scanner.
Current state and affectedness ------------------------------ The vulnerable code is the LINK_TITLE_RE regular expression in the helpers module. Its catch-all character class also matches a backslash, so a backslash that begins an escape can be consumed either by the escape alternative or by the catch-all; an unterminated title built from many backslash-bang pairs then triggers catastrophic backtracking (CWE-1333). Upstream removed LINK_TITLE_RE entirely in 3.3.0 (commit 5de41fb8e527, which rewrote the title parser as a linear character scan with no backtracking). Versions 3.2.0 and 3.2.1 still contain the regex; 3.3.0 and later do not. Mapping that to Debian: bookworm 2.0.4-1 not affected (predates the regex; already marked so) trixie 3.1.3-1 affected (regex present) forky 3.1.4-1 affected (regex present) sid 3.4.0-1 not affected (ships the 3.3.0+ linear parser) So unstable (3.4.0-1) is no longer affected and the tracker's unstable entry can be moved to fixed; the "revisit when fixed upstream" note is resolved, since it was fixed upstream in 3.3.0. trixie and forky still carry the regex. Backport for the still-affected 3.1.x ------------------------------------- The 3.3.0 rewrite is too large to backport to a stable release, so the attached patch makes the existing regex non-backtracking instead: a backslash is consumed only by the escape alternative (backslash plus any one character, newline included), and the catch-all class excludes backslash. The two alternatives can then no longer both consume a backslash. The set of accepted titles is unchanged -- an escaped character (including an escaped quote) is still one unit, and a title may still span lines. The patch applies cleanly to both 3.1.3-1 (trixie) and 3.1.4-1 (forky); the diff is identical for both. Verification (installed 3.1.4-1, module used only as a library) --------------------------------------------------------------- Reproducer: an inline link whose title is many backslash-bang pairs, left unterminated. - End to end through create_markdown(): N=18 pairs about 190 ms, N=24 exceeds 8 s (hard-killed). - The regex alone, 5 s hard timeout per match: shipped regex N=20 about 485 ms, N=25 times out; patched regex stays about 27 ms through N=1000. - The compiled pattern extracted from the shipped trixie and forky helpers equals the one benchmarked as vulnerable; the patched pattern equals the safe one. - Behaviour check: shipped vs patched regex produce identical matches across a battery of valid and edge-case titles (escaped quote, escaped backslash, backslash-letter, tab, embedded newline, unicode, parentheses, brackets, empty) for both quote styles -- zero differences. The DEP-3 header in the patch records the upstream commit and this bug. Thanks, Sumit Verma
Description: Fix ReDoS in link-title parsing (CVE-2026-33079) helpers.LINK_TITLE_RE matched a quoted link title with '"(?:\\[PUNCTUATION]|[^"\\x00])*"' (and the '-quoted twin). The catch-all class [^"\\x00] also matches a backslash, so a backslash starting an escape could be consumed either by the escape alternative or by the catch-all. On an unterminated title made of many "\!" sequences this ambiguity causes catastrophic backtracking: a ~60-byte inline link or reference definition pins a CPU for seconds (CWE-1333), a denial of service for any service rendering untrusted Markdown with mistune. . Upstream removed LINK_TITLE_RE in 3.3.0 (commit 5de41fb8e527, which rewrote the title parser as a linear scan); that refactor is too invasive to backport to a stable release. This instead makes the regex unambiguous: a backslash is consumed only by the escape alternative (\\ followed by any single character, including a newline), and the catch-all class excludes backslash. The language accepted is unchanged (an escaped character, including \" / \', is still one unit; a title may still span lines), but the two alternatives can no longer both consume a backslash, so backtracking is linear. Author: Sumit Verma <[email protected]> Origin: backport, https://github.com/lepture/mistune/commit/5de41fb8e527 Bug-Debian: https://bugs.debian.org/1135942 Forwarded: not-needed (regex removed upstream in 3.3.0) Last-Update: 2026-11-06 --- --- a/src/mistune/helpers.py +++ b/src/mistune/helpers.py @@ -19,8 +19,8 @@ LINK_TITLE_RE = re.compile( r"[ \t\n]+(" - r'"(?:\\' + PUNCTUATION + r'|[^"\x00])*"|' # "title" - r"'(?:\\" + PUNCTUATION + r"|[^'\x00])*'" # 'title' + r'"(?:\\[\s\S]|[^"\x00\\])*"|' # "title" + r"'(?:\\[\s\S]|[^'\x00\\])*'" # 'title' r")" ) PAREN_END_RE = re.compile(r"\s*\)")

