---
id: CVE-2024-56201
title: >-
  jinja2: Jinja has a sandbox breakout through malicious filenames
  (CVE-2024-56201)
summary: >-
  A flaw was found in the Jinja2 package. A bug in the Jinja compiler allows an
  attacker that controls both the content and filename of a template to execute
  arbitrary Python code, regardless of Jinja's sandbox being used. An attacker
  needs …
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-150
vendor: Red Hat
product: Red Hat OpenShift Container Platform 4.18
affected:
  - openshift_lightspeed
  - ansible_automation_platform 1.2
  - enterprise_linux 6
  - enterprise_linux_ai_rhel_ai
  - openshift_container_platform 4
  - openshift_distributed_tracing 3
  - openstack_platform 18.0
  - ansible_automation_platform_2_4_for_rhel 8
  - ansible_automation_platform_2_5_for_rhel 8
  - quay v3
  - ansible_automation_platform_execution_environments
  - satellite_6_15_for_rhel 8
  - 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
  - ironic_content_for_red_hat_openshift_container_platform 4.12
  - ironic_content_for_red_hat_openshift_container_platform 4.13
  - ironic_content_for_red_hat_openshift_container_platform 4.14
  - ironic_content_for_red_hat_openshift_container_platform 4.15
  - ironic_content_for_red_hat_openshift_container_platform 4.16
  - ironic_content_for_red_hat_openshift_container_platform 4.17
  - discovery_1_for_rhel 9
  - 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_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
  - openshift_ai 2.16
  - 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
patched:
  - ansible_automation_platform_2_4_for_rhel 8
  - ansible_automation_platform_2_5_for_rhel 8
  - quay v3
  - ansible_automation_platform_execution_environments
  - satellite_6_15_for_rhel 8
  - 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
  - ironic_content_for_red_hat_openshift_container_platform 4.12
  - ironic_content_for_red_hat_openshift_container_platform 4.13
  - ironic_content_for_red_hat_openshift_container_platform 4.14
  - ironic_content_for_red_hat_openshift_container_platform 4.15
  - ironic_content_for_red_hat_openshift_container_platform 4.16
  - ironic_content_for_red_hat_openshift_container_platform 4.17
  - discovery_1_for_rhel 9
  - 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_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
  - openshift_ai 2.16
  - 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: '2024-12-23'
updated: '2026-10-15'
sourceUpdated: '2026-10-15T11:08:50+00:00'
source: CSAF
sourceUrl: 'https://security.access.redhat.com/data/csaf/v2/vex/2024/cve-2024-56201.json'
references:
  - url: >-
      https://security.access.redhat.com/data/csaf/v2/vex/2024/cve-2024-56201.json
  - url: 'https://access.redhat.com/security/cve/CVE-2024-56201'
  - url: 'https://bugzilla.redhat.com/show_bug.cgi?id=2333854'
  - url: 'https://www.cve.org/CVERecord?id=CVE-2024-56201'
  - url: 'https://nvd.nist.gov/vuln/detail/CVE-2024-56201'
  - url: >-
      https://github.com/pallets/jinja/commit/767b23617628419ae3709ccfb02f9602ae9fe51f
  - url: 'https://github.com/pallets/jinja/issues/1792'
  - url: 'https://github.com/pallets/jinja/releases/tag/3.1.5'
  - url: 'https://github.com/pallets/jinja/security/advisories/GHSA-gmj6-6f8f-6699'
  - url: 'https://access.redhat.com/errata/RHSA-2025:0721'
  - url: 'https://access.redhat.com/errata/RHSA-2025:0722'
  - url: 'https://access.redhat.com/errata/RHSA-2025:0777'
  - url: 'https://access.redhat.com/errata/RHSA-2025:0341'
  - url: 'https://access.redhat.com/errata/RHBA-2025:1077'
  - url: 'https://access.redhat.com/errata/RHBA-2025:0301'
  - url: 'https://access.redhat.com/errata/RHBA-2025:1597'
  - url: 'https://access.redhat.com/errata/RHSA-2025:1101'
  - url: 'https://access.redhat.com/errata/RHSA-2025:0753'
  - url: 'https://access.redhat.com/errata/RHSA-2025:3491'
  - url: 'https://access.redhat.com/errata/RHSA-2025:1861'
  - url: 'https://access.redhat.com/errata/RHSA-2025:1123'
  - url: 'https://access.redhat.com/errata/RHSA-2025:0875'
  - url: 'https://access.redhat.com/errata/RHSA-2024:6121'
  - url: 'https://access.redhat.com/errata/RHSA-2025:0834'
  - url: 'https://access.redhat.com/errata/RHSA-2025:1118'
  - url: 'https://access.redhat.com/errata/RHSA-2025:0842'
  - url: 'https://access.redhat.com/errata/RHSA-2025:1130'
  - url: 'https://access.redhat.com/errata/RHSA-2025:0830'
  - url: 'https://access.redhat.com/errata/RHSA-2025:0656'
  - url: 'https://access.redhat.com/errata/RHSA-2025:1249'
  - url: 'https://github.com/pallets/jinja'
tags:
  - csaf
  - vex
  - red-hat
  - osv
  - pip
epss: 0.00307
epssPercentile: 0.2337
aliases:
  - GHSA-gmj6-6f8f-6699
  - PYSEC-2026-1472
ecosystem: pip
scores:
  vendor: 7.3
  osv: 8.8
ingestedAt: '2026-07-08T18:25:49.740Z'
---

## Overview

A flaw was found in the Jinja2 package. A bug in the Jinja compiler allows an attacker that controls both the content and filename of a template to execute arbitrary Python code, regardless of Jinja's sandbox being used. An attacker needs to be able to control both the filename and the contents 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 where the template author can also choose the template filename.

## Vendor advisories

- **RHSA-2025:0721** · 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-01-27 · [advisory](https://access.redhat.com/errata/RHSA-2025:0721)
- **RHSA-2025:0722** · Red Hat · fixed in: Red Hat Ansible Automation Platform 2.4 for RHEL 8 · released 2025-01-27 · [advisory](https://access.redhat.com/errata/RHSA-2025:0722)
- **RHSA-2025:0777** · 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-01-28 · [advisory](https://access.redhat.com/errata/RHSA-2025:0777)
- **RHSA-2025:0341** · Red Hat · fixed in: Red Hat Ansible Automation Platform 2.5 for RHEL 8 · released 2025-01-15 · [advisory](https://access.redhat.com/errata/RHSA-2025:0341)
- **RHBA-2025:1077** · Red Hat · fixed in: Quay v3 · released 2025-02-06 · [advisory](https://access.redhat.com/errata/RHBA-2025:1077)
- **RHBA-2025:0301** · Red Hat · fixed in: Quay v3 · released 2025-01-20 · [advisory](https://access.redhat.com/errata/RHBA-2025:0301)
- **RHBA-2025:1597** · Red Hat · fixed in: Quay v3 · released 2025-02-24 · [advisory](https://access.redhat.com/errata/RHBA-2025:1597)
- **RHSA-2025:1101** · Red Hat · fixed in: Ansible Automation Platform Execution Environments · released 2025-02-05 · [advisory](https://access.redhat.com/errata/RHSA-2025:1101)
- **RHSA-2025:0753** · Red Hat · fixed in: Ansible Automation Platform Execution Environments · released 2025-01-28 · [advisory](https://access.redhat.com/errata/RHSA-2025:0753)
- **RHSA-2025:3491** · Red Hat · fixed in: Red Hat Satellite 6.15 for RHEL 8 · released 2025-04-01 · [advisory](https://access.redhat.com/errata/RHSA-2025:3491)
- **RHSA-2025:1861** · Red Hat · fixed in: Red Hat OpenStack Platform 17.1 · released 2025-02-25 · [advisory](https://access.redhat.com/errata/RHSA-2025:1861)
- **Red Hat VEX** · Important · affected: OpenShift Lightspeed, Red Hat Ansible Automation Platform 1.2, Red Hat Enterprise Linux 6, Red Hat Enterprise Linux AI (RHEL AI), Red Hat OpenShift Container Platform 4, Red Hat OpenShift distributed tracing 3, … · no fix planned: Red Hat Enterprise Linux 6, Red Hat Ansible Automation Platform 1.2, Red Hat Enterprise Linux AI (RHEL AI), Red Hat OpenShift Container Platform 4, … · updated 2026-10-15 · [vex](https://security.access.redhat.com/data/csaf/v2/vex/2024/cve-2024-56201.json)

**jinja2: Jinja has a sandbox breakout through malicious filenames** — rated Important by Red Hat. Released 2024-12-23, updated 2026-10-15.

Affected:

- OpenShift Lightspeed
- Red Hat Ansible Automation Platform 1.2
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux AI (RHEL AI)
- Red Hat OpenShift Container Platform 4
- Red Hat OpenShift distributed tracing 3
- Red Hat OpenStack Platform 18.0

Fixed:

- Red Hat Ansible Automation Platform 2.4 for RHEL 8
- Red Hat Ansible Automation Platform 2.5 for RHEL 8
- Quay v3
- Ansible Automation Platform Execution Environments
- Red Hat Satellite 6.15 for RHEL 8
- 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
- Ironic content for Red Hat OpenShift Container Platform 4.12
- Ironic content for Red Hat OpenShift Container Platform 4.13
- Ironic content for Red Hat OpenShift Container Platform 4.14
- Ironic content for Red Hat OpenShift Container Platform 4.15
- Ironic content for Red Hat OpenShift Container Platform 4.16
- Ironic content for Red Hat OpenShift Container Platform 4.17
- Discovery 1 for RHEL 9
- 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 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 OpenShift AI 2.16
- 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
- Red Hat Ansible Automation Platform 1.2
- Red Hat Enterprise Linux AI (RHEL AI)
- Red Hat OpenShift Container Platform 4
- Red Hat OpenShift distributed tracing 3
- OpenShift Lightspeed
- Red Hat OpenStack Platform 18.0

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 OpenShift Container Platform 4.16
- Red Hat OpenShift Container Platform 4.17
- Ansible Automation Platform Execution Environments
- Red Hat Satellite 6.15 for RHEL 8

## Remediation

Red Hat Ansible Automation Platform https://access.redhat.com/errata/RHSA-2025:0721
Red Hat Ansible Automation Platform https://access.redhat.com/errata/RHSA-2025:0722
Red Hat Ansible Automation Platform https://access.redhat.com/errata/RHSA-2025:0777

Workarounds / mitigations:

- To mitigate this vulnerabilty restrict user-controlled template filenames, ensuring they follow a predefined templates.

## Package advisory (CVE-2024-56201)

Affected packages:

- `jinja2 >= 3.0.0, < 3.1.5`

Patched in:

- `jinja2 3.1.5`

Source: https://osv.dev/vulnerability/GHSA-gmj6-6f8f-6699
