{"id":"CVE-2025-27516","aliases":["CVE-2025-27516","GHSA-cpwx-vrp4-4pq7","PYSEC-2026-1471"],"related":[],"kind":"vulnerability","state":"published","title":"Jinja sandbox breakout through attr filter selecting format method","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","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.","source":"cvelist"},{"lang":"en","text":"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.\n\nTo 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.\n\nJinja'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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Jinja es un motor de plantillas extensible. Antes de la versión 3.1.6, un descuido en la forma en que el entorno aislado de Jinja interactúa con el filtro |attr permite que un atacante que controla el contenido de una plantilla ejecute código Python arbitrario. Para explotar la vulnerabilidad, un atacante debe controlar el contenido de una plantilla. Si ese es el caso depende del tipo de aplicación que utilice Jinja. Esta vulnerabilidad afecta a los usuarios de aplicaciones que ejecutan plantillas no confiables. El entorno aislado de Jinja detecta las llamadas a str.format y garantiza que no escapen del entorno aislado. Sin embargo, es posible utilizar el filtro |attr para obtener una referencia al método de formato simple de una cadena, sin pasar por el entorno aislado. Después de la corrección, el filtro |attr ya no pasa por alto la búsqueda de atributos del entorno. Esta vulnerabilidad se corrigió en la versión 3.1.6.","source":"nvd"}],"published":"2025-03-05T20:40:06.568Z","modified":"2026-11-18T00:45:13.756Z","severity":{"scorer":"GitHub_M","scheme":"CVSS: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","score":5.4,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS: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","score":5.4,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS: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","rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H","score":8.8,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS: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"}],"cwes":["CWE-1336"],"affected":[{"ranges":[{"version":"< 3.1.6","status":"affected"}],"vendor":"pallets","product":"jinja","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.1.6"}],"ecosystem":"PyPI","package":"jinja2","purl":"pkg:pypi/jinja2","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.1.6"}],"vendor":"palletsprojects","product":"jinja","cpe":"cpe:2.3:a:palletsprojects:jinja:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"11.0"}],"vendor":"debian","product":"debian_linux","cpe":"cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.1.6"}],"ecosystem":"PyPI","package":"jinja2","purl":"pkg:pypi/jinja2","source":"pysec"}],"references":[{"url":"https://github.com/pallets/jinja/security/advisories/GHSA-cpwx-vrp4-4pq7","tags":["vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/pallets/jinja/commit/90457bbf33b8662926ae65cdde4c4c32e756e403","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/04/msg00045.html","tags":["mailing-list","third-party-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/04/msg00022.html","tags":["web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-27516","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/pallets/jinja","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://github.com/pallets/jinja/releases/tag/3.1.6","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/jinja2/PYSEC-2026-1471.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://pypi.org/project/jinja2","tags":["package","web"],"sources":["ghsa","pysec"]},{"url":"https://github.com/advisories/GHSA-cpwx-vrp4-4pq7","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2025-07-31T03:56:03.356Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-27516","url":"https://www.cve.org/CVERecord?id=CVE-2025-27516","licence":"CVE Terms of Use","modified":"2026-02-26T19:09:45.280Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-cpwx-vrp4-4pq7","url":"https://github.com/advisories/GHSA-cpwx-vrp4-4pq7","licence":"CC-BY-4.0","modified":"2026-11-18T00:45:13.756Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-27516","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-27516","licence":"Public domain","modified":"2026-06-17T09:03:44.560Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-1471","url":"https://osv.dev/vulnerability/PYSEC-2026-1471","licence":"CC-BY-4.0","modified":"2026-07-07T17:46:43.358Z"}],"updatedAt":"2026-11-25T22:58:55.002Z","epss":{"score":0.00507,"percentile":0.44825,"date":"2026-12-01T12:00:22.000Z"}}