CVE-2026-41205 — mako
Fix: sqlalchemy/mako@e05ac61CVE-2026-41205 is a Path Traversal vulnerability in mako. A fix is available for mako — see the affected versions and patch details below.
Mako: Path traversal via double-slash URI prefix in TemplateLookup
Exploitation Status
No confirmed exploitation observed yet
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for CVE-2026-41205.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
Real-World Exposure
makoReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
Summary
TemplateLookup.get_template() is vulnerable to path traversal when a URI starts with // (e.g., //../../../secret.txt). The root cause is an inconsistency between two slash-stripping implementations:
Template.__init__strips one leading/usingif/sliceTemplateLookup.get_template()strips all leading/usingre.sub(r"^\/+", "")
When a URI like //../../../../etc/passwd is passed:
get_template()strips all/→../../../../etc/passwd→ file found viaposixpath.join(dir_, u)Template.__init__strips one/→/../../../../etc/passwd→normpath→/etc/passwd/etc/passwd.startswith(..) →False→ check bypassed
Impact
Arbitrary file read: any file readable by the process can be returned as rendered template content when an application passes untrusted input directly to TemplateLookup.get_template().
Note: this is exploitable at the library API level. HTTP-based exploitation is mitigated by Python's BaseHTTPRequestHandler which normalizes double-slash prefixes since CPython gh-87389. Applications using other HTTP servers that do not normalize paths may be affected.
Fix
Changed Template.__init__ to use lstrip("/") instead of stripping only a single leading slash, so both code paths handle leading slashes consistently.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | mako | all versions | 1.3.11pip install --upgrade 'mako==1.3.11' |
Affected Products
makosqlalchemyDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for mako, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update mako to 1.3.11 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-41205 is resolved across your whole dependency graph.
Workarounds
Resolve every user-supplied path to its canonical form and reject anything that escapes the intended directory, and run the component under an account that has no read or write access outside the directory it legitimately serves.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
To mitigate this issue, applications utilizing the Mako template library must validate and sanitize all input before passing it to the `TemplateLookup.get_template()` function. Implementing robust input validation routines within applications will prevent specially crafted URIs from traversing outside intended directories and accessing sensitive files.Source: Red Hat security advisory for CVE-2026-41205 (CC BY 4.0)
Frequently Asked Questions
Is CVE-2026-41205 in your dependencies?
Find it across PyPI, including transitive dependencies.