CVE-2025-27516

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.
CVSS

No CVSS.

Configurations

No configuration.

History

01 May 2025, 01:15

Type Values Removed Values Added
References
  • () https://lists.debian.org/debian-lts-announce/2025/04/msg00045.html -
Summary
  • (es) 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.

05 Mar 2025, 21:15

Type Values Removed Values Added
New CVE

Information

Published : 2025-03-05 21:15

Updated : 2025-05-01 01:15


NVD link : CVE-2025-27516

Mitre link : CVE-2025-27516

CVE.ORG link : CVE-2025-27516


JSON object : View

Products Affected

No product.

CWE
CWE-1336

Improper Neutralization of Special Elements Used in a Template Engine