Skip to content
OpenAdvisories

Description

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.

Affected products

VendorProductAffectedFixed
pallets jinja < 3.1.6 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 jinja2 3.1.6-1 —
Debian 13 jinja2 3.1.6-1 —
Debian 12 jinja2 3.1.2-1+deb12u3 —
Debian 11 jinja2 2.11.3-1+deb11u3 DLA-4126-1
ReleasePackageFixed inAdvisory
Ubuntu 24.04 LTS jinja2 3.1.2-1ubuntu1.3 USN-7343-1
Ubuntu 22.04 LTS jinja2 3.0.3-1ubuntu0.4 USN-7343-1
Ubuntu 20.04 LTS jinja2 2.10.1-2ubuntu0.5 USN-7343-1
Show 3 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 18.04 LTS jinja2 2.10-1ubuntu0.18.04.1+esm4 USN-7343-1
Ubuntu Pro 16.04 LTS jinja2 2.8-1ubuntu0.1+esm5 USN-7343-1
Ubuntu Pro 14.04 LTS jinja2 2.7.2-2ubuntu0.1~esm6 USN-7343-1
ReleasePackageFixed inAdvisory
RHEL 10 python-jinja2 +2 3.1.6-1.el10_0 RHSA-2025:7476
RHEL 9 fence-virt +55 4.10.0-76.el9_5.6 RHSA-2025:3113
RHEL 9 python-jinja2 +1 2.11.3-8.el9_5 RHSA-2025:3406
RHEL 8 python-jinja2 +1 2.10.1-7.el8_10 RHSA-2025:3388
Show 16 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
RHEL 9.4 EUS fence-virt +55 4.10.0-62.el9_4.11 RHSA-2025:2688
RHEL 9.4 EUS python-jinja2 +1 2.11.3-7.el9_4 RHSA-2025:3586
RHEL 9.2 EUS fence-virt +55 4.10.0-43.el9_2.12 RHSA-2025:3111
RHEL 9.2 EUS python-jinja2 +1 2.11.3-5.el9_2 RHSA-2025:3585
RHEL 9.0 E4S fence-virt +56 4.10.0-20.el9_0.21 RHSA-2025:3017
RHEL 9.0 E4S python-jinja2 +1 2.11.3-5.el9_0 RHSA-2025:3588
RHEL 8.8 EUS python-jinja2 +1 2.10.1-5.el8_8 RHSA-2025:3580
RHEL 8.6 TUS python-jinja2 +1 2.10.1-4.el8_6.2 RHSA-2025:3622
RHEL 8.6 E4S python-jinja2 +1 2.10.1-4.el8_6.2 RHSA-2025:3622
RHEL 8.6 AUS python-jinja2 +1 2.10.1-4.el8_6.2 RHSA-2025:3622
RHEL 8.4 TUS python-jinja2 +1 2.10.1-2.el8_4.2 RHSA-2025:3562
RHEL 8.4 E4S python-jinja2 +1 2.10.1-2.el8_4.2 RHSA-2025:3562
RHEL 8.4 AUS python-jinja2 +1 2.10.1-2.el8_4.2 RHSA-2025:3562
RHEL 8.2 AUS python-jinja2 +1 2.10.1-2.el8_2.4 RHSA-2025:3671
Red Hat OpenStack 17 openstack-ansible-core 2.14.2-4.7.el9ost RHSA-2025:3371
Red Hat Hardened Images 1 python-jinja2 +2 3.1.6-10.1.hum1 RHSA-2026:43940
Red Hat Ansible Automation Platform Inside 2 python-jinja2 +1 3.1.6-1.el9ap RHSA-2025:3123
Red Hat Ansible Automation Platform Inside 2 python39-jinja2 +2 3.1.6-1.el8ap RHSA-2025:3160, RHSA-2025:3123
Red Hat Ansible Automation Platform Developer 2 python-jinja2 +1 3.1.6-1.el9ap RHSA-2025:3123
Red Hat Ansible Automation Platform Developer 2 python3.11-django 4.2.20-1.el8ap RHSA-2025:3160
Red Hat Ansible Automation Platform Developer 2 python39-jinja2 +2 3.1.6-1.el8ap RHSA-2025:3160, RHSA-2025:3123
Red Hat Ansible Automation Platform 2 automation-controller-venv-tower 4.5.20-1.el8ap RHSA-2025:3160, RHSA-2025:3123
Red Hat Ansible Automation Platform 2 python-jinja2 +1 3.1.6-1.el9ap RHSA-2025:3123
Red Hat Ansible Automation Platform 2 python3.11-django 4.2.20-1.el8ap RHSA-2025:3160
Red Hat Ansible Automation Platform 2 python39-jinja2 +2 3.1.6-1.el8ap RHSA-2025:3160, RHSA-2025:3123

AlmaLinux

Errata ↗
ReleasePackageFixed inAdvisory
AlmaLinux 10 python3-jinja2 +1 3.1.6-1.el10_0 ALSA-2025:7476
AlmaLinux 9 python3-jinja2 2.11.3-8.el9_5 ALSA-2025:3406
AlmaLinux 8 python3-jinja2 2.10.1-7.el8_10 ALSA-2025:3388

Rocky Linux

Errata ↗
ReleasePackageFixed inAdvisory
Rocky Linux 10 python-jinja2 3.1.6-1.el10_0 RLSA-2025:7476
Rocky Linux 9 fence-agents 4.10.0-76.el9_5.6 RLSA-2025:3113
Rocky Linux 9 python-jinja2 2.11.3-8.el9_5 RLSA-2025:3406
Rocky Linux 8 python-jinja2 2.10.1-7.el8_10 RLSA-2025:3388
ReleasePackageFixed inAdvisory
SLES 15 SP6 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-1
SLES 15 SP5 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-2
SLES 15 SP4 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-2, SUSE-SU-2025:0956-1
SLES 15 SP3 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-2
SLES 3 python-Jinja2 3.1.2-150400.12.14.1 SUSE-SU-2025:0956-1
Show 14 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLES for SAP 15 SP5 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-2
SLES for SAP 15 SP4 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-2
SLES for SAP 15 SP3 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-2
SLE Micro 6.1 python-Jinja2 3.1.4-slfo.1.1_2.1 SUSE-SU-2025:20254-1
SLE Micro 6.0 python-Jinja2 3.1.2-8.1 SUSE-SU-2025:20156-1
SLE Micro 5.5 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-1
SLE Micro 5.4 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-1
SLE Micro 5.3 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-1
SLE Micro 5.2 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-1
SLE Micro 5.1 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-1
SLE HPC 15 SP5 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-2
SLE HPC 15 SP4 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-2
SLE HPC 15 SP3 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-2
SUSE Enterprise Storage 7.1 python-Jinja2 2.10.1-150000.3.21.1 SUSE-SU-2025:1004-2
ReleasePackageFixed inAdvisory
openSUSE Leap 15.6 python-Jinja2 3.1.2-150400.12.14.1 SUSE-SU-2025:0956-1
ReleasePackageFixed inAdvisory
Alpine v3.24 py3-jinja2 3.1.6-r0 —
Alpine v3.23 py3-jinja2 3.1.6-r0 —
Alpine v3.22 py3-jinja2 3.1.6-r0 —
Alpine v3.21 py3-jinja2 3.1.6-r0 —
Alpine v3.20 py3-jinja2 3.1.6-r0 —
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Alpine v3.19 py3-jinja2 3.1.6-r0 —
Alpine v3.18 py3-jinja2 3.1.6-r0 —

Amazon Linux

ReleasePackageFixed inAdvisory
Amazon Linux 2023 ansible-core +1 2.15.3-1.amzn2023.0.10 ALAS2023-2025-893
Amazon Linux 2023 python3-jinja2 2.11.3-1.amzn2023.0.6 ALAS2023-2025-894
Amazon Linux 2 python-jinja2 2.7.2-3.amzn2.0.4 ALAS2-2025-2792
Amazon Linux 2 python3-jinja2 2.7.2-4.amzn2.0.7 ALAS2-2025-2793

Azure Linux

ReleasePackageFixed inAdvisory
Azure Linux 3 nodejs 20.14.0-7 —
Azure Linux 3 nodejs24 24.13.0-1 —
Azure Linux 3 python-jinja2 3.1.2-3 —
Azure Linux 2 (CBL-Mariner) nodejs18 18.20.3-5 —
Azure Linux 2 (CBL-Mariner) python-jinja2 3.0.3-7 —

Oracle Linux

ReleasePackageFixed inAdvisory
Oracle Linux 10 python3-jinja2 +1 3.1.6-1.el10_0 ELSA-2025-7476
Oracle Linux 9 fence-virt +47 4.10.0-76.el9_5.6 ELSA-2025-3113
Oracle Linux 9 python3-jinja2 2.11.3-8.el9_5 ELSA-2025-3406
Oracle Linux 8 python3-jinja2 2.10.1-7.el8_10 ELSA-2025-3388

Wolfi

ReleasePackageFixed inAdvisory
Wolfi rolling checkov 3.2.432-r0 —
Wolfi rolling jupyter-base-notebook 7.3.2-r2 —
Wolfi rolling jupyter-docker-base +1 999.9.9_git20260925-r0 —
Wolfi rolling reflex 0.7.2-r0 —

Affected packages

EcosystemPackageAffectedFixedRecord
PyPI jinja2 < 3.1.6 3.1.6 GHSA-cpwx-vrp4-4pq7

Advisories 44

References