Read the docs
TI-2025-20348 Aliases CVE-2025-27516GHSA-cpwx-vrp4-4pq7

Jinja sandbox breakout through attr filter selecting format method

Priority LOW 27CWE-1336Published · Updated

Key facts

Attack vector
Local
Privileges required
Low
User interaction
Passive
Attack complexity
Low
Attack requirements
Present
Impact type
Code execution
Confidentiality · integrity · availability
High · High · High
Fix status
Partial Red Hat: 40 fixed, 8 without a fix

Attack profile from CVSS 4.0 · CNA. Fix status from CNA, GitHub and Red Hat. Impact type from CWE-1336.

Summary

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.

Why it matters now

Exploitation None reported CISA SSVC · not in CISA KEV
EPSS 0.00507 43rd percentileScored 2026-11-07
Fix Partial jinja (pallets): 3.1.6Jinja2 (PyPI): 3.1.6Red Hat: 32 advisoriesRed Hat: 40 fixed, 8 without a fix

SSVC decision points

CISA ADP · SSVC 2.0.3

Exploitation
None
Automatable
No
Technical impact
Total

The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.

Affected products

VendorProductAffected versionsFixed inStatusSource
palletsjinjabefore 3.1.63.1.6Patch availableCNA
—Jinja2 (PyPI)before 3.1.63.1.6Patch availableGHSA-cpwx-vrp4-4pq7
  • jinja Vendorpallets Affected before 3.1.6 Fixed in 3.1.6 Patch available CNA
  • Jinja2 (PyPI) Vendor— Affected before 3.1.6 Fixed in 3.1.6 Patch available GHSA-cpwx-vrp4-4pq7

CPE configurations NVD · 2

CPEVersionsRoleVendor
cpe:2.3:a:palletsprojects:jinja:*:*:*:*:*:*:*:*before 3.1.6Vulnerablepallets
cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:*11.0VulnerableDebian
  • cpe:2.3:a:palletsprojects:jinja:*:*:*:*:*:*:*:* Versions before 3.1.6 Vulnerable ·pallets
  • cpe:2.3:o:debian:debian_linux:11.0:*:*:*:*:*:*:* Versions 11.0 Vulnerable ·Debian

Remediation

  • Fix · CNA jinja (pallets) Fixed in 3.1.6
  • Fix · GHSA-cpwx-vrp4-4pq7 Jinja2 (PyPI) Fixed in 3.1.6 Advisory →

Red Hat 32 advisories

  • RHSA-2026:43940 Released 2026-07-22 · Red Hat rating Important
    Red Hat Hardened Images RPMs bug fix and enhancement update
    • Red Hat Hardened Images python-jinja2-3.1.6-10.1.hum1@src, python3-jinja2+i18n-3.1.6-10.1.hum1@noarch@public-hummingbird-aarch64-rpms, python3-jinja2+i18n-3.1.6-10.1.hum1@noarch@public-hummingbird-x86_64-rpms +2
  • RHSA-2025:4730 Released 2025-05-15 · Red Hat rating Important
    OpenShift Container Platform 4.16.40 security and extras update
    • Red Hat OpenShift Container Platform 4.16 openshift4/ose-ansible-rhel9-operator
  • RHSA-2025:7476 Released 2025-05-13 · Red Hat rating Important
    python-jinja2 security update
    • Red Hat Enterprise Linux AppStream (v. 10) python-jinja2-3.1.6-1.el10_0, python3-jinja2-3.1.6-1.el10_0
    • Red Hat Enterprise Linux CodeReady Linux Builder (v. 10) python3-jinja2+i18n-3.1.6-1.el10_0
Show 29 more Red Hat advisories
  • RHSA-2025:4431 Released 2025-05-09 · Red Hat rating Important
    OpenShift Container Platform 4.17.28 bug fix and security update
    • Red Hat OpenShift Container Platform 4.17 openshift4/ose-olm-operator-controller-rhel9, rhcos
  • RHSA-2025:4408 Released 2025-05-08 · Red Hat rating Important
    OpenShift Container Platform 4.12.76 security and extras update
    • Red Hat OpenShift Container Platform 4.12 openshift4/ose-ansible-operator
  • RHSA-2025:4203 Released 2025-04-30 · Red Hat rating Important
    OpenShift Container Platform 4.17.27 security and extras update
    • Red Hat OpenShift Container Platform 4.17 openshift4/ose-ansible-rhel9-operator
  • RHSA-2025:4018 Released 2025-04-22 · Red Hat rating Important
    OpenShift Container Platform 4.18.10 security and extras update
    • Red Hat OpenShift Container Platform 4.18 openshift4/ose-ansible-rhel9-operator
  • RHSA-2025:3779 Released 2025-04-17 · Red Hat rating Important
    OpenShift Container Platform 4.13.57 security and extras update
    • Red Hat OpenShift Container Platform 4.13 openshift4/ose-ansible-operator
  • RHSA-2025:3775 Released 2025-04-16 · Red Hat rating Important
    OpenShift Container Platform 4.18.9 bug fix and security update
    • Red Hat OpenShift Container Platform 4.18 openshift4/azure-kms-encryption-provider-rhel9, openshift4/ose-agent-installer-node-agent-rhel9, openshift4/ose-agent-installer-orchestrator-rhel9 +4
  • RHSA-2025:3789 Released 2025-04-16 · Red Hat rating Important
    OpenShift Container Platform 4.15.49 security and extras update
    • Red Hat OpenShift Container Platform 4.15 openshift4/ose-ansible-operator
  • RHSA-2025:3568 Released 2025-04-09 · Red Hat rating Important
    OpenShift Container Platform 4.14.50 security and extras update
    • Red Hat OpenShift Container Platform 4.14 openshift4/ose-ansible-operator
  • RHSA-2025:3671 Released 2025-04-08 · Red Hat rating Important
    python-jinja2 security update
    • Red Hat Enterprise Linux AppStream AUS (v. 8.2) python-jinja2-2.10.1-2.el8_2.4, python3-jinja2-2.10.1-2.el8_2.4
  • RHSA-2025:3622 Released 2025-04-07 · Red Hat rating Important
    python-jinja2 security update
    • Red Hat Enterprise Linux AppStream AUS (v.8.6) python-jinja2-2.10.1-4.el8_6.2, python3-jinja2-2.10.1-4.el8_6.2
    • Red Hat Enterprise Linux AppStream E4S (v.8.6) python-jinja2-2.10.1-4.el8_6.2, python3-jinja2-2.10.1-4.el8_6.2
    • Red Hat Enterprise Linux AppStream TUS (v.8.6) python-jinja2-2.10.1-4.el8_6.2, python3-jinja2-2.10.1-4.el8_6.2
  • RHSA-2025:3595 Released 2025-04-03 · Red Hat rating Important
    Red Hat Developer Hub 1.4.3 release.
    • Red Hat Developer Hub (RHDH) 1.4 registry.redhat.io/rhdh/rhdh-hub-rhel9
  • RHSA-2025:3588 Released 2025-04-03 · Red Hat rating Important
    python-jinja2 security update
    • Red Hat Enterprise Linux AppStream E4S (v.9.0) python-jinja2-2.11.3-5.el9_0, python3-jinja2-2.11.3-5.el9_0
  • RHSA-2025:3586 Released 2025-04-03 · Red Hat rating Important
    python-jinja2 security update
    • Red Hat Enterprise Linux AppStream EUS (v.9.4) python-jinja2-2.11.3-7.el9_4, python3-jinja2-2.11.3-7.el9_4
  • RHSA-2025:3585 Released 2025-04-03 · Red Hat rating Important
    python-jinja2 security update
    • Red Hat Enterprise Linux AppStream EUS (v.9.2) python-jinja2-2.11.3-5.el9_2, python3-jinja2-2.11.3-5.el9_2
  • RHSA-2025:3580 Released 2025-04-03 · Red Hat rating Important
    python-jinja2 security update
    • Red Hat Enterprise Linux AppStream EUS (v.8.8) python-jinja2-2.10.1-5.el8_8, python3-jinja2-2.10.1-5.el8_8
  • RHSA-2025:3562 Released 2025-04-03 · Red Hat rating Important
    python-jinja2 security update
    • Red Hat Enterprise Linux AppStream AUS (v.8.4) python-jinja2-2.10.1-2.el8_4.2, python3-jinja2-2.10.1-2.el8_4.2
    • Red Hat Enterprise Linux AppStream E4S (v.8.4) python-jinja2-2.10.1-2.el8_4.2, python3-jinja2-2.10.1-2.el8_4.2
    • Red Hat Enterprise Linux AppStream TUS (v.8.4) python-jinja2-2.10.1-2.el8_4.2, python3-jinja2-2.10.1-2.el8_4.2
  • RHSA-2025:3406 Released 2025-03-31 · Red Hat rating Important
    python-jinja2 security update
    • Red Hat Enterprise Linux AppStream (v. 9) python-jinja2-2.11.3-8.el9_5, python3-jinja2-2.11.3-8.el9_5
  • RHSA-2025:3388 Released 2025-03-31 · Red Hat rating Important
    python-jinja2 security update
    • Red Hat Enterprise Linux AppStream (v. 8) python-jinja2-2.10.1-7.el8_10, python3-jinja2-2.10.1-7.el8_10
  • RHSA-2025:3374 Released 2025-03-27 · Red Hat rating Important
    Red Hat Developer Hub 1.5.1 release.
    • Red Hat Developer Hub 1.5 registry.redhat.io/rhdh/rhdh-hub-rhel9, registry.redhat.io/rhdh/rhdh-rhel9-operator
  • RHSA-2025:3371 Released 2025-03-27 · Red Hat rating Important
    Red Hat OpenStack Platform 17.1 (openstack-ansible-core) security update
    • Red Hat OpenStack Platform 17.1 openstack-ansible-core-2.14.2-4.7.el9ost
  • RHSA-2025:3162 Released 2025-03-25 · Red Hat rating Important
    Red Hat Ansible Automation Platform 2.5 Container Release Update
    • Red Hat Ansible Automation Platform 2.5 for RHEL 8 ansible-automation-platform-25/lightspeed-rhel8
  • RHSA-2025:3160 Released 2025-03-25 · Red Hat rating Important
    Red Hat Ansible Automation Platform 2.5 Product Security and Bug Fix Update
    • Red Hat Ansible Automation Platform 2.5 for RHEL 8 automation-controller-venv-tower-4.6.10-1.el8ap, python3.11-django-4.2.20-1.el8ap, python3.11-jinja2-3.1.6-1.el8ap
    • Red Hat Ansible Automation Platform 2.5 for RHEL 9 automation-controller-venv-tower-4.6.10-1.el9ap, python3.11-django-4.2.20-1.el9ap, python3.11-jinja2-3.1.6-1.el9ap
  • RHSA-2025:3124 Released 2025-03-24 · Red Hat rating Important
    Red Hat Ansible Automation Platform 2.4 Container Release Update
    • Red Hat Ansible Automation Platform 2.4 for RHEL 8 ansible-automation-platform-24/lightspeed-rhel8
  • RHSA-2025:3123 Released 2025-03-24 · Red Hat rating Important
    Red Hat Ansible Automation Platform 2.4 Product Security and Bug Fix Update
    • Red Hat Ansible Automation Platform 2.4 for RHEL 8 automation-controller-venv-tower-4.5.20-1.el8ap, python39-jinja2-3.1.6-1.el8ap, python3x-jinja2-3.1.6-1.el8ap
    • Red Hat Ansible Automation Platform 2.4 for RHEL 9 automation-controller-venv-tower-4.5.20-1.el9ap, python-jinja2-3.1.6-1.el9ap, python3-jinja2-3.1.6-1.el9ap
  • RHSA-2025:3113 Released 2025-03-24 · Red Hat rating Important
    fence-agents security update
    • Red Hat Enterprise Linux AppStream (v. 9) fence-agents-4.10.0-76.el9_5.6, fence-agents-common-4.10.0-76.el9_5.6, fence-agents-compute-4.10.0-76.el9_5.6 +11
    • Red Hat Enterprise Linux High Availability (v. 9) fence-agents-aliyun-4.10.0-76.el9_5.6, fence-agents-all-4.10.0-76.el9_5.6, fence-agents-amt-ws-4.10.0-76.el9_5.6 +39
    • Red Hat Enterprise Linux Resilient Storage (v. 9) fence-agents-aliyun-4.10.0-76.el9_5.6, fence-agents-all-4.10.0-76.el9_5.6, fence-agents-amt-ws-4.10.0-76.el9_5.6 +39
  • RHSA-2025:3111 Released 2025-03-24 · Red Hat rating Important
    fence-agents security update
    • Red Hat Enterprise Linux AppStream EUS (v.9.2) fence-agents-4.10.0-43.el9_2.12, fence-agents-common-4.10.0-43.el9_2.12, fence-agents-compute-4.10.0-43.el9_2.12 +11
    • Red Hat Enterprise Linux High Availability EUS (v.9.2) fence-agents-aliyun-4.10.0-43.el9_2.12, fence-agents-all-4.10.0-43.el9_2.12, fence-agents-amt-ws-4.10.0-43.el9_2.12 +39
    • Red Hat Enterprise Linux Resilient Storage EUS (v.9.2) fence-agents-aliyun-4.10.0-43.el9_2.12, fence-agents-all-4.10.0-43.el9_2.12, fence-agents-amt-ws-4.10.0-43.el9_2.12 +39
  • RHSA-2025:3017 Released 2025-03-18 · Red Hat rating Important
    fence-agents security update
    • Red Hat Enterprise Linux AppStream E4S (v.9.0) fence-agents-4.10.0-20.el9_0.21, fence-agents-common-4.10.0-20.el9_0.21, fence-agents-compute-4.10.0-20.el9_0.21 +12
    • Red Hat Enterprise Linux High Availability E4S (v.9.0) fence-agents-aliyun-4.10.0-20.el9_0.21, fence-agents-all-4.10.0-20.el9_0.21, fence-agents-amt-ws-4.10.0-20.el9_0.21 +39
    • Red Hat Enterprise Linux ResilientStorage E4S (v.9.0) fence-agents-aliyun-4.10.0-20.el9_0.21, fence-agents-all-4.10.0-20.el9_0.21, fence-agents-amt-ws-4.10.0-20.el9_0.21 +39
  • RHSA-2025:2688 Released 2025-03-12 · Red Hat rating Important
    fence-agents security update
    • Red Hat Enterprise Linux AppStream EUS (v.9.4) fence-agents-4.10.0-62.el9_4.11, fence-agents-common-4.10.0-62.el9_4.11, fence-agents-compute-4.10.0-62.el9_4.11 +11
    • Red Hat Enterprise Linux High Availability EUS (v.9.4) fence-agents-aliyun-4.10.0-62.el9_4.11, fence-agents-all-4.10.0-62.el9_4.11, fence-agents-amt-ws-4.10.0-62.el9_4.11 +39
    • Red Hat Enterprise Linux Resilient Storage EUS (v.9.4) fence-agents-aliyun-4.10.0-62.el9_4.11, fence-agents-all-4.10.0-62.el9_4.11, fence-agents-amt-ws-4.10.0-62.el9_4.11 +39
  • RHSA-2025:2664 Released 2025-03-11 · Red Hat rating Important
    Red Hat Ansible Automation Platform Execution Environments Container Release Update
    • Ansible Automation Platform Execution Environments ansible-automation-platform/ee-minimal-rhel8, ansible-automation-platform/ee-minimal-rhel9

Vendor assessments

Red Hat

Red Hat rating: Important. Red Hat's page for this CVE →

ProductStatusPlan or fix
OpenShift ServerlessAffectedNo fix planned: Will not fix
Red Hat Enterprise Linux 6AffectedNo fix planned: Out of support scope
Red Hat Enterprise Linux AI (RHEL AI)AffectedNo fix yet
Red Hat OpenShift AI (RHOAI)AffectedNo fix yet
Red Hat OpenShift Container Platform 4AffectedNo fix yet
Red Hat OpenStack Platform 18.0Affected—
Red Hat Satellite 6Affected—
Red Hat Update Infrastructure 4 for Cloud ProvidersAffected—
Ansible Automation Platform Execution EnvironmentsFixed RHSA-2025:2664
Quay v3Fixed—
Red Hat Ansible Automation Platform 2.4 for RHEL 8Fixed RHSA-2025:3123, RHSA-2025:3124
Red Hat Ansible Automation Platform 2.4 for RHEL 9Fixed RHSA-2025:3123
Red Hat Ansible Automation Platform 2.5 for RHEL 8Fixed RHSA-2025:3160, RHSA-2025:3162
Red Hat Ansible Automation Platform 2.5 for RHEL 9Fixed RHSA-2025:3160
Red Hat Developer Hub (RHDH) 1.4Fixed RHSA-2025:3595
Red Hat Developer Hub 1.5Fixed RHSA-2025:3374
Red Hat Enterprise Linux AppStream (v. 10)Fixed RHSA-2025:7476
Red Hat Enterprise Linux AppStream (v. 8)Fixed RHSA-2025:3388
Red Hat Enterprise Linux AppStream (v. 9)Fixed RHSA-2025:3113, RHSA-2025:3406
Red Hat Enterprise Linux AppStream AUS (v. 8.2)Fixed RHSA-2025:3671
Red Hat Enterprise Linux AppStream AUS (v.8.4)Fixed RHSA-2025:3562
Red Hat Enterprise Linux AppStream AUS (v.8.6)Fixed RHSA-2025:3622
Red Hat Enterprise Linux AppStream E4S (v.8.4)Fixed RHSA-2025:3562
Red Hat Enterprise Linux AppStream E4S (v.8.6)Fixed RHSA-2025:3622
Red Hat Enterprise Linux AppStream E4S (v.9.0)Fixed RHSA-2025:3017, RHSA-2025:3588
Red Hat Enterprise Linux AppStream EUS (v.8.8)Fixed RHSA-2025:3580
Red Hat Enterprise Linux AppStream EUS (v.9.2)Fixed RHSA-2025:3111, RHSA-2025:3585
Red Hat Enterprise Linux AppStream EUS (v.9.4)Fixed RHSA-2025:2688, RHSA-2025:3586
Red Hat Enterprise Linux AppStream TUS (v.8.4)Fixed RHSA-2025:3562
Red Hat Enterprise Linux AppStream TUS (v.8.6)Fixed RHSA-2025:3622
Red Hat Enterprise Linux CodeReady Linux Builder (v. 10)Fixed RHSA-2025:7476
Red Hat Enterprise Linux High Availability (v. 9)Fixed RHSA-2025:3113
Red Hat Enterprise Linux High Availability E4S (v.9.0)Fixed RHSA-2025:3017
Red Hat Enterprise Linux High Availability EUS (v.9.2)Fixed RHSA-2025:3111
Red Hat Enterprise Linux High Availability EUS (v.9.4)Fixed RHSA-2025:2688
Red Hat Enterprise Linux Resilient Storage (v. 9)Fixed RHSA-2025:3113
Red Hat Enterprise Linux Resilient Storage EUS (v.9.2)Fixed RHSA-2025:3111
Red Hat Enterprise Linux Resilient Storage EUS (v.9.4)Fixed RHSA-2025:2688
Red Hat Enterprise Linux ResilientStorage E4S (v.9.0)Fixed RHSA-2025:3017
Red Hat Hardened ImagesFixed RHSA-2026:43940
Red Hat OpenShift Container Platform 4.12Fixed RHSA-2025:4408
Red Hat OpenShift Container Platform 4.13Fixed RHSA-2025:3779
Red Hat OpenShift Container Platform 4.14Fixed RHSA-2025:3568
Red Hat OpenShift Container Platform 4.15Fixed RHSA-2025:3789
Red Hat OpenShift Container Platform 4.16Fixed RHSA-2025:4730
Red Hat OpenShift Container Platform 4.17Fixed RHSA-2025:4203, RHSA-2025:4431
Red Hat OpenShift Container Platform 4.18Fixed RHSA-2025:3775, RHSA-2025:4018
Red Hat OpenStack Platform 17.1Fixed RHSA-2025:3371
Not affected: 21 products
  • Red Hat Ansible Automation Platform 2
  • Red Hat Ansible Automation Platform 2.4 for RHEL 8
  • Red Hat Ansible Automation Platform 2.4 for RHEL 9
  • Red Hat Ansible Automation Platform 2.5 for RHEL 8
  • Red Hat Ansible Automation Platform 2.5 for RHEL 9
  • Red Hat Ceph Storage 7
  • Red Hat Ceph Storage 8
  • Red Hat Ceph Storage 9
  • Red Hat Developer Hub (RHDH) 1.4
  • Red Hat Developer Hub 1.5
  • Red Hat Discovery 1
  • Red Hat Enterprise Linux 7
  • Red Hat OpenShift AI (RHOAI)
  • Red Hat OpenShift Container Platform 4
  • Red Hat OpenShift Container Platform 4.12
  • Red Hat OpenShift Container Platform 4.13
  • Red Hat OpenShift Container Platform 4.14
  • Red Hat OpenShift Container Platform 4.15
  • Red Hat OpenShift Container Platform 4.16
  • Red Hat OpenShift Container Platform 4.17
  • Red Hat OpenShift Container Platform 4.18

Timeline

  1. 2026-10-02 Threatist record created from CVE-2025-27516
  2. 2026-10-03 Alias added: GHSA-cpwx-vrp4-4pq7

References

  • TI-2019-08127 In Pallets Jinja before 2.10.1, str.format_map allows a sandbox escape. CVSS 3.1HIGH 8.6
  • TI-2016-08785 In Pallets Jinja before 2.8.1, str.format allows a sandbox escape. CVSS 3.0HIGH 8.6
  • TI-2020-17297 Regular expression denial of service (ReDoS) in jinja2 CVSS 3.1MEDIUM 5.3
  • TI-2024-14788 Jinja vulnerable to Cross-Site Scripting (XSS) CVSS 3.1MEDIUM 6.1
  • TI-2024-37287 Jinja has a sandbox breakout through indirect reference to format method CVSS 4.0MEDIUM 5.4
  • TI-2024-37171 Jinja has a sandbox breakout through malicious filenames CVSS 4.0MEDIUM 5.4
See all 7 →

Sources