CVEfocus › CVE database › CVE-2025-27516

CVE-2025-27516Jinja sandbox breakout through attr filter selecting format method

CVSS 5.4 MediumEPSS 0.6% (higher than 42% of CVEs)Published 2025-03-05Updated 2026-02-26Assigner: GitHub_M

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.

CWE-1336

What to do

Fixed builds are available from AlmaLinux, Alpine, Debian, PyPI, Red Hat, Rocky Linux, Ubuntu: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

85Fixed
3Fix pending
1Will not fix
1Not affected

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 24.04jinja2Fixed3.1.2-1ubuntu1.3UBUNTU-CVE-2025-27516
Ubuntu 22.04jinja2Fixed3.0.3-1ubuntu0.4UBUNTU-CVE-2025-27516
Ubuntu 20.04jinja2Fixed2.10.1-2ubuntu0.5UBUNTU-CVE-2025-27516
Ubuntu 18.04jinja2Fix pending2.10-1ubuntu0.18.04.1+esm4 (Ubuntu Pro)UBUNTU-CVE-2025-27516
Ubuntu 16.04jinja2Fix pending2.8-1ubuntu0.1+esm5 (Ubuntu Pro)UBUNTU-CVE-2025-27516
Ubuntu 14.04jinja2Fix pending2.7.2-2ubuntu0.1~esm6 (Ubuntu Pro)UBUNTU-CVE-2025-27516
Debian 14jinja2Fixed3.1.6-1DEBIAN-CVE-2025-27516
Debian 13jinja2Fixed3.1.6-1DEBIAN-CVE-2025-27516
Debian 12jinja2Fixed3.1.2-1+deb12u3DEBIAN-CVE-2025-27516
Red Hat Enterprise Linux 10python-jinja2Fixed0:3.1.6-1.el10_0RHSA-2025:7476
Red Hat Enterprise Linux 10python3-jinja2Fixed0:3.1.6-1.el10_0RHSA-2025:7476
Red Hat Enterprise Linux 10python3-jinja2+i18nFixed0:3.1.6-1.el10_0RHSA-2025:7476
Red Hat Enterprise Linux 9fence-agentsFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-aliyunFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-allFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-amt-wsFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-apcFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-apc-snmpFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-awsFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-azure-armFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-bladecenterFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-brocadeFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-cisco-mdsFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-cisco-ucsFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-commonFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-computeFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-drac5Fixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-eaton-snmpFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-emersonFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-epsFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-gceFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-heuristics-pingFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-hpbladeFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-ibm-powervsFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-ibm-vpcFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-ibmbladeFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-ifmibFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-ilo-moonshotFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-ilo-mpFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-ilo-sshFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-ilo2Fixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-intelmodularFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-ipduFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-ipmilanFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-kdumpFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-kubevirtFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-lparFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-mpathFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-openstackFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-redfishFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-rhevmFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-rsaFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-rsbFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-sbdFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-scsiFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-virshFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-vmware-restFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-vmware-soapFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-wtiFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-agents-zvmFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-virtFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-virtdFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-virtd-cpgFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-virtd-libvirtFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-virtd-multicastFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-virtd-serialFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9fence-virtd-tcpFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9ha-cloud-supportFixed0:4.10.0-76.el9_5.6RHSA-2025:3113
Red Hat Enterprise Linux 9python-jinja2Fixed0:2.11.3-8.el9_5RHSA-2025:3406
Red Hat Enterprise Linux 9python3-jinja2Fixed0:2.11.3-8.el9_5RHSA-2025:3406
Red Hat Enterprise Linux 8python-jinja2Fixed0:2.10.1-7.el8_10RHSA-2025:3388
Red Hat Enterprise Linux 8python3-jinja2Fixed0:2.10.1-7.el8_10RHSA-2025:3388
Red Hat Enterprise Linux 7python-jinja2Not affected
Red Hat Enterprise Linux 6python-jinja2Will not fix
Out of support scope
AlmaLinux 10python3-jinja2Fixed3.1.6-1.el10_0ALSA-2025:7476
AlmaLinux 10python3-jinja2+i18nFixed3.1.6-1.el10_0ALSA-2025:7476
AlmaLinux 9python3-jinja2Fixed2.11.3-8.el9_5ALSA-2025:3406
AlmaLinux 8python3-jinja2Fixed2.10.1-7.el8_10ALSA-2025:3388
Rocky Linux 10python-jinja2Fixed0:3.1.6-1.el10_0RLSA-2025:7476
Rocky Linux 9fence-agentsFixed0:4.10.0-76.el9_5.6RLSA-2025:3113
Rocky Linux 9python-jinja2Fixed0:2.11.3-8.el9_5RLSA-2025:3406
Rocky Linux 8python-jinja2Fixed0:2.10.1-7.el8_10RLSA-2025:3388
Alpine Linux 3.24py3-jinja2Fixed3.1.6-r0ALPINE-CVE-2025-27516
Alpine Linux 3.23py3-jinja2Fixed3.1.6-r0ALPINE-CVE-2025-27516
Alpine Linux 3.22py3-jinja2Fixed3.1.6-r0ALPINE-CVE-2025-27516
Alpine Linux 3.21py3-jinja2Fixed3.1.6-r0ALPINE-CVE-2025-27516
Alpine Linux 3.20py3-jinja2Fixed3.1.6-r0ALPINE-CVE-2025-27516
Alpine Linux 3.19py3-jinja2Fixed3.1.6-r0ALPINE-CVE-2025-27516
Alpine Linux 3.18py3-jinja2Fixed3.1.6-r0ALPINE-CVE-2025-27516
PyPI libraryjinja2Fixed3.1.6PYSEC-2026-1471

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.