Skip to main content

Mako Templates CVE-2026-44307

HIGH
Path Traversal (CWE-22)
2026-05-06 https://github.com/sqlalchemy/mako GHSA-2h4p-vjrc-8xpq
8.7
CVSS 4.0 · Vendor: https://github.com/sqlalchemy/mako
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Access Windows-hosted application
  2. Delivery
    Submit backslash traversal URI (e.g., \..\..\ secret.txt)
  3. Exploit
    Bypass posixpath validation
  4. Execution
    Trigger ntpath resolution in Template.__init__
  5. Persist
    Read arbitrary file via os.path.isfile()
  6. Impact
    Disclose file contents in response

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK

2 techniques across 2 tactics: Discovery, Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires Windows operating system deployment of the Mako library. The application must pass attacker-controlled or attacker-influenced data as the 'uri' parameter to TemplateLookup.get_template() or directly to Template class constructors. Attack complexity is low once these conditions are met - no special configuration beyond default Mako usage is required. The vulnerability does NOT affect Linux/Unix deployments due to consistent POSIX path handling. Application architecture must expose template name selection to external input (HTTP parameters, API requests, file upload filenames used as template identifiers). Exploitation is limited by the filesystem read permissions of the Python process user - only files readable by the application can be disclosed. No authentication bypass is inherent to the vulnerability itself; exploitation occurs within the authenticated session context if the vulnerable code path is behind authentication.

Impact

Real-world risk is moderate and highly context-dependent. Exploitation requires three specific conditions: (1) Windows deployment, (2) user-controlled template names passed to TemplateLookup.get_template(), and (3) attacker knowledge of target file paths. The attack vector is local (requires application access, not remote network exploitation), but privileges required are only those of the application user. Primary impact is confidentiality breach through arbitrary file disclosure within the application's filesystem access scope. Secondary risk exists if disclosed files contain Mako/Python syntax, enabling template injection and potential code execution. No CVSS score is provided in NVD data, and no EPSS/KEV signals exist, suggesting this has not been widely exploited. However, the straightforward exploitation path (simple URI manipulation) and availability of detailed technical description in the GitHub advisory mean sophisticated attackers could easily weaponize this against vulnerable deployments. The narrow attack surface (Windows-only, requires specific coding pattern) limits broad internet-scale exploitation but creates concentrated risk for Windows-hosted Python web applications using Mako with user-supplied template paths. Patch availability in version 1.3.12 provides clear remediation path.

Exploit ScenarioDerived

An attacker identifies a Python web application on Windows Server using Mako Templates where a URL parameter controls template selection (e.g., /render?template=header.html). The attacker crafts a request with template=\..\..\..\..\.\Windows\System32\drivers\etc\hosts to traverse from the template directory to system files. Mako's posixpath normalization fails to detect the backslash traversal, and Windows ntpath resolves the path outside the template root. The application returns the contents of the hosts file. If the attacker can identify files containing Mako syntax (like Python configuration files with ${} expressions), template execution could lead to code execution under the application's security context.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – May 06, 2026

Path traversal in Mako Templates (Python library) on Windows platforms allows attackers to read arbitrary files outside configured template directories via backslash-based directory traversal sequences. Affects Mako versions ≤1.3.11 when applications accept user-controlled template names on Windows systems. Vendor-released patch available in version 1.3.12 (confirmed by GitHub commit 72e10c5). No public exploit code identified at time of analysis, though exploitation conditions are straightforward when prerequisites are met.

RemediationAI

Upgrade to Mako 1.3.12 or later, which normalizes backslashes to forward slashes early in URI processing (confirmed fix in commit 72e10c573ca0fbcbddd4455abca8ce92a61780d7, release tag rel_1_3_12 at https://github.com/sqlalchemy/mako/releases/tag/rel_1_3_12). If immediate upgrade is not feasible, implement input validation to reject or sanitize template URIs containing backslash characters before passing to TemplateLookup.get_template() - use uri.replace('\\', '/') or reject URIs matching regex pattern containing backslashes. Note this workaround may break legitimate use cases if applications intentionally use backslash-containing template names. As defense-in-depth, restrict filesystem permissions on the Python application service account to minimize exposure of sensitive files, and avoid designing application features that allow end-user control of template selection parameters. Audit existing code for patterns where HTTP parameters, form inputs, or external data sources flow into template lookup calls.

Affected Packages

pypi mako fix: 1.3.12

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Mako is a widely-used Python template engine in the SQLAlchemy ecosystem (pkg:pip/mako). This vulnerability exploits a platform-specific behavioral gap between Python's posixpath module (used for URI normalization in TemplateLookup.get_template()) and os.path/ntpath (used for filesystem operations on Windows). The posixpath module treats backslashes as literal characters rather than path separators, allowing traversal sequences like '\..\..' to pass validation undetected. When the URI reaches Template.__init__(), Windows' ntpath.normpath() collapses the backslash traversal to a form that bypasses the startswith('..') security check, then os.path.isfile() resolves the actual filesystem path using Windows path semantics. This is classified as CWE-22 (Improper Limitation of a Pathname to a Restricted Directory), a classic path traversal vulnerability arising from inconsistent path handling across platform-specific modules within the same codebase.

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/sqlalchemy/mako) PRIMARY 8.7 HIGH
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
SUSE HIGH
Red Hat 5.9 MEDIUM

Primary rating from Vendor (https://github.com/sqlalchemy/mako).

CVSS VectorVendor: https://github.com/sqlalchemy/mako

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
None
Vulnerable system: Availability
None
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

2
CVSS changed
May 12, 2026 - 22:22 NVD
8.7 (HIGH)
CVE Published
May 06, 2026 - 21:45 nvd
HIGH

DescriptionCVE.org

Summary

On Windows, a URI using backslash traversal (e.g. \..\..\ secret.txt) bypasses the directory traversal check in Template.__init__ and the posixpath-based normalization in TemplateLookup.get_template(), allowing reads of files outside the configured template directory.

Details

The root cause is a mismatch between posixpath (used for URI normalization in get_template()) and os.path (used for file access via os.path.isfile() and validation via os.path.normpath() in Template.__init__). On Windows, os.path is ntpath, which treats \ as a path separator, while posixpath treats it as a literal character.

The vulnerability chain:

  1. get_template() strips only leading / via re.sub(r"^\/+", "", uri) and normalizes with posixpath - backslash \ is treated as a literal character, so \..\ secret.txt passes through with .. undetected.
  2. Template.__init__() validation uses os.path.normpath() - on Windows this resolves \..\ secret.txt to \secret.txt, which does not start with .., so the startswith("..") check passes.
  3. os.path.isfile() on Windows interprets \ as a path separator, resolving the .. traversal and finding files outside the template directory.

Affected code

  • mako/lookup.py: TemplateLookup.get_template() uses posixpath.normpath/posixpath.join for path construction but os.path.isfile() for existence check
  • mako/template.py: Template.__init__() URI validation uses os.path.normpath() which on Windows resolves backslash traversal to a form that passes the startswith("..") guard

Impact

If an application passes user-controlled template names or include paths to TemplateLookup.get_template(), an attacker on Windows may be able to load and disclose readable files outside the configured template directory. The primary impact is local file disclosure. If the targeted file contains Mako/Python template syntax, it may also be parsed and executed as a template.

Remediation

The fix should normalize backslashes to forward slashes early in the URI processing pipeline, before any path operations, to ensure consistent behavior across platforms.

Executive ViewAI

Why It Matters

Mako Templates version 1.3.11 and earlier on Windows systems contain a path traversal vulnerability that allows attackers to read arbitrary files if applications accept user-controlled template names. Organizations using Mako for dynamic template rendering with untrusted input face unauthorized data access and potential exposure of sensitive application files.

Business Impact: High
Compensating Controls

Apply vendor patch. If immediate patching is not feasible: (1) Implement strict input validation to reject template names containing backslashes or path traversal sequences; (2) Enforce allowlisting of permitted template names; (3) Run Mako template processing with minimal filesystem permissions; (4) Disable user-supplied template name functionality until patching is complete.

Threat Intelligence Overview

EPSS Score
0.2%
Top 56% exploitable
Threat Intel
1
1 sources
Data Quality
5 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact
High

Priority Score

44
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +44
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.

Affected Products (CPE)CVE.org

pkg:pip/mako

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

Vendor StatusVendor

SUSE

Severity: High
Product Status
SUSE Linux Enterprise Desktop 15 SP7 Fixed
SUSE Linux Enterprise High Performance Computing 15 SP7 Fixed
SUSE Linux Enterprise Module for Python 3 15 SP7 Fixed
SUSE Linux Enterprise Server 15 SP7 Fixed
SUSE Linux Enterprise Server 16.0 Fixed

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy