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