---
id: CVE-2026-102991
title: Mako is a template library written in Python
summary: >-
  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, w…
severity: medium
cvss: 6.5
cvssVector: 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:N'
cwe:
  - CWE-22
vendor: sqlalchemy
product: mako
affected:
  - mako < 1.4.2
published: '2026-09-30'
updated: '2026-09-30'
sourceUpdated: '2026-09-30T20:17:26.973'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2026-102991'
references:
  - url: >-
      https://github.com/sqlalchemy/mako/commit/000ed85e4e48771eff460bf4fc721fb43de80e08
    label: security-advisories@github.com
  - url: 'https://github.com/sqlalchemy/mako/issues/441'
    label: security-advisories@github.com
  - url: 'https://github.com/sqlalchemy/mako/releases/tag/rel_1_4_2'
    label: security-advisories@github.com
  - url: 'https://github.com/sqlalchemy/mako/security/advisories/GHSA-5639-2j2p-m4mx'
    label: security-advisories@github.com
  - url: 'https://github.com/sqlalchemy/mako/security/advisories/GHSA-5639-2j2p-m4mx'
    label: 134c704f-9b21-4f2e-91b3-4a467353bcc0
tags:
  - nvd
  - cve.org
  - exploit-available
exploitAvailable: true
ssvc:
  exploitation: poc
  automatable: 'no'
  technicalImpact: partial
  timestamp: '2026-09-30T19:54:27.628844Z'
ingestedAt: '2026-09-30T20:23:19.513Z'
---

## Overview

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.

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.
