#1152830 python-markdown: CVE-2019-25781

Package:
src:python-markdown
Source:
src:python-markdown
Submitter:
Moritz Mühlenhoff
Date:
2026-11-05 20:49:01 UTC
Severity:
normal
Tags:
#1152830#5
Date:
2026-11-01 20:06:55 UTC
From:
To:
Hi,

The following vulnerability was published for python-markdown.

CVE-2019-25781[0]:
| Python-Markdown 3.0 through 3.11.2 contains an algorithmic
| complexity vulnerability in inline link parsing that allows remote
| attackers to exhaust CPU through unmatched brackets. Attackers can
| submit short Markdown containing repeated [ or ![ characters,
| forcing LinkInlineProcessor.getText() and getLink() into quadratic
| scans that keep workers busy for minutes.

https://github.com/Python-Markdown/markdown/issues/798
https://github.com/Python-Markdown/markdown/issues/1654


If you fix the vulnerability please also make sure to include the
CVE (Common Vulnerabilities & Exposures) id in your changelog entry.

For further information see:

[0] https://security-tracker.debian.org/tracker/CVE-2019-25781
https://www.cve.org/CVERecord?id=CVE-2019-25781

Please adjust the affected versions in the BTS as needed.

#1152830#16
Date:
2026-11-05 20:47:47 UTC
From:
To:
Hi,

some additional information on CVE-2019-25781, in case it helps when the
tracker entry is next updated:

- No upstream release fixes this yet. 3.11.3 (released 2026-11-05) does not
change LinkInlineProcessor.getText()/getLink(); both are identical to
3.11.2. The CVE record's "3.0 through 3.11.2" range only reflects the
release that was current when the CVE was published.

- Upstream issue 1654 (listed as a reference) is closed, but it was closed
by its reporter after being pointed to issue 798 as a duplicate; it has no
associated fix. Issue 798 is open (it was auto-closed by PR 1631 on
2026-09-16 and reopened the same day; PR 1631 / commit 5d1363ce4b86 in
3.11.0 fixed a different sub-case, the reference-definition regex, even
though the 3.11.0 changelog lists it under "#798").

- The candidate fixes are two open, unmerged upstream PRs:
PR 1664 "Fix quadratic time for unclosed brackets in link text" (getText;
head 6377adc58cdb)
PR 1680 "Fix quadratic time for unclosed parentheses in link targets"
(getLink; head 66ae093fd55f)
Since the CVE description names both getText() and getLink(), both would be
needed.

Timing of markdown.markdown(s) with Python 3.14 on the extracted Debian
sources:

input '[' * n n=2000 n=4000 n=8000
3.4.1-2+deb12u1 0.92s 3.35s 12.37s
3.7-2+deb13u1 0.72s 2.91s 12.39s
3.10.3-1 0.87s 2.95s 10.81s
3.11.2-1 0.56s 2.36s 9.76s
upstream 3.11.3 0.72s 2.68s 10.36s
PR 1664 head 0.009s 0.016s 0.022s

input '![' * 8000 (16 KB): 18-28s on all Debian versions above and on
3.11.3; 0.031s with PR 1664.

input '[a](' * n n=4000 n=8000
3.11.2-1 5.99s 19.68s
upstream 3.11.3 5.25s 22.33s
PR 1680 head 0.034s 0.177s

I have only measured timing; I have not checked the PRs' output equivalence
beyond what their authors describe.

Regards,
Sumit Verma