PT-2026-42035 · Pypi · Pymdown Extensions

CVE-2026-46338

·

Published

2026-05-19

·

Updated

2026-07-17

CVSS v3.1

4.3

Medium

VectorAV:N/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N
Name of the Vulnerable Software and Affected Versions pymdown-extensions versions 10.0.1 through 10.21.2
Description A regression in the pymdownx.snippets extension allows for arbitrary file read on the host system where the build runs. When restrict base path is set to True, the software uses a string-prefix comparison that fails to enforce directory boundaries. This allows a markdown snippet directive to access files in sibling directories that share the same prefix as the base path. For example, if the base path is /x/docs, an attacker can read files from /x/docs internal/ or /x/docs.bak/ by using path traversal. This issue occurs within the get snippet path() function in pymdownx/snippets.py due to the use of the startswith() method on the filename variable without ensuring a trailing directory separator.
Recommendations Update pymdown-extensions to a version later than 10.21.2. As a temporary mitigation, restrict the use of the pymdownx.snippets extension or ensure that the base path is configured in a way that no sibling directories share the same string prefix.

Exploit

Fix

Path traversal

Found an issue in the description? Have something to add? Feel free to write us 👾

Weakness Enumeration

Related Identifiers

CVE-2026-46338
GHSA-62Q4-447F-WV8H
PYSEC-2026-2999

Affected Products

Pymdown Extensions