ADVISORIES

Red Hat VEX

RHVEX-CVE-2025-27516

jinja2: Jinja sandbox breakout through attr filter selecting format method

Important No fix available CVE-2025-27516

Details

A flaw was found in Jinja. In affected versions, an oversight in how the Jinja sandboxed environment interacts with the |attr filter allows an attacker who 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 that 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.

Affected packages

EcosystemPackageAffected versions
Red Hat:enterprise_linux:6python-jinja2
All versions, no fix (out of support scope)

References