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.
Published: 2026-09-30
Score: 6.5 Medium
EPSS: n/a
KEV: No
Impact: File Disclosure
Action: Immediate Patch
AI Analysis

Impact

The vulnerability is a directory traversal flaw that arises in the Mako template library when a Windows user supplies a URI that begins with a drive designator. In versions prior to 1.4.2, the lookup logic resolves the template path using posixpath, while the validation stage uses ntpath. This mismatch allows an attacker‑controlled template name or include path to escape the intended template directory, read files that are readable by the process, and, if the file contains Mako template syntax, have it parsed and executed as a template. The weakness is a CWE‑22 type input validation error.

Affected Systems

Mako, the Python templating library maintained by SQLAlchemy, is affected in all releases earlier than 1.4.2 when running on Windows. The flaw is specific to Windows file‑system handling and only impacts applications that invoke TemplateLookup.get_template() with untrusted or dynamic URI values.

Risk and Exploitability

The CVSS score of 6.5 places this flaw in the medium severity range. Exploit probability is not reported (EPSS not available) and the vulnerability is not listed in CISA’s KEV catalog, implying that it has not yet been widely exploited. However, the attack requires that an attacker can influence the template name or include path, which can occur in many web applications or services that accept user‑supplied template parameters. If exploit is possible, the attacker can read any process‑readable file on the same volume and potentially trigger template rendering of malicious content, leading to information disclosure and possibly code execution in the context of the running application.

Generated by OpenCVE AI on September 30, 2026 at 22:37 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Mako to version 1.4.2 or later, which removes the path resolution mismatch on Windows
  • Validate or sanitize all template names and include paths, rejecting URIs that begin with a drive letter or contain traversal segments before normalization
  • Configure the application to confine template loading to a strict whitelisted directory and enforce path checks to prevent access outside that directory

Generated by OpenCVE AI on September 30, 2026 at 22:37 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Thu, 01 Oct 2026 07:45:00 +0000

Type Values Removed Values Added
First Time appeared Sqlalchemy
Sqlalchemy mako
Vendors & Products Sqlalchemy
Sqlalchemy mako

Wed, 30 Sep 2026 20:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Wed, 30 Sep 2026 20:00:00 +0000

Type Values Removed Values Added
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.
Title Mako: Path traversal via drive-letter URI on Windows in TemplateLookup
Weaknesses CWE-22
References
Metrics cvssV3_1

{'score': 6.5, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:N'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-09-30T19:54:41.077Z

Reserved: 2026-09-29T20:46:08.334Z

Link: CVE-2026-102991

cve-icon Vulnrichment

Updated: 2026-09-30T19:54:36.683Z

cve-icon NVD

Status : Deferred

Published: 2026-09-30T20:17:26.547

Modified: 2026-09-30T20:17:26.973

Link: CVE-2026-102991

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-10-01T07:30:02Z

Weaknesses
  • CWE-22

    Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')