CVE-2026-102991
Description
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.
References
- https://github.com/sqlalchemy/mako/commit/000ed85e4e48771eff460bf4fc721fb43de80e08
- https://github.com/sqlalchemy/mako/issues/441
- https://github.com/sqlalchemy/mako/releases/tag/rel_1_4_2
- https://github.com/sqlalchemy/mako/security/advisories/GHSA-5639-2j2p-m4mx
- https://github.com/sqlalchemy/mako/security/advisories/GHSA-5639-2j2p-m4mx