CVE Database›CVE-2024-56201

CVE-2024-56201

jinja2: Jinja has a sandbox breakout through malicious filenames

Loading…

Severity

Important

Red Hat Product Security

7.3

CVSS 3.1

Review impact separately from score.

Published · December 24, 2024

Updated · November 3, 2026

Description

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.

Statement

This vulnerability has rated as a IMPORTANT flaw because an attacker controlling both the template content and filename to execute arbitrary Python code, bypassing the sandbox.

CVSS score applicability

The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.

Mitigation

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

CVSS / CWE

CVSS 3.1 · 7.3
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H

CWE-150 · Improper Neutralization of Escape, Meta, or Control Sequences