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

Published Dec 16, 2025
·
Updated

Impact

This issue describes a ReDOS bug found within the figure caption extension (pymdownx.blocks.caption ).

In systems that take unchecked user content, this could cause long hangs when processing the data if a malicious payload was crafted.

Patches

This issue is patched in Release 10.16.1.

Workarounds

Some possible workarounds

If users are concerned about this vulnerability and process unknown user content without timeouts or other safeguards in place to prevent really large, malicious content being aimed at systems, the use of pymdownx.blocks.caption could be avoided until the library is updated to 10.16.1+.

References

The original issue https://github.com/facelessuser/pymdown-extensions/issues/2716.

Description

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:

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

The POC was provided by @ShangzhiXu

py import re import time

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

for i in range(50, 500, 50): longstring = '1' i + 'a' starttime = time.time() match = re.match(regexpattern, longstring) endtime = time.time() print(f"longstring execution time: {endtime - starttime:.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:

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

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

Version(s) & System Info

- Operating System: Any - Python Version: Any

Other sources

PyMdown Extensions is a set of extensions for the Python-Markdown markdown project. Versions prior to 10.16.1 have a ReDOS bug found within the figure caption extension (pymdownx.blocks.caption). In systems that take unchecked user content, this could cause long hanges when processing the data if a malicious payload was crafted. This issue is patched in Release 10.16.1. As a workaround, those who process unknown user content without timeouts or other safeguards in place to prevent really large, malicious content being aimed at systems may avoid the use of pymdownx.blocks.caption until they're able to upgrade.

— MITRE

Affected Software

3 affected componentsFixes available
pypi/pymdown-extensions<10.16.1
pip/pymdown-extensions<10.16.1
10.16.1
facelessuser PyMdown Extensions<10.16.1

Event History

Dec 16, 2025
CVE Published
via MITRE·06:06 PM
Data Sourced
via MITRE·06:06 PM
DescriptionWeakness
Data Sourced
via NVD·06:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·06:16 PM
RemedyAffected Software
Advisory Published
via GitHub·08:46 PM
Data Sourced
via GitHub·08:46 PM
DescriptionWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2025-68142?

CVE-2025-68142 is classified as a moderate severity vulnerability due to the potential for denial of service from ReDOS attacks.

2

How do I fix CVE-2025-68142?

To fix CVE-2025-68142, upgrade PyMdown Extensions to version 10.16.1 or later.

3

What specific component is affected by CVE-2025-68142?

CVE-2025-68142 specifically affects the figure caption extension within the PyMdown Extensions.

4

What type of attack does CVE-2025-68142 enable?

CVE-2025-68142 enables ReDOS (Regular Expression Denial of Service) attacks, which can lead to application hangs.

5

Are previous versions of PyMdown Extensions vulnerable to CVE-2025-68142?

Yes, all versions of PyMdown Extensions prior to 10.16.1 are vulnerable to CVE-2025-68142.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203