{"id":"CVE-2025-27516","published":"2025-03-05T20:40:06Z","modified":"2026-02-26T19:09:45Z","title":"Jinja sandbox breakout through attr filter selecting format method","vendor":"pallets","product":"jinja","tier":"tail","description":{"text":"Jinja is an extensible templating engine. Prior to 3.1.6, an oversight in how the Jinja sandboxed environment interacts with the |attr filter allows an attacker that controls the content of a template to execute arbitrary Python code. To exploit the vulnerability, an attacker needs to control the content of a template. Whether that is the case depends on the type of application using Jinja. This vulnerability impacts users of applications which execute untrusted templates. Jinja's sandbox does catch calls to str.format and ensures they don't escape the sandbox. However, it's possible to use the |attr filter to get a reference to a string's plain format method, bypassing the sandbox. After the fix, the |attr filter no longer bypasses the environment's attribute lookup. This vulnerability is fixed in 3.1.6.","provenance":"source","from":"CVE.org"},"cvss":{"score":5.4,"severity":"MEDIUM","version":"4.0","vector":"CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00593,"percentile":0.4235,"provenance":"source"},"cwes":[{"id":"CWE-1336","name":"Improper Neutralization of Special Elements Used in a Template Engine"}],"references":[{"url":"https://github.com/pallets/jinja/security/advisories/GHSA-cpwx-vrp4-4pq7","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/pallets/jinja/commit/90457bbf33b8662926ae65cdde4c4c32e756e403","tags":["x_refsource_MISC"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/04/msg00045.html","tags":[]},{"url":"https://lists.debian.org/debian-lts-announce/2025/04/msg00022.html","tags":[]}],"priority":{"score":12.2,"factors":[{"name":"EPSS percentile","points":8.47},{"name":"CVSS severity","points":3.78}]},"vendorSlug":"pallets","affectedVersions":[{"vendor":"pallets","product":"jinja","versions":["< 3.1.6"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"total","timestamp":"2025-07-31T03:56:03.356670Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"PyPI","package":"Jinja2","vulnerableRanges":["<3.1.6"],"patched":["3.1.6"],"from":["GHSA-cpwx-vrp4-4pq7","PYSEC-2026-1471"],"provenance":"source"}],"summary":{"text":"Jinja, the Python templating engine from Pallets, contains a sandbox bypass in its handling of the |attr filter, which lets a template reach a string's plain format method and escape the sandbox. An attacker who can supply or control the content of a template can execute arbitrary Python code, but only in local access, low-complexity, and requiring a low-privileged account, user interaction, and an application that renders untrusted templates.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:50:56Z"},"euvd":{"id":"EUVD-2025-6152","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-pallets-jinja-cve-2024-22195","parents":[{"from":"CVE-2024-34064","to":"CVE-2025-27516","relation":"successor","confidence":"high","kind":"lineage","evidence":[{"kind":"version-step","provenance":"source","package":"PyPI:Jinja2","fromFixed":"3.1.4","toFixed":"3.1.6","daysApart":303},{"kind":"same-code","provenance":"machine","files":["src/jinja2/filters.py"],"commits":["https://github.com/pallets/jinja/commit/0668239dc6b44ef38e7a6c9f91f312fd4ca581cb","https://github.com/pallets/jinja/commit/90457bbf33b8662926ae65cdde4c4c32e756e403"],"basis":"rarely changed file"}]},{"from":"CVE-2024-22195","to":"CVE-2025-27516","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["src/jinja2/filters.py"],"commits":["https://github.com/pallets/jinja/commit/716795349a41d4983a9a4771f7d883c96ea17be7","https://github.com/pallets/jinja/commit/90457bbf33b8662926ae65cdde4c4c32e756e403"],"basis":"rarely changed file"}]}],"packageHistory":[{"cve":"CVE-2019-10906","published":"2019-04-06","fixed":"2.10.1","kev":false},{"cve":"CVE-2020-28493","published":"2021-02-01","fixed":"2.11.3","kev":false},{"cve":"CVE-2024-34064","published":"2024-05-06","fixed":"3.1.4","kev":false},{"cve":"CVE-2025-27516","published":"2025-03-05","fixed":"3.1.6","kev":false}],"package":"PyPI:Jinja2"}}