# CVE-2023-32309: Arbitrary file inclusion with the pymdowm-snippets extension

> Attackers can read arbitrary files on the host via directory traversal in the PyMdown Snippets extension if it processes untrusted user input.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 15 May 2023
- **Updated:** 22 Jan 2025
- **Also known as:** DEBIAN-CVE-2023-32309, GHSA-jh85-wwv9-24hv, PYSEC-2026-1824, UBUNTU-CVE-2023-32309

## What is CVE-2023-32309?

CVE-2023-32309 is a high-severity path traversal vulnerability in facelessuser pymdown-extensions, published on 15 May 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

PyMdown Extensions is a set of extensions for the `Python-Markdown` markdown project. In affected versions an arbitrary file read is possible when using include file syntax. By using the syntax `--8<--"/etc/passwd"` or `--8<--"/proc/self/environ"` the content of these files will be rendered in the generated documentation. Additionally, a path relative to a specified, allowed base path can also be used to render the content of a file outside the specified base paths: `--8<-- "../../../../etc/passwd"`. Within the Snippets extension, there exists a `base_path` option but the implementation is vulnerable to Directory Traversal. The vulnerable section exists in `get_snippet_path(self, path)` lines 155 to 174 in snippets.py. Any readable file on the host where the plugin is executing may have its content exposed. This can impact any use of Snippets that exposes the use of Snippets to external users. It is never recommended to use Snippets to process user-facing, dynamic content. It is designed to process known content on the backend under the control of the host, but if someone were to accidentally enable it for user-facing content, undesired information could be exposed. This issue has been addressed in version 10.0. Users are advised to upgrade. Users unable to upgrade may restrict relative paths by filtering input.

Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

## Which versions are affected by CVE-2023-32309?

3 open source packages ship an affected version, including pymdown-extensions. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `pymdown-extensions` | PyPI | From 1.5 | 10.0 |
| `pymdown-extensions` | PyPI | From 1.5 | 10.0 |
| `pymdown-extensions` | PyPI | From 1.5 | 10.0 |

Products: Facelessuser Pymdown Extensions.

## How do I fix CVE-2023-32309?

Upgrade pymdown-extensions to 10.0 or later.

## Is CVE-2023-32309 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-32309 exists.

Public exploit code:

- Example project illustrating CVE-2023-32309 vulnerability  (github_poc): https://github.com/itlabbet/CVE-2023-32309

## Other vulnerabilities in facelessuser pymdown-extensions

- [CVE-2026-46338](https://insights.sbomify.com/CVE-2026-46338/): Regression in pymdownx.snippets reintroduces sibling-prefix path traversal bypass despite restrict_base_path (medium 4.3)
- [CVE-2025-68142](https://insights.sbomify.com/CVE-2025-68142/): PyMdown Extensions has ReDOS bug in Figure Capture extension (low 2.7)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-32309 and fix it if it is affected.

What it is: CVE-2023-32309 is a high-severity path traversal vulnerability in facelessuser pymdown-extensions, published on 15 May 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-32309 exists.

Affected packages and fixed versions:
- pymdown-extensions (PyPI): affected from 1.5; fixed in 10.0
- pymdown-extensions (PyPI): affected from 1.5; fixed in 10.0
- pymdown-extensions (PyPI): affected from 1.5; fixed in 10.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-32309/ (Markdown: https://insights.sbomify.com/CVE-2023-32309/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-32309
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-32309
- OSV: https://osv.dev/vulnerability/CVE-2023-32309

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-32309/
Summaries are generated and may contain mistakes; the official description above is the record.
