CVE-2025-68142: Pymdown extensions Denial of Service Vulnerability
LOWCVE-2025-68142 is a LOW denial of service vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Pymdown extensions libraries in the PyPI ecosystem. The issue involves pymdown extensions has a redos bug in its figure capture extension. Remediation is available by upgrading affected packages to version 10.16.1.
CVE-2025-68142 at a Glance
How to Fix CVE-2025-68142
To remediate this vulnerability, upgrade all affected Pymdown extensions dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install pymdown-extensions>=10.16.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show pymdown-extensions
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2025-68142, inspect your installed packages using pip:
pip show pymdown-extensions
Analyze the terminal output to locate any version of Pymdown extensions in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 10.16.1), your application is affected.
Note: The pip show pymdown-extensions command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In Pymdown extensions, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-68142 Affected Pymdown extensions Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
pymdown-extensions
|
PyPI |
< 10.16.1
|
10.16.1
|
References
Frequently Asked Questions
What is CVE-2025-68142?
Which Pymdown extensions versions are affected?
What version fixes CVE-2025-68142?
Is pymdown-extensions affected?
What CWE is associated with CVE-2025-68142?
How can I check PyPI dependencies for CVE-2025-68142?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-r6h4-mm7h-8pmq",
"modified" : "2025-12-16T20:46:05Z",
"published" : "2025-12-16T20:46:05Z",
"aliases" : [ "CVE-2025-68142" ],
"summary" : "PyMdown Extensions has a ReDOS bug in its Figure Capture extension",
"details" : "### Impact\n\nThis issue describes a ReDOS bug found within the figure caption extension (`pymdownx.blocks.caption` ).\n\nIn systems that take unchecked user content, this could cause long hangs when processing the data if a malicious payload was crafted.\n\n### Patches\n\nThis issue is patched in Release [10.16.1](https://pypi.org/project/pymdown-extensions/10.16.1/).\n\n### Workarounds\n\nSome possible workarounds\n\nIf 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+.\n\n### References\n\nThe original issue https://github.com/facelessuser/pymdown-extensions/issues/2716.\n\n### Description\n\nThe 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.\n\nThe regular expression pattern in question is as follows:\n\n```py\nRE_FIG_NUM = re.compile(r'^(\\^)?([1-9][0-9]*(?:.[1-9][0-9]*)*)(?= |$)')\n```\n\nThe POC was provided by @ShangzhiXu\n\n```py\nimport re\nimport time\n\nregex_pattern = re.compile(r'^(\\^)?([1-9][0-9]*(?:.[1-9][0-9]*)*)(?= |$)')\n\nfor i in range(50, 500, 50):\n long_string = '1' * i + 'a'\n start_time = time.time()\n match = re.match(regex_pattern, long_string)\n end_time = time.time()\n print(f\"long_string execution time: {end_time - start_time:.6f} s\")\n```\n\nThe 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:\n\n```py\nRE_FIG_NUM = re.compile(r'^(\\^)?([1-9][0-9]*(?:\\.[1-9][0-9]*)*)(?= |$)')\n```\n\nRelevant PR with fix: https://github.com/facelessuser/pymdown-extensions/pull/2717\n\n### Version(s) & System Info\n\n- Operating System: Any\n- Python Version: Any",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:U"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "pymdown-extensions"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "10.16.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/facelessuser/pymdown-extensions/security/advisories/GHSA-r6h4-mm7h-8pmq"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-68142"
}, {
"type" : "WEB",
"url" : "https://github.com/facelessuser/pymdown-extensions/commit/b50d15a56850ed1408a284bba81cc019c6bd72e8"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/facelessuser/pymdown-extensions"
}, {
"type" : "WEB",
"url" : "https://pypi.org/project/pymdown-extensions/10.16.1"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1333" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2025-12-16T20:46:05Z",
"nvd_published_at" : "2025-12-16T18:16:16Z"
}
}