cve.bz

CVE-2025-27516

5.4 mediumEPSS 0.5%Fix available

Medium (5.4). EPSS 0.5% estimated probability of exploitation activity in the next 30 days. Fixed in jinja2 3.1.6.

On this page
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.

Severity

CVSS 4.0

5.4 medium
CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

CVSS 3.1

8.8 high
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
EPSS
0.5% (unchanged from 0.5% a week ago; 0.5% 30 days ago) estimated probability of exploitation activity in the next 30 days; 44th percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: none · Automatable: no · Technical impact: total, assessed 2025-07-31. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWE
CWE-1336 Improper Neutralization of Special Elements Used in a Template Engine
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2025-27516 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2025-27516?via=ask-ai-copy and https://cve.bz/cve/CVE-2025-27516?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2025-27516 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
palletsprojects:jinjabefore 3.1.6
debian:debian_linux11.0

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-cpwx-vrp4-4pq7PyPIjinja2<3.1.63.1.6
PYSEC-2026-1471PyPIjinja2<3.1.63.1.6

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian11jinja22.11.3-1+deb11u3DLA-4126-1
Debian12jinja23.1.2-1+deb12u3DEBIAN-CVE-2025-27516
Debian13, 14jinja23.1.6-1DEBIAN-CVE-2025-27516
Ubuntu20.04:LTSjinja22.10.1-2ubuntu0.5UBUNTU-CVE-2025-27516 USN-7343-1
Ubuntu22.04:LTSjinja23.0.3-1ubuntu0.4UBUNTU-CVE-2025-27516 USN-7343-1
Ubuntu24.04:LTSjinja23.1.2-1ubuntu1.3UBUNTU-CVE-2025-27516 USN-7343-1
UbuntuPro:14.04:LTSjinja22.7.2-2ubuntu0.1~esm6UBUNTU-CVE-2025-27516 USN-7343-1
UbuntuPro:16.04:LTSjinja22.8-1ubuntu0.1+esm5UBUNTU-CVE-2025-27516 USN-7343-1
UbuntuPro:18.04:LTSjinja22.10-1ubuntu0.18.04.1+esm4UBUNTU-CVE-2025-27516 USN-7343-1
Red Hatansible_automation_platform:2.4::el8automation-controller-venv-tower0:4.5.20-1.el8apRHSA-2025:3123
Red Hatansible_automation_platform:2.4::el8, ansible_automation_platform_developer:2.4::el8, ansible_automation_platform_inside:2.4::el8python39-jinja2, python3x-jinja20:3.1.6-1.el8apRHSA-2025:3123
Red Hatansible_automation_platform:2.4::el9automation-controller-venv-tower0:4.5.20-1.el9apRHSA-2025:3123
Red Hatansible_automation_platform:2.4::el9, ansible_automation_platform_developer:2.4::el9, ansible_automation_platform_inside:2.4::el9python-jinja2, python3-jinja20:3.1.6-1.el9apRHSA-2025:3123
Red Hatansible_automation_platform:2.5::el8automation-controller-venv-tower0:4.6.10-1.el8apRHSA-2025:3160
Red Hatansible_automation_platform:2.5::el8, ansible_automation_platform_developer:2.5::el8python3.11-django0:4.2.20-1.el8apRHSA-2025:3160
Red Hatansible_automation_platform:2.5::el8, ansible_automation_platform_developer:2.5::el8, ansible_automation_platform_inside:2.5::el8python3.11-jinja20:3.1.6-1.el8apRHSA-2025:3160
Red Hatansible_automation_platform:2.5::el9automation-controller-venv-tower0:4.6.10-1.el9apRHSA-2025:3160
Red Hatansible_automation_platform:2.5::el9, ansible_automation_platform_developer:2.5::el9python3.11-django0:4.2.20-1.el9apRHSA-2025:3160
Red Hatansible_automation_platform:2.5::el9, ansible_automation_platform_developer:2.5::el9, ansible_automation_platform_inside:2.5::el9python3.11-jinja20:3.1.6-1.el9apRHSA-2025:3160
Red Hatenterprise_linux:8::appstreampython-jinja2, python3-jinja20:2.10.1-7.el8_10RHSA-2025:3388
Red Hatenterprise_linux:9::appstreamfence-virt, fence-virtd, fence-agents and 23 more0:4.10.0-76.el9_5.6RHSA-2025:3113
18 more for Red Hat in the JSON and on Red Hat's page.
SUSEEnterprise Storage 7.1, Linux Enterprise High Performance Computing 15 SP3-LTSS, Linux Enterprise High Performance Computing 15 SP4-ESPOS and 9 morepython-Jinja22.10.1-150000.3.21.1SUSE-SU-2025:1004-2
SUSELinux Enterprise Micro 5.1, Linux Enterprise Micro 5.2, Linux Enterprise Micro 5.3 and 3 morepython-Jinja22.10.1-150000.3.21.1SUSE-SU-2025:1004-1
SUSELinux Enterprise Module for Public Cloud 15 SP4, Linux Enterprise Module for Python 3 15 SP6python-Jinja23.1.2-150400.12.14.1SUSE-SU-2025:0956-1
SUSELinux Micro 6.0python-Jinja23.1.2-8.1SUSE-SU-2025:20156-1
SUSELinux Micro 6.1python-Jinja23.1.4-slfo.1.1_2.1SUSE-SU-2025:20254-1
openSUSELeap 15.6python-Jinja23.1.2-150400.12.14.1SUSE-SU-2025:0956-1
AlmaLinux8python3-jinja22.10.1-7.el8_10ALSA-2025:3388
AlmaLinux9python3-jinja22.11.3-8.el9_5ALSA-2025:3406
AlmaLinux10python3-jinja2, python3-jinja2+i18n3.1.6-1.el10_0ALSA-2025:7476
Rocky Linux8python-jinja20:2.10.1-7.el8_10RLSA-2025:3388
Rocky Linux9fence-agents0:4.10.0-76.el9_5.6RLSA-2025:3113
Rocky Linux9python-jinja20:2.11.3-8.el9_5RLSA-2025:3406
Rocky Linux10python-jinja20:3.1.6-1.el10_0RLSA-2025:7476
Alpinev3.18, v3.19, v3.20 and 4 morepy3-jinja23.1.6-r0ALPINE-CVE-2025-27516
Azure Linux2nodejs1818.20.3-5AZL-58063
Azure Linux2python-jinja23.0.3-7AZL-57800
Azure Linux3nodejs20.14.0-7AZL-58067
Azure Linux3nodejs2424.13.0-1AZL-75804
Azure Linux3python-jinja23.1.2-3AZL-57878
Alpaquita23, streampy3-jinja23.1.6-r0BELL-CVE-2025-27516

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; Red Hat Security Data © Red Hat, Inc., CC BY 4.0; SUSE security data, CC BY 4.0; AlmaLinux's OSV database, MIT; Rocky Linux's errata, BSD-3-Clause; the Alpine secdb, CC BY-SA 4.0; Microsoft's Azure Linux vulnerability data, MIT; BellSoft's OSV database, MIT. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · Red Hat · SUSE · openSUSE · Alpine · Alpaquita.

Red Hat

Red Hat rates this Important.

Red Hat's statement

This vulnerability is rated as important severity due to the potential for an attacker to bypass Jinja's sandbox by exploiting the |attr filter, by controlling template content, an attacker can execute arbitrary Python code, impacting the integrity, confidentiality, and availability of the system. While the attack requires user interaction to trigger untrusted templates, the risk is significant in applications that allow such templates to be executed.

Red Hat's mitigation

Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base, or stability.

ProductPackageStateAdvisory
Ansible Automation Platform Execution Environmentsansible-automation-platform/ee-minimal-rhel8:2.16.14-11Fixed 2025-03-11RHSA-2025:2664
Ansible Automation Platform Execution Environmentsansible-automation-platform/ee-minimal-rhel9:2.16.14-12Fixed 2025-03-11RHSA-2025:2664
Red Hat Ansible Automation Platform 2.4 for RHEL 8automation-controller-0:4.5.20-1.el8apFixed 2025-03-24RHSA-2025:3123
Red Hat Ansible Automation Platform 2.4 for RHEL 8python3x-jinja2-0:3.1.6-1.el8apFixed 2025-03-24RHSA-2025:3123
Red Hat Ansible Automation Platform 2.4 for RHEL 8ansible-automation-platform-24/lightspeed-rhel8:2.4.250225-5Fixed 2025-03-24RHSA-2025:3124
Red Hat Ansible Automation Platform 2.4 for RHEL 9automation-controller-0:4.5.20-1.el9apFixed 2025-03-24RHSA-2025:3123
Red Hat Ansible Automation Platform 2.4 for RHEL 9python-jinja2-0:3.1.6-1.el9apFixed 2025-03-24RHSA-2025:3123
Red Hat Ansible Automation Platform 2.5 for RHEL 8automation-controller-0:4.6.10-1.el8apFixed 2025-03-25RHSA-2025:3160
Red Hat Ansible Automation Platform 2.5 for RHEL 8python3.11-jinja2-0:3.1.6-1.el8apFixed 2025-03-25RHSA-2025:3160
Red Hat Ansible Automation Platform 2.5 for RHEL 8ansible-automation-platform-25/lightspeed-rhel8:2.5.250318-2Fixed 2025-03-25RHSA-2025:3162
OpenShift Serverlessopenshift-serverless-1/kn-eventing-istio-controller-rhel8Will not fix
Red Hat Ansible Automation Platform 2ansible-automation-platform-24/ee-dellemc-openmanage-rhel8Not affected
Red Hat Ansible Automation Platform 2ansible-automation-platform-25/platform-resource-runner-rhel8Not affected
Red Hat Ceph Storage 7cephNot affected
Red Hat Ceph Storage 8cephNot affected
Red Hat Ceph Storage 9cephNot affected
Red Hat Discovery 1discovery-server-containerNot affected
Red Hat Enterprise Linux 6python-jinja2Out of support scope
Red Hat Enterprise Linux 7python-jinja2Not affected
Red Hat Enterprise Linux AI (RHEL AI)rhelai1/bootc-amd-rhel9Affected
120 more in the JSON and on Red Hat's page.

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2025-27516.

References

Check your stackJSON