CVE-2025-68142Low▾ SunlitPyMdown Extensions has a ReDOS bug in its Figure Capture extension
▾ Sunlit zone — Low / medium · no exploitation signal
impact 13.8 · likelihood 0.1 · exploitation 0
Need a working PoC? Pro members can cast a request and our team develops one — it lands right here.
Exploit-prediction probability, daily snapshots since Jul 8.
Disclosure to exploitation, from the record and what we observed since indexing it.
Disclosed via OSV
Last analysed / modified upstream
0.4%
0.4% → 0.5%
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.
This issue is patched in Release 10.16.1.
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+.
The original issue https://github.com/facelessuser/pymdown-extensions/issues/2716.
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
pymdown-extensions < 10.16.1Upgrade to a patched release:
pymdown-extensions 10.16.1Connected by shared product, vendor, weakness, or advisory.
CVE-2026-61632Medium· 5.3PyMdown Extensions: Path traversal in the b64 extension lets <img src> read files outside base_path
CVE-2026-46338Medium· 4.3Regression in pymdownx.snippets reintroduces sibling-prefix path traversal bypass despite restrict_base_path
CVE-2023-32309High· 7.5Any file can be included with the pymdown-snippets extension