Vulnerabilities

CVE-2024-56326

Medium 5.4 CVSS 4.0

Description

Jinja is an extensible templating engine. Prior to 3.1.5, An oversight in how the Jinja sandboxed environment detects calls to str.format 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 store a reference to a malicious string's format method, then pass that to a filter that calls it. No such filters are built-in to Jinja, but could be present through custom filters in an application. After the fix, such indirect calls are also handled by the sandbox. This vulnerability is fixed in 3.1.5.

Description as published by the source, in English.

Key facts

Published
2024-12-23
Last modified
2026-06-17
Assigned by
security-advisories@github.com
CVSS vector
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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:
Scored by
security-advisories@github.com
Probability of exploitation
0.5 % higher than 41 % of all known vulnerabilities
EPSS, next 30 days, model v2026.06.15
Fix available
Yes, see references

Affected products

Vendor Product Versions Status
jinja2 (PyPI) < 3.1.5 Affected
Palletsprojects Jinja < 3.1.5 Affected

Weakness type

Attack techniques

Derived through the weakness type: CVE to CWE to CAPEC to ATT&CK. This shows which techniques the weakness class is historically used for. It does not assert that this vulnerability has been exploited that way.

  • T1040: Network Sniffing credential-access, discovery
  • T1083: File and Directory Discovery discovery
  • T1565.002: Transmitted Data Manipulation impact
  • T1574.005: Executable Installer File Permissions Weakness stealth, execution
  • T1574.010: Services File Permissions Weakness stealth, execution
  • T1611: Escape to Host privilege-escalation

References

Does this affect you?

A vulnerability matters only if you run the product, in an affected version, somewhere an attacker can reach.

Check your asset list Browse all vulnerabilities