Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. pymdown-extensions
  4. ›
  5. CVE-2025-68142

CVE-2025-68142: PyMdown Extensions has a ReDOS bug in its Figure Capture extension

December 16, 2025

The original issue came through PyMdown Extensions’ normal issue tracker instead of the typical security flow: https://github.com/facelessuser/pymdown-extensions/issues/2716. Because this came through the normal issue flow, it was handled as a normal issue. In the future, PyMdown Extensions will ensure such issues, even if prematurely made public through the normal issue flow, are redirected through the typical security process.

The regular expression pattern in question is as follows:

RE_FIG_NUM = re.compile(r'^(\^)?([1-9][0-9]*(?:.[1-9][0-9]*)*)(?= |$)')

The POC was provided by @ShangzhiXu

import re
import time

regex_pattern = re.compile(r'^(\^)?([1-9][0-9]*(?:.[1-9][0-9]*)*)(?= |$)')

for i in range(50, 500, 50):
long_string = '1' * i + 'a'
start_time = time.time()
match = re.match(regex_pattern, long_string)
end_time = time.time()
print(f"long_string execution time: {end_time - start_time:.6f} s")

The issue with the above pattern is that . was used, which accepts any character when we meant to use \.. The fix was to update the pattern to:

RE_FIG_NUM = re.compile(r'^(\^)?([1-9][0-9]*(?:\.[1-9][0-9]*)*)(?= |$)')

Relevant PR with fix: https://github.com/facelessuser/pymdown-extensions/pull/2717

References

  • github.com/advisories/GHSA-r6h4-mm7h-8pmq
  • github.com/facelessuser/pymdown-extensions
  • github.com/facelessuser/pymdown-extensions/commit/b50d15a56850ed1408a284bba81cc019c6bd72e8
  • github.com/facelessuser/pymdown-extensions/security/advisories/GHSA-r6h4-mm7h-8pmq
  • nvd.nist.gov/vuln/detail/CVE-2025-68142
  • pypi.org/project/pymdown-extensions/10.16.1

Code Behaviors & Features

Detect and mitigate CVE-2025-68142 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 10.16.1

Fixed versions

  • 10.16.1

Solution

Upgrade to version 10.16.1 or above.

Impact 5.3 MEDIUM

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Learn more about CVSS

Weakness

  • CWE-1333: Inefficient Regular Expression Complexity

Source file

pypi/pymdown-extensions/CVE-2025-68142.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 04 Feb 2026 00:35:30 +0000.