# CVE-2026-102991: Mako: Path traversal via drive-letter URI on Windows in TemplateLookup

> Attackers can exploit path traversal in Mako on Windows to read arbitrary files or execute code via crafted template URIs.

- **Severity:** Medium 6.5 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/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:** 30 Sep 2026
- **Updated:** 30 Sep 2026
- **Also known as:** AZL-105645, CLEANSTART-2026-RY75386, CLEANSTART-2026-XA70442, ECHO-ad96-000e-33ae, GHSA-5639-2j2p-m4mx, MINI-56m4-2j5m-wh29, MINI-8884-w928-384w, MINI-9hjp-86h3-mp97, MINI-m8rj-v8mg-jfpf, MINI-q9qr-h686-x5r9, MINI-qjjj-79mx-65rp, MINI-vmh7-926c-3jcx, PYSEC-2026-4243, UBUNTU-CVE-2026-102991

## What is CVE-2026-102991?

CVE-2026-102991 is a medium-severity path traversal vulnerability in sqlalchemy mako, published on 30 Sep 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Mako is a template library written in Python. Prior to 1.4.2, on Windows, TemplateLookup.get_template() in mako/lookup.py resolves template URIs with posixpath, while Template.__init__() in mako/template.py validates them with os.path, which uses ntpath. A URI beginning with a drive designator causes ntpath to absorb the traversal segments before the leading dot-dot check, while posixpath resolution can escape the configured template directory. An application that passes attacker-controlled template names or include paths can disclose process-readable files on the same volume, and a targeted file containing Mako template syntax may also be parsed and executed as a template. Raw URL paths are generally normalized before reaching this form, but query strings, form or JSON bodies, route parameters, and dynamic include expressions can preserve it. This issue is fixed in version 1.4.2.

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

## Which versions are affected by CVE-2026-102991?

3 open source packages ship an affected version, including mako and Mako.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `mako` | PyPI | All versions | 1.4.2 |
| `mako` | PyPI | All versions | 1.4.2 |
| `Mako` | PyPI | All versions | 1.4.2 |

## How do I fix CVE-2026-102991?

Upgrade mako to 1.4.2 or later.

## Is CVE-2026-102991 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-102991 and fix it if it is affected.

What it is: CVE-2026-102991 is a medium-severity path traversal vulnerability in sqlalchemy mako, published on 30 Sep 2026. 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-2026-102991 exists.

Affected packages and fixed versions:
- mako (PyPI): affected all versions; fixed in 1.4.2
- mako (PyPI): affected all versions; fixed in 1.4.2
- Mako (PyPI): affected all versions; fixed in 1.4.2

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-2026-102991/ (Markdown: https://insights.sbomify.com/CVE-2026-102991/index.md)
```

## Sources

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

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