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
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 →