Advisories for Pypi/Mako package

2026

Mako: Path traversal via double-slash URI prefix in TemplateLookup

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 / using if/slice TemplateLookup.get_template() strips all leading / using re.sub(r"^/+", "") When a URI like //../../../../etc/passwd is passed: get_template() strips all / → ../../../../etc/passwd → file found via posixpath.join(dir_, u) Template.init strips one / → /../../../../etc/passwd → normpath → /etc/passwd /etc/passwd.startswith(..) → …

Mako: Path traversal via double-slash URI prefix in TemplateLookup

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 / using if/slice TemplateLookup.get_template() strips all leading / using re.sub(r"^/+", "") When a URI like //../../../../etc/passwd is passed: get_template() strips all / → ../../../../etc/passwd → file found via posixpath.join(dir_, u) Template.init strips one / → /../../../../etc/passwd → normpath → /etc/passwd /etc/passwd.startswith(..) → …

2022

Mako contains Cross-site Scripting vulnerability

Mako before 0.3.4 relies on the cgi.escape function in the Python standard library for cross-site scripting (XSS) protection, which makes it easier for remote attackers to conduct XSS attacks via vectors involving single-quote characters and a JavaScript onLoad event handler for a BODY element.