# CVE-2026-46338: facelessuser PyMdown Extensions path traversal in snippets extension

Source: https://junglewise.ai/threats/cve-2026-46338-facelessuser-pymdown-extensions-path-traversal-in-snippets  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-07-16. Updated: 2026-07-16  
License: CC BY 4.0 with a link back

CVE-2026-46338 · Severity: medium · CVSS 4.3 · Published 2026-07-16

PyMdown Extensions is a collection of tools for the Python-Markdown project, commonly used in documentation sites like MkDocs. A security flaw allows a specially crafted Markdown file to read sensitive files from the server that should be restricted. This could lead to the exposure of internal documentation or configuration files if an attacker can submit Markdown content to be processed by a build system.

Technologies: [pymdown-extensions (PyPI)](https://junglewise.ai/threats/technologies/pymdown-extensions). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2026-46338 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-46338 being exploited in the wild.

**How severe is CVE-2026-46338?** Medium severity, with a CVSS score of 4.3, published 16 July 2026.

**Which products and versions are affected?** pymdown-extensions (PyPI) >= 10.0.1, <= 10.21.2, ECOSYSTEM:introduced=10.0.1,fixed=10.21.3.

**Is there a fix for CVE-2026-46338?** Yes. pymdown-extensions (PyPI): upgrade to 10.21.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-46338 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-46338?** Check whether you run pymdown-extensions (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- pymdown-extensions (PyPI): upgrade to 10.21.3 or later

  ```sh
  pip install "pymdown-extensions>=10.21.3"
  ```


## Technical details

A path traversal vulnerability exists in the `pymdownx.snippets` extension due to an improper string-prefix containment check in `SnippetPreprocessor.get_snippet_path()`. When `restrict_base_path` is enabled, the code uses `filename.startswith(base)` to validate paths. Because it fails to enforce a directory boundary (e.g., by appending a trailing slash), an attacker can use a snippet directive to access sibling directories that share the same prefix as the base path (e.g., accessing 'docs_internal' when 'docs' is the base). This is a regression of CVE-2023-32309. The issue is fixed in version 10.21.3 by ensuring the prefix check includes the operating system's path separator.

## Affected products

- facelessuser PyMdown Extensions >= 10.0.1, < 10.21.3

## Identifiers

- CVE-2026-46338
- GHSA-62q4-447f-wv8h
- PYSEC-2026-2999

## Timeline

- 2023-05-15: other: Vulnerability introduced in version 10.0.1 via PR #2039
- 2026-05-13: patched: Fixed in version 10.21.3
- 2026-07-16: advisory: CVE-2026-46338 published

## References

- [https://github.com/facelessuser/pymdown-extensions/commit/63b7835776d703d6c339cf2110d9888f676efc0c](https://github.com/facelessuser/pymdown-extensions/commit/63b7835776d703d6c339cf2110d9888f676efc0c)
- [https://github.com/facelessuser/pymdown-extensions/releases/tag/10.21.3](https://github.com/facelessuser/pymdown-extensions/releases/tag/10.21.3)
- [https://github.com/facelessuser/pymdown-extensions/security/advisories/GHSA-62q4-447f-wv8h](https://github.com/facelessuser/pymdown-extensions/security/advisories/GHSA-62q4-447f-wv8h)

## Related threats

- [facelessuser pymdown-extensions ReDoS in multiple inline processors](https://junglewise.ai/threats/cve-2026-67422-facelessuser-pymdown-extensions-redos-in-multiple-inline)
- [PyMdown Extensions path traversal in b64 extension](https://junglewise.ai/threats/cve-2026-61632-pymdown-extensions-path-traversal-in-b64-extension)
- [PYSEC-2026-1825 - PyMdown Extensions has a ReDOS bug in its Figure Capture extension](https://junglewise.ai/threats/cve-2025-68142-pymdown-extensions-has-a-redos-bug-in-its-figure-capture)
- [PYSEC-2026-1824 - Any file can be included with the pymdown-snippets extension](https://junglewise.ai/threats/cve-2023-32309-any-file-can-be-included-with-the-pymdown-snippets-extension)
