CVE-2026-41205: Mako: Path traversal via double-slash URI prefix in TemplateLookup
(updated )
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
References
- github.com/advisories/GHSA-v92g-xgxw-vvmm
- github.com/pypa/advisory-database/tree/main/vulns/mako/PYSEC-2026-88.yaml
- github.com/sqlalchemy/mako/commit/e05ac61989a7fb9dd7dcde6cfd72dc48328719a3
- github.com/sqlalchemy/mako/releases/tag/rel_1_3_11
- github.com/sqlalchemy/mako/security/advisories/GHSA-v92g-xgxw-vvmm
- nvd.nist.gov/vuln/detail/CVE-2026-41205
Code Behaviors & Features
Detect and mitigate CVE-2026-41205 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →