CVE-2025-27516Jinja sandbox breakout through attr filter selecting format method
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.
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
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.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 24.04 | jinja2 | Fixed | 3.1.2-1ubuntu1.3 | UBUNTU-CVE-2025-27516 |
| Ubuntu 22.04 | jinja2 | Fixed | 3.0.3-1ubuntu0.4 | UBUNTU-CVE-2025-27516 |
| Ubuntu 20.04 | jinja2 | Fixed | 2.10.1-2ubuntu0.5 | UBUNTU-CVE-2025-27516 |
| Ubuntu 18.04 | jinja2 | Fix pending | 2.10-1ubuntu0.18.04.1+esm4 (Ubuntu Pro) | UBUNTU-CVE-2025-27516 |
| Ubuntu 16.04 | jinja2 | Fix pending | 2.8-1ubuntu0.1+esm5 (Ubuntu Pro) | UBUNTU-CVE-2025-27516 |
| Ubuntu 14.04 | jinja2 | Fix pending | 2.7.2-2ubuntu0.1~esm6 (Ubuntu Pro) | UBUNTU-CVE-2025-27516 |
| Debian 14 | jinja2 | Fixed | 3.1.6-1 | DEBIAN-CVE-2025-27516 |
| Debian 13 | jinja2 | Fixed | 3.1.6-1 | DEBIAN-CVE-2025-27516 |
| Debian 12 | jinja2 | Fixed | 3.1.2-1+deb12u3 | DEBIAN-CVE-2025-27516 |
| Red Hat Enterprise Linux 10 | python-jinja2 | Fixed | 0:3.1.6-1.el10_0 | RHSA-2025:7476 |
| Red Hat Enterprise Linux 10 | python3-jinja2 | Fixed | 0:3.1.6-1.el10_0 | RHSA-2025:7476 |
| Red Hat Enterprise Linux 10 | python3-jinja2+i18n | Fixed | 0:3.1.6-1.el10_0 | RHSA-2025:7476 |
| Red Hat Enterprise Linux 9 | fence-agents | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-aliyun | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-all | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-amt-ws | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-apc | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-apc-snmp | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-aws | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-azure-arm | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-bladecenter | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-brocade | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-cisco-mds | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-cisco-ucs | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-common | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-compute | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-drac5 | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-eaton-snmp | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-emerson | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-eps | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-gce | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-heuristics-ping | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-hpblade | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-ibm-powervs | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-ibm-vpc | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-ibmblade | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-ifmib | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-ilo-moonshot | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-ilo-mp | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-ilo-ssh | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-ilo2 | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-intelmodular | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-ipdu | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-ipmilan | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-kdump | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-kubevirt | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-lpar | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-mpath | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-openstack | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-redfish | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-rhevm | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-rsa | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-rsb | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-sbd | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-scsi | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-virsh | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-vmware-rest | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-vmware-soap | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-wti | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-agents-zvm | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-virt | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-virtd | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-virtd-cpg | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-virtd-libvirt | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-virtd-multicast | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-virtd-serial | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | fence-virtd-tcp | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | ha-cloud-support | Fixed | 0:4.10.0-76.el9_5.6 | RHSA-2025:3113 |
| Red Hat Enterprise Linux 9 | python-jinja2 | Fixed | 0:2.11.3-8.el9_5 | RHSA-2025:3406 |
| Red Hat Enterprise Linux 9 | python3-jinja2 | Fixed | 0:2.11.3-8.el9_5 | RHSA-2025:3406 |
| Red Hat Enterprise Linux 8 | python-jinja2 | Fixed | 0:2.10.1-7.el8_10 | RHSA-2025:3388 |
| Red Hat Enterprise Linux 8 | python3-jinja2 | Fixed | 0:2.10.1-7.el8_10 | RHSA-2025:3388 |
| Red Hat Enterprise Linux 7 | python-jinja2 | Not affected | ||
| Red Hat Enterprise Linux 6 | python-jinja2 | Will not fix Out of support scope | ||
| AlmaLinux 10 | python3-jinja2 | Fixed | 3.1.6-1.el10_0 | ALSA-2025:7476 |
| AlmaLinux 10 | python3-jinja2+i18n | Fixed | 3.1.6-1.el10_0 | ALSA-2025:7476 |
| AlmaLinux 9 | python3-jinja2 | Fixed | 2.11.3-8.el9_5 | ALSA-2025:3406 |
| AlmaLinux 8 | python3-jinja2 | Fixed | 2.10.1-7.el8_10 | ALSA-2025:3388 |
| Rocky Linux 10 | python-jinja2 | Fixed | 0:3.1.6-1.el10_0 | RLSA-2025:7476 |
| Rocky Linux 9 | fence-agents | Fixed | 0:4.10.0-76.el9_5.6 | RLSA-2025:3113 |
| Rocky Linux 9 | python-jinja2 | Fixed | 0:2.11.3-8.el9_5 | RLSA-2025:3406 |
| Rocky Linux 8 | python-jinja2 | Fixed | 0:2.10.1-7.el8_10 | RLSA-2025:3388 |
| Alpine Linux 3.24 | py3-jinja2 | Fixed | 3.1.6-r0 | ALPINE-CVE-2025-27516 |
| Alpine Linux 3.23 | py3-jinja2 | Fixed | 3.1.6-r0 | ALPINE-CVE-2025-27516 |
| Alpine Linux 3.22 | py3-jinja2 | Fixed | 3.1.6-r0 | ALPINE-CVE-2025-27516 |
| Alpine Linux 3.21 | py3-jinja2 | Fixed | 3.1.6-r0 | ALPINE-CVE-2025-27516 |
| Alpine Linux 3.20 | py3-jinja2 | Fixed | 3.1.6-r0 | ALPINE-CVE-2025-27516 |
| Alpine Linux 3.19 | py3-jinja2 | Fixed | 3.1.6-r0 | ALPINE-CVE-2025-27516 |
| Alpine Linux 3.18 | py3-jinja2 | Fixed | 3.1.6-r0 | ALPINE-CVE-2025-27516 |
| PyPI library | jinja2 | Fixed | 3.1.6 | PYSEC-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.
- pallets jinja: affected: < 3.1.6
References
- https://github.com/pallets/jinja/security/advisories/GHSA-cpwx-vrp4-4pq7
- https://github.com/pallets/jinja/commit/90457bbf33b8662926ae65cdde4c4c32e756e403
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.