{"id":"CVE-2026-41205","aliases":["CVE-2026-41205","GHSA-v92g-xgxw-vvmm","PYSEC-2026-88"],"related":[],"kind":"vulnerability","state":"published","title":"Mako: Path traversal via double-slash URI prefix in TemplateLookup","summary":"Mako is a template library written in Python. Prior to 1.3.11, 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. Any file readable by the process can be returned as rendered template content when an application passes untrusted input directly to TemplateLookup.get_template(). This vulnerability is fixed in 1.3.11.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Mako is a template library written in Python. Prior to 1.3.11, 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. Any file readable by the process can be returned as rendered template content when an application passes untrusted input directly to TemplateLookup.get_template(). This vulnerability is fixed in 1.3.11.","source":"cvelist"},{"lang":"en","text":"### Summary\n\n`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:\n\n- `Template.__init__` strips **one** leading `/` using `if`/slice\n- `TemplateLookup.get_template()` strips **all** leading `/` using `re.sub(r\"^\\/+\", \"\")`\n\nWhen a URI like `//../../../../etc/passwd` is passed:\n1. `get_template()` strips all `/` → `../../../../etc/passwd` → file found via `posixpath.join(dir_, u)`\n2. `Template.__init__` strips one `/` → `/../../../../etc/passwd` → `normpath` → `/etc/passwd`\n3. `/etc/passwd`.startswith(`..`) → `False` → **check bypassed**\n\n### Impact\n\nArbitrary 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()`.\n\nNote: 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.\n\n### Fix\n\nChanged `Template.__init__` to use `lstrip(\"/\")` instead of stripping only a single leading slash, so both code paths handle leading slashes consistently.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Mako es una biblioteca de plantillas escrita en Python. Antes de la versión 1.3.11, TemplateLookup.get_template() es vulnerable a salto de ruta cuando una URI comienza con // (p. ej., //.. / .. / .. / secret.txt). La causa raíz es una inconsistencia entre dos implementaciones de eliminación de barras diagonales. Cualquier archivo legible por el proceso puede ser devuelto como contenido de plantilla renderizado cuando una aplicación pasa entrada no confiable directamente a TemplateLookup.get_template(). Esta vulnerabilidad está corregida en la versión 1.3.11.","source":"nvd"}],"published":"2026-04-16T21:16:40.000Z","modified":"2026-10-26T21:10:00.170Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:P","score":7.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:P","score":7.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:P","rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-22"],"affected":[{"ranges":[{"version":"< 1.3.11","status":"affected"}],"vendor":"sqlalchemy","product":"mako","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.3.11"}],"ecosystem":"PyPI","package":"mako","purl":"pkg:pypi/mako","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.3.11"}],"vendor":"sqlalchemy","product":"mako","cpe":"cpe:2.3:a:sqlalchemy:mako:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.3.11"}],"ecosystem":"PyPI","package":"mako","purl":"pkg:pypi/mako","source":"pysec"}],"references":[{"url":"https://github.com/sqlalchemy/mako/security/advisories/GHSA-v92g-xgxw-vvmm","tags":["advisory","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/sqlalchemy/mako/commit/e05ac61989a7fb9dd7dcde6cfd72dc48328719a3","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/sqlalchemy/mako/releases/tag/rel_1_3_11","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41205","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/mako/PYSEC-2026-88.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/sqlalchemy/mako","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-04-23T20:20:51.233Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-41205","url":"https://www.cve.org/CVERecord?id=CVE-2026-41205","licence":"CVE Terms of Use","modified":"2026-05-20T01:32:18.382Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-v92g-xgxw-vvmm","url":"https://github.com/advisories/GHSA-v92g-xgxw-vvmm","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:03.377Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-41205","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41205","licence":"Public domain","modified":"2026-10-26T21:10:00.170Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-88","url":"https://osv.dev/vulnerability/PYSEC-2026-88","licence":"CC-BY-4.0","modified":"2026-05-20T09:19:06.232Z"}],"updatedAt":"2026-11-25T22:59:19.406Z","epss":{"score":0.00375,"percentile":0.33532,"date":"2026-12-01T12:00:22.000Z"}}