CVE-2026-102991: Mako template library path traversal via drive designator on Windows

CVE-2026-102991 · Severity: medium · CVSS 6.5 · Published 2026-09-30

Mako is a Python template engine used to generate dynamic content in web applications and other systems. On Windows systems running versions before 1.4.2, attackers can bypass path restrictions by crafting template URIs with drive designators, allowing them to read arbitrary files on the same volume and potentially execute template code from outside the intended directory. This could expose sensitive files or lead to remote code execution if attacker-controlled content reaches template processing.

Technologies: Mako (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2026-102991 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-102991 being exploited in the wild.
How severe is CVE-2026-102991?
Medium severity, with a CVSS score of 6.5, published 30 September 2026.
Which products and versions are affected?
Mako (PyPI) <= 1.4.1, ECOSYSTEM:introduced=0,fixed=1.4.2; SQLAlchemy Mako before 1.4.2.
Is there a fix for CVE-2026-102991?
Yes. Mako (PyPI): upgrade to 1.4.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-102991 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-102991?
Check whether you run Mako (PyPI) or SQLAlchemy Mako 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

  • Mako (PyPI): upgrade to 1.4.2 or later
    pip install "Mako>=1.4.2"

Technical details

The vulnerability stems from inconsistent path normalization between TemplateLookup.get_template() which uses posixpath and Template.__init__() which uses os.path (ntpath on Windows). A URI with a drive designator (e.g., "C:/../../secret.txt") bypasses the traversal check because ntpath absorbs the ".." segments after splitting the drive, while posixpath resolves the full path allowing escape from the template root. The flaw affects applications passing untrusted template names or include paths via query strings, form data, or dynamic expressions.

Affected products

  • SQLAlchemy Mako before 1.4.2

Identifiers

  • CVE-2026-102991
  • GHSA-5639-2j2p-m4mx
  • PYSEC-2026-4243

Timeline

  • 2026-09-30: disclosed: CVE-2026-102991 published
  • 2026-09-22: patched: Fix committed to main branch

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.