Update dependency pymdown-extensions to v10.21.3 [SECURITY]#33
Open
renovate[bot] wants to merge 1 commit into
Open
Update dependency pymdown-extensions to v10.21.3 [SECURITY]#33renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
71452f8 to
a80b094
Compare
a80b094 to
eb20bfb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
10.14.3→10.21.3PyMdown Extensions has a ReDOS bug in its Figure Capture extension
CVE-2025-68142 / GHSA-r6h4-mm7h-8pmq
More information
Details
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.captioncould 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:
The POC was provided by @ShangzhiXu
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:Relevant PR with fix: https://github.com/facelessuser/pymdown-extensions/pull/2717
Version(s) & System Info
Severity
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:UReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Regression in pymdownx.snippets reintroduces sibling-prefix path traversal bypass despite restrict_base_path
CVE-2026-46338 / GHSA-62q4-447f-wv8h
More information
Details
Summary
pymdownx.snippetshas a regression of the CVE-2023-32309 / GHSA-jh85-wwv9-24hv fix. Withrestrict_base_path: True(the default), the currentfilename.startswith(base)containment check does not enforce a directory boundary. As a result, a markdown snippet directive can read files from sibling paths that share the same prefix asbase_path, such asdocsvsdocs_internal.The regression was introduced in PR #2039 / commit
7c13bda5b7793b172efd1abb6712e156a83fe07d, which replaced the original directory-identity check with a plain string-prefix comparison.Details
The regression was introduced in commit
7c13bda5b7793b172efd1abb6712e156a83fe07d(2023-05-15, #2039 "Fix regression of snippets nested deeply under specified base path"), which relaxed the originalos.path.samefile(base, os.path.dirname(filename))check to a plainstartswith(base).SnippetPreprocessor.get_snippet_path()inpymdownx/snippets.py:baseisos.path.abspath(b)and has no trailing separator.str.startswith(base)isTruefor anyfilenamewhose string representation begins with the same characters asbase, regardless of whether those characters end at a directory boundary.Concrete example:
base = "/x/docs"path = "../docs_secret/leak.txt"(inside the markdown snippet directive)os.path.join(base, path)→"/x/docs/../docs_secret/leak.txt"os.path.abspath(...)→"/x/docs_secret/leak.txt"filename.startswith(base)→True, because"/x/docs_secret/..."begins with the literal string"/x/docs".All releases from 10.0.1 (2023-05-15) through 10.21.2 (current) are affected.
Impact
Arbitrary file read within the host the build runs on, bounded by the prefix match. With
base_path = /x/docsthe attacker can read files from any sibling directory whose path begins with the literal string/x/docsfollowed by any non-separator character — for example/x/docs_internal/,/x/docs.bak/,/x/docs2/.The threat model is the same as the original CVE-2023-32309: markdown content processed by the snippets preprocessor in a build pipeline (typical scenario: an MkDocs documentation site built in CI from PR contributions or otherwise less-trusted markdown) can read files outside the configured base. CI builds that publish the generated HTML expose the read file to the public; CI builds with secrets on disk leak those secrets.
Reproduction
Minimal local PoC, non-destructive:
Default
restrict_base_path: Trueis sufficient — no non-default option is required.Suggested fix
Minimal change — require the separator after the base prefix:
This preserves the original intent (allow snippets nested at any depth under
base_path) while restoring the directory-boundary check. It does not affect theos.path.isdir(base)branch wherebaseis a file (that branch still usesos.path.samefile).Alternative:
os.path.commonpath([base, filename]) == baseis equivalent and slightly more idiomatic, though it raisesValueErroron different drives on Windows and would need atry/except. Thestartswith(base + os.sep)fix is the smaller diff.Note: this fix does not change behaviour for symlinks inside
base_path. The existing implementation usesos.path.abspath(notos.path.realpath), so a symlink withinbase_pathpointing outside is still followed. That is a separate concern — symlinks require write access tobase_path, a much higher bar than the current bypass — and matches the behaviour the CVE-2023 fix established.Regression test
A regression test class
TestSnippetsSiblingPrefixwas added intests/test_extensions/test_snippets.py. It usestests/test_extensions/_snippets/nestedasbase_pathand a new fixture directorytests/test_extensions/_snippets/nested_sibling_evil/leak.txt. It asserts that the markdown directive--8<-- "../nested_sibling_evil/leak.txt"raisesSnippetMissingError.AssertionError: SnippetMissingError not raised, sibling file is silently read).Full suite:
python -m pytest tests/ -q→ 738 passed (737 baseline + 1 new regression test). No regressions.Affected versions
>= 10.0.1, <= 10.21.2Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
facelessuser/pymdown-extensions (pymdown-extensions)
v10.21.3Compare Source
10.21.3
restrict_base_pathis enabled (the default). Found by @gistrec.v10.21.2: 10.21. 2Compare Source
10.21.2
None.v10.2110.21
@joapuiib.
v10.20Compare Source
10.20
NEW: Quotes: New blockquotes extension added that uses a more modern approach when compared to Python Markdown's
default. Quotes specifically will not group consecutive blockquotes together in the same lazy fashion that the
default Python Markdown does which follows a more modern trend to how parsers these days handle block quotes.
In addition, Quotes also provides an optional feature to enable specifying callouts/alerts in the style used by
GitHub and Obsidian.
v10.19.1Compare Source
10.19.1
$$math used inline within a paragraph could result in nested mathparsing.
v10.19Compare Source
10.19
viewmode deprecation as some still like to use it, though further enhancements to thismode are not planned.
v10.18Compare Source
10.18
viewmode has been deprecated. To avoid warnings or future issues, explicitly setmodetoeither
acceptorreject. In the future, the new default will beacceptand theviewmode will be removedentirely.
importantshould have always been available as a default.v10.17.2Compare Source
10.17.2
and other non-conflicting blocks.
v10.17.1Compare Source
10.17.1
v10.17Compare Source
10.17
#idsyntax.v10.16.1: 10.6.1Compare Source
10.16.1
v10.16Compare Source
10.16
max_retriesandbackoff_retriesoptions to configure new retry logic for HTTP 429errors (Too Many Requests client error).
desired.
v10.15Compare Source
10.15.0
relaxed_headersoption which can tolerate bad content in the fenced code header. Whenenabled, code blocks with bad content in the header will likely still convert into code blocks, often respecting
the specified language.
combine_header_slugwas enabled and there was noheader.
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.