- Package:
- src:python-markdown2
- Source:
- src:python-markdown2
- Submitter:
- Moritz Mühlenhoff
- Date:
- 2026-11-03 11:27:01 UTC
- Severity:
- normal
- Tags:
Hi, The following vulnerability was published for python-markdown2. CVE-2026-88753[0]: | A Regular-Expression Denial of Service (ReDoS) in the Markdown2. | extract_metadata() function (lib/markdown2.py) of trentm markdown2 | through v2.5.5 allows attackers to cause a Denial of Service (DoS) | via a crafted Markdown document. https://gist.github.com/NanaSec/354b4188bbd7f4105008c7b8be49b0ba 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-2026-88753 https://www.cve.org/CVERecord?id=CVE-2026-88753 Please adjust the affected versions in the BTS as needed.
Hi, CVE-2026-88753 (ReDoS in metadata parsing, gist by NanaSec) is upstream issue #741: https://www.google.com/url?q=https://github.com/trentm/python-markdown2/issues/741&source=gmail&ust=1793790559760000&sa=E It is fixed on master by PR #742, merged 2026-10-19: https://www.google.com/url?q=https://github.com/trentm/python-markdown2/pull/742&source=gmail&ust=1793790559760000&sa=E commit b624eafc72 "Avoid overlapping regex matches in _key_val_list_pat" merge a3716b5e0aeba16b6e85965b2e5019d174328f36 No upstream release contains it yet (the latest tag is 2.5.5). I checked it against Debian's 2.5.4-4. The installed /usr/lib/python3/dist-packages/markdown2.py is identical to upstream 2.5.4 lib/markdown2.py. 1) Applying the patch: the lib/markdown2.py hunks apply to 2.5.4 with offsets only (-27/-36), no fuzz. The test/test_redos.py hunk does not fit 2.5.4's older ReDoS harness, which has no extras parameter. The attached patch is the lib-only change, rebased onto 2.5.4. 2) Reproducer from the upstream issue: markdown() with extras=["metadata"] on "---\nkey: -<N spaces>\n---\n\n# hello\n": N 2.5.4-4 patched 4000 0.090 s 0.0025 s 8000 0.358 s 0.0003 s 16000 1.397 s 0.0003 s 32000 5.603 s 0.0004 s The unpatched time grows quadratically; the patched time stays flat. 3) Regression check: I rendered all 238 upstream test inputs (*.text under test/) with extras=["metadata"] through the unpatched and patched modules and compared the HTML and the metadata. - 233 are identical. - 3 differ only because of the randomized e-mail address obfuscation; unpatched vs unpatched differs on the same 3. - 2 differ in metadata, and both are documents that are not metadata documents (admonitions_with_fenced_code_blocks, fenced_code_blocks_issue135) that I force-rendered with the metadata extra. The four dedicated metadata cases (metadata, metadata2, metadata3, emacs_file_vars_with_metadata) produce the expected .metadata and .html output both before and after. List values such as "- a: b" and plain "- one/- two" lists parse the same before and after. I could not run upstream's own test.py in this environment, so the above is a differential comparison, not the full testsuite run. Regards
Hi, A follow-up to my previous mail, where I said I could not run upstream's test.py. I have now run it (test/test.py from the 2.5.4 tag) against unmodified 2.5.4 and against 2.5.4 with the attached PR #742 lib patch: 2.5.4 (unpatched): Ran 240 tests, FAILED (14 failures) 2.5.4 + PR #742: Ran 240 tests, FAILED (14 failures) The failure count is the same, so these 14 look pre-existing or environment-related. I only captured the summary, so I have not confirmed that the two runs fail exactly the same 14 tests. For reference, PR #742 also adds a second ReDoS case (issue_metadata_list_redos: "items:\n - " followed by 32000 spaces). Its test_redos.py hunk does not apply to 2.5.4, as I noted before. Regards