Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessIdentify Windows app passing user input to get_template()
-
DeliveryInject drive-designator URI via JSON body or route param
-
Exploitposixpath resolution escapes template directory
-
ExecutionRead process-readable file on same volume
-
ImpactParse/execute file if it contains Mako syntax
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 | Requires ALL of the following: (1) the deployment runs on Windows, because the bug arises from ntpath (os.path on Windows) splitting off a drive designator and absorbing '..' segments before the traversal check, whereas posixpath used by get_template() does not - Linux/macOS deployments are unaffected; (2) the application passes attacker-controlled data into TemplateLookup.get_template() or an include path (dynamic template names, include expressions); (3) the malicious URI (e.g. 'C:/../../../secrets/creds.txt') must reach the lookup un-normalized - the advisory notes raw URL paths are generally normalized, so the viable channels are query strings, form/JSON request bodies, route parameters, and dynamic include expressions; and (4) for code execution (not just file read) the targeted file must reside on the same volume, be process-readable, and contain valid Mako template syntax. Fixed in 1.4.2. Limiting factors: Windows-only, dependency on the application echoing raw user input into template resolution, and same-volume/process-readability constraints on the target file. |
| Impact | This is a genuine but moderate-priority issue, best characterized as a real-but-conditional flaw rather than an urgent widescale threat. The CVSS 3.1 vector (AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:N, 6.5) correctly captures the tension: it is remotely reachable and unauthenticated (PR:N), but carries AC:H because exploitation depends on several stars aligning - the deployment must be on Windows, the application must feed attacker-controlled data into a template name/include path, and the malicious drive-designator URI must survive the application's normalization (the advisory notes raw URL paths are usually normalized, so the realistic vectors are query strings, form/JSON bodies, route parameters, and dynamic include expressions). CISA SSVC aligns with this measured view: Exploitation=poc (proof-of-concept level, not active), Automatable=no (target-specific conditions prevent spray-and-pray), and Technical Impact=partial. SSVC 'poc' plus the released fix/tests indicates publicly available exploit code exists, but there is NO CISA KEV listing and NO EPSS score in the provided data, so there is no evidence of active or widespread exploitation. Signals are internally consistent - no contradictions between CVSS, SSVC, and the description. The primary caveat is platform-scoping: this is exploitable ONLY on Windows deployments, and Mako is very frequently deployed on Linux where the posixpath/ntpath divergence does not exist, which materially shrinks the real-world exposed population below what the network-vector score alone suggests. |
| Exploit ScenarioDerived | A Python web application running Mako on Windows passes a user-supplied value (e.g. a template name from a JSON body, route parameter, or dynamic include expression) into TemplateLookup.get_template(). An unauthenticated attacker submits a URI such as 'C:/../../../secrets/creds.txt'; because get_template() resolves with posixpath while the pre-fix traversal check normalized with ntpath (which absorbs the drive designator before the dot-dot check), the path escapes the template directory and the file is read back, and if that file contains Mako syntax it may be parsed and executed. Proof-of-concept-level exploitation is indicated by SSVC (poc) and the vendor's added regression tests demonstrating the bypass URIs. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Sep 30, 2026
Path traversal in Mako before 1.4.2 on Windows allows an application that passes attacker-controlled template names or include paths to TemplateLookup.get_template() to read process-readable files outside the configured template directory, and in limited cases to parse and execute a targeted same-volume file as a Mako template. The flaw is unauthenticated per the CVSS vector (AV:N/PR:N) but high-complexity (AC:H) because the malicious URI must reach the lookup un-normalized - realistic channels are query strings, form/JSON bodies, route parameters, and dynamic include expressions - and Windows-only, since Linux/macOS use posixpath consistently; publicly available exploit code exists, with no CISA KEV listing. CISA's SSVC rates exploitation as PoC, automatable: no, technical impact partial, making this a real but conditional issue concentrated in Windows deployments that echo raw user input into template resolution.
RemediationAI
Vendor-released patch: upgrade to Mako 1.4.2 or later, which replaces the os.path.normpath validation in Template.__init__() with posixpath.normpath so validation matches the resolver (see GHSA-5639-2j2p-m4mx, issue #441, commit 000ed85e4e48771eff460bf4fc721fb43de80e08, and release rel_1_4_2). Until upgrading, the most effective compensating control is to stop feeding untrusted strings into TemplateLookup.get_template() or include expressions: resolve user-supplied template names through a fixed allowlist or dictionary rather than directly, which removes the tainted sink entirely (trade-off: requires application changes and blocks generic dynamic template naming). A second option is to reject candidate URIs containing '..' segments, backslashes, or a leading drive designator before resolution, or to canonicalize with os.path.realpath and verify the resolved path still has the template directory as a prefix - note that a naive '..' blocklist can break legitimate relative includes, and on Windows realpath-based prefix checks must account for drive-letter and 8.3 short-name quirks. Restricting the process's read permissions and keeping sensitive files off the same volume as the template directory limits the same-volume disclosure and template-execution escalation but does not fix the traversal itself. Exposed query-string, JSON/form-body, and route-parameter inputs should be normalized to safe template identifiers as defense in depth; raw URL paths are already generally normalized before reaching this code.
Affected VersionsENISA
Affected Packages
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 the Python template library maintained by the SQLAlchemy project (CPE vendor: sqlalchemy, product: mako), and CVE-2026-102991 is a CWE-22 path traversal caused by inconsistent path-normalization libraries rather than by a missing check. TemplateLookup.get_template() in mako/lookup.py resolves URIs with posixpath, while Template.__init__() in mako/template.py validated the same URI with os.path - which is ntpath on Windows. Because ntpath treats a leading drive designator (for example 'C:') as a rooted element, it absorbs the following '..' segments before the existing dot-dot check can inspect them, so a URI such as 'C:/../../../secrets/creds.txt' passes validation yet still resolves outside the template root via posixpath. The upstream fix in commit 000ed85e4e48771eff460bf4fc721fb43de80e08 replaces os.path.normpath with posixpath.normpath so validation uses the same module as resolution, and 1.4.2 is the first release containing the change. The accompanying tests parametrize traversal URIs - plain relative traversal, leading-slash prefixes from issues #434/#435, backslash separators, and drive-designator forms - across both posixpath and ntpath to confirm all spellings are refused on both platforms, and the release note explicitly frames this as a bug fix for the TemplateLookup traversal check on Windows.
Know when Mako 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
AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:N
AC:H for the Windows-only, un-normalized attacker-controlled-URI preconditions; PR:N/UI:N as no auth or interaction is needed; C:H for arbitrary same-volume file read, I:L for conditional template execution.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.org
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.
Blast Radius
ecosystem impact- 6 pypi packages depend on mako (5 direct, 1 indirect)
Ecosystem-wide dependent count for version 1.4.2.
Threat Intelligence Overview
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.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.
Sqlalchemy mako before 1.2.2 is vulnerable to Regular expression Denial of Service when using the Lexer class to parse.
Arbitrary file read in Mako (the Python template library maintained under the SQLAlchemy project) affects all versions p
EUVD-2026-90363
GHSA-5639-2j2p-m4mx
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB