---
id: CVE-2025-27516
title: >-
  jinja2: Jinja sandbox breakout through attr filter selecting format method
  (CVE-2025-27516)
summary: >-
  A flaw was found in Jinja. In affected versions, an oversight in how the Jinja
  sandboxed environment interacts with the `|attr` filter allows an attacker who
  controls the content of a template to execute arbitrary Python code. To
  exploit t…
severity: high
cvss: 7.3
cvssVector: 'CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H'
cvssSource: vendor
cwe: CWE-1336
vendor: Red Hat
product: Quay v3
affected:
  - openshift_serverless
  - enterprise_linux 6
  - enterprise_linux_ai_rhel_ai
  - openshift_ai_rhoai
  - openshift_container_platform 4
  - openstack_platform 18.0
  - satellite 6
  - update_infrastructure_4_for_cloud_providers
  - ansible_automation_platform_2_4_for_rhel 8
  - ansible_automation_platform_2_5_for_rhel 8
  - quay v3
  - openshift_container_platform 4.12
  - openshift_container_platform 4.13
  - openshift_container_platform 4.14
  - openshift_container_platform 4.15
  - ansible_automation_platform_execution_environments
  - ansible_automation_platform_2_4_for_rhel 9
  - ansible_automation_platform_2_5_for_rhel 9
  - openstack_platform 17.1
  - openshift_container_platform 4.16
  - openshift_container_platform 4.17
  - openshift_container_platform 4.18
  - enterprise_linux_appstream_v_10
  - enterprise_linux_appstream_v_8
  - enterprise_linux_appstream_aus_v_8_2
  - enterprise_linux_appstream_aus_v_8_4
  - enterprise_linux_appstream_e4s_v_8_4
  - enterprise_linux_appstream_tus_v_8_4
  - enterprise_linux_appstream_aus_v_8_6
  - enterprise_linux_appstream_e4s_v_8_6
  - enterprise_linux_appstream_tus_v_8_6
  - enterprise_linux_appstream_eus_v_8_8
  - enterprise_linux_appstream_e4s_v_9_0
  - enterprise_linux_appstream_eus_v_9_2
  - enterprise_linux_appstream_eus_v_9_4
  - enterprise_linux_appstream_v_9
  - enterprise_linux_codeready_linux_builder_v_10
  - enterprise_linux_high_availability_e4s_v_9_0
  - enterprise_linux_high_availability_eus_v_9_2
  - enterprise_linux_high_availability_eus_v_9_4
patched:
  - ansible_automation_platform_2_4_for_rhel 8
  - ansible_automation_platform_2_5_for_rhel 8
  - quay v3
  - openshift_container_platform 4.12
  - openshift_container_platform 4.13
  - openshift_container_platform 4.14
  - openshift_container_platform 4.15
  - ansible_automation_platform_execution_environments
  - ansible_automation_platform_2_4_for_rhel 9
  - ansible_automation_platform_2_5_for_rhel 9
  - openstack_platform 17.1
  - openshift_container_platform 4.16
  - openshift_container_platform 4.17
  - openshift_container_platform 4.18
  - enterprise_linux_appstream_v_10
  - enterprise_linux_appstream_v_8
  - enterprise_linux_appstream_aus_v_8_2
  - enterprise_linux_appstream_aus_v_8_4
  - enterprise_linux_appstream_e4s_v_8_4
  - enterprise_linux_appstream_tus_v_8_4
  - enterprise_linux_appstream_aus_v_8_6
  - enterprise_linux_appstream_e4s_v_8_6
  - enterprise_linux_appstream_tus_v_8_6
  - enterprise_linux_appstream_eus_v_8_8
  - enterprise_linux_appstream_e4s_v_9_0
  - enterprise_linux_appstream_eus_v_9_2
  - enterprise_linux_appstream_eus_v_9_4
  - enterprise_linux_appstream_v_9
  - enterprise_linux_codeready_linux_builder_v_10
  - enterprise_linux_high_availability_e4s_v_9_0
  - enterprise_linux_high_availability_eus_v_9_2
  - enterprise_linux_high_availability_eus_v_9_4
  - enterprise_linux_high_availability_v_9
  - developer_hub_rhdh 1.4
  - developer_hub 1.5
  - hardened_images
  - enterprise_linux_resilientstorage_e4s_v_9_0
  - enterprise_linux_resilient_storage_eus_v_9_2
  - enterprise_linux_resilient_storage_eus_v_9_4
  - enterprise_linux_resilient_storage_v_9
published: '2025-03-05'
updated: '2026-10-16'
sourceUpdated: '2026-10-16T10:04:56+00:00'
source: CSAF
sourceUrl: 'https://security.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-27516.json'
references:
  - url: >-
      https://security.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-27516.json
  - url: 'https://access.redhat.com/security/cve/CVE-2025-27516'
  - url: 'https://bugzilla.redhat.com/show_bug.cgi?id=2350190'
  - url: 'https://www.cve.org/CVERecord?id=CVE-2025-27516'
  - url: 'https://nvd.nist.gov/vuln/detail/CVE-2025-27516'
  - url: >-
      https://github.com/pallets/jinja/commit/90457bbf33b8662926ae65cdde4c4c32e756e403
  - url: 'https://github.com/pallets/jinja/security/advisories/GHSA-cpwx-vrp4-4pq7'
  - url: 'https://access.redhat.com/errata/RHSA-2025:3123'
  - url: 'https://access.redhat.com/errata/RHSA-2025:3124'
  - url: 'https://access.redhat.com/errata/RHSA-2025:3160'
  - url: 'https://access.redhat.com/errata/RHSA-2025:3162'
  - url: 'https://access.redhat.com/errata/RHBA-2025:7674'
  - url: 'https://access.redhat.com/errata/RHBA-2025:3653'
  - url: 'https://access.redhat.com/errata/RHBA-2025:3652'
  - url: 'https://access.redhat.com/errata/RHBA-2025:3651'
  - url: 'https://access.redhat.com/errata/RHSA-2025:4408'
  - url: 'https://access.redhat.com/errata/RHSA-2025:3779'
  - url: 'https://access.redhat.com/errata/RHSA-2025:3568'
  - url: 'https://access.redhat.com/errata/RHSA-2025:3789'
  - url: 'https://access.redhat.com/errata/RHSA-2025:2664'
  - url: 'https://access.redhat.com/errata/RHSA-2025:3371'
  - url: 'https://access.redhat.com/errata/RHSA-2025:4730'
  - url: 'https://access.redhat.com/errata/RHSA-2025:4203'
  - url: 'https://access.redhat.com/errata/RHSA-2025:4431'
  - url: 'https://access.redhat.com/errata/RHSA-2025:4018'
  - url: 'https://access.redhat.com/errata/RHSA-2025:3775'
  - url: 'https://access.redhat.com/errata/RHSA-2025:7476'
  - url: 'https://access.redhat.com/errata/RHSA-2025:3388'
  - url: 'https://access.redhat.com/errata/RHSA-2025:3671'
  - url: 'https://access.redhat.com/errata/RHSA-2025:3562'
  - url: 'https://github.com/pallets/jinja'
  - url: 'https://lists.debian.org/debian-lts-announce/2025/04/msg00022.html'
  - url: 'https://lists.debian.org/debian-lts-announce/2025/04/msg00045.html'
tags:
  - csaf
  - vex
  - red-hat
  - osv
  - pip
epss: 0.00507
epssPercentile: 0.43392
aliases:
  - GHSA-cpwx-vrp4-4pq7
  - PYSEC-2026-1471
ecosystem: pip
ingestedAt: '2026-07-08T18:25:48.511Z'
---

## Overview

A flaw was found in Jinja. In affected versions, an oversight in how the Jinja sandboxed environment interacts with the `|attr` filter allows an attacker who 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 that 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.

## Vendor advisories

- **RHSA-2025:3123** · Red Hat · fixed in: Red Hat Ansible Automation Platform 2.4 for RHEL 8, Red Hat Ansible Automation Platform 2.4 for RHEL 9 · released 2025-03-24 · [advisory](https://access.redhat.com/errata/RHSA-2025:3123)
- **RHSA-2025:3124** · Red Hat · fixed in: Red Hat Ansible Automation Platform 2.4 for RHEL 8 · released 2025-03-24 · [advisory](https://access.redhat.com/errata/RHSA-2025:3124)
- **RHSA-2025:3160** · Red Hat · fixed in: Red Hat Ansible Automation Platform 2.5 for RHEL 8, Red Hat Ansible Automation Platform 2.5 for RHEL 9 · released 2025-03-25 · [advisory](https://access.redhat.com/errata/RHSA-2025:3160)
- **RHSA-2025:3162** · Red Hat · fixed in: Red Hat Ansible Automation Platform 2.5 for RHEL 8 · released 2025-03-25 · [advisory](https://access.redhat.com/errata/RHSA-2025:3162)
- **RHBA-2025:7674** · Red Hat · fixed in: Quay v3 · released 2025-05-15 · [advisory](https://access.redhat.com/errata/RHBA-2025:7674)
- **RHBA-2025:3653** · Red Hat · fixed in: Quay v3 · released 2025-04-14 · [advisory](https://access.redhat.com/errata/RHBA-2025:3653)
- **RHBA-2025:3652** · Red Hat · fixed in: Quay v3 · released 2025-04-21 · [advisory](https://access.redhat.com/errata/RHBA-2025:3652)
- **RHBA-2025:3651** · Red Hat · fixed in: Quay v3 · released 2025-05-09 · [advisory](https://access.redhat.com/errata/RHBA-2025:3651)
- **RHSA-2025:4408** · Red Hat · fixed in: Red Hat OpenShift Container Platform 4.12 · released 2025-05-08 · [advisory](https://access.redhat.com/errata/RHSA-2025:4408)
- **RHSA-2025:3779** · Red Hat · fixed in: Red Hat OpenShift Container Platform 4.13 · released 2025-04-17 · [advisory](https://access.redhat.com/errata/RHSA-2025:3779)
- **RHSA-2025:3568** · Red Hat · fixed in: Red Hat OpenShift Container Platform 4.14 · released 2025-04-09 · [advisory](https://access.redhat.com/errata/RHSA-2025:3568)
- **Red Hat VEX** · Important · affected: OpenShift Serverless, Red Hat Enterprise Linux 6, Red Hat Enterprise Linux AI (RHEL AI), Red Hat OpenShift AI (RHOAI), Red Hat OpenShift Container Platform 4, Red Hat OpenStack Platform 18.0, … · no fix planned: Red Hat Enterprise Linux 6, OpenShift Serverless, Red Hat OpenShift Container Platform 4, Red Hat Enterprise Linux AI (RHEL AI), … · updated 2026-10-16 · [vex](https://security.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-27516.json)

**jinja2: Jinja sandbox breakout through attr filter selecting format method** — rated Important by Red Hat. Released 2025-03-05, updated 2026-10-16.

Affected:

- OpenShift Serverless
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux AI (RHEL AI)
- Red Hat OpenShift AI (RHOAI)
- Red Hat OpenShift Container Platform 4
- Red Hat OpenStack Platform 18.0
- Red Hat Satellite 6
- Red Hat Update Infrastructure 4 for Cloud Providers

Fixed:

- Red Hat Ansible Automation Platform 2.4 for RHEL 8
- Red Hat Ansible Automation Platform 2.5 for RHEL 8
- Quay v3
- 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
- Ansible Automation Platform Execution Environments
- Red Hat Ansible Automation Platform 2.4 for RHEL 9
- Red Hat Ansible Automation Platform 2.5 for RHEL 9
- Red Hat OpenStack Platform 17.1
- Red Hat OpenShift Container Platform 4.16
- Red Hat OpenShift Container Platform 4.17
- Red Hat OpenShift Container Platform 4.18
- Red Hat Enterprise Linux AppStream (v. 10)
- Red Hat Enterprise Linux AppStream (v. 8)
- Red Hat Enterprise Linux AppStream AUS (v. 8.2)
- Red Hat Enterprise Linux AppStream AUS (v.8.4)
- Red Hat Enterprise Linux AppStream E4S (v.8.4)
- Red Hat Enterprise Linux AppStream TUS (v.8.4)
- Red Hat Enterprise Linux AppStream AUS (v.8.6)
- Red Hat Enterprise Linux AppStream E4S (v.8.6)
- Red Hat Enterprise Linux AppStream TUS (v.8.6)
- Red Hat Enterprise Linux AppStream EUS (v.8.8)
- Red Hat Enterprise Linux AppStream E4S (v.9.0)
- Red Hat Enterprise Linux AppStream EUS (v.9.2)
- Red Hat Enterprise Linux AppStream EUS (v.9.4)
- Red Hat Enterprise Linux AppStream (v. 9)
- Red Hat Enterprise Linux CodeReady Linux Builder (v. 10)
- Red Hat Enterprise Linux High Availability E4S (v.9.0)
- Red Hat Enterprise Linux High Availability EUS (v.9.2)
- Red Hat Enterprise Linux High Availability EUS (v.9.4)
- Red Hat Enterprise Linux High Availability (v. 9)
- Red Hat Developer Hub (RHDH) 1.4
- Red Hat Developer Hub 1.5
- Red Hat Hardened Images
- Red Hat Enterprise Linux ResilientStorage E4S (v.9.0)
- Red Hat Enterprise Linux Resilient Storage EUS (v.9.2)
- Red Hat Enterprise Linux Resilient Storage EUS (v.9.4)
- Red Hat Enterprise Linux Resilient Storage (v. 9)

No fix planned:

- Red Hat Enterprise Linux 6
- OpenShift Serverless
- Red Hat OpenShift Container Platform 4
- Red Hat Enterprise Linux AI (RHEL AI)
- Red Hat OpenShift AI (RHOAI)

Not affected:

- Red Hat Ansible Automation Platform 2.4 for RHEL 8
- Red Hat Ansible Automation Platform 2.5 for RHEL 8
- 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 Ansible Automation Platform 2.4 for RHEL 9
- Red Hat Ansible Automation Platform 2.5 for RHEL 9
- Red Hat OpenShift Container Platform 4.16
- Red Hat OpenShift Container Platform 4.17

## Remediation

Red Hat Ansible Automation Platform https://access.redhat.com/errata/RHSA-2025:3123
Red Hat Ansible Automation Platform https://access.redhat.com/errata/RHSA-2025:3124
Red Hat Ansible Automation Platform https://access.redhat.com/errata/RHSA-2025:3160

Workarounds / mitigations:

- 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.

## Package advisory (CVE-2025-27516)

Affected packages:

- `jinja2 < 3.1.6`

Patched in:

- `jinja2 3.1.6`

Source: https://osv.dev/vulnerability/GHSA-cpwx-vrp4-4pq7
