MediumGHSA-gmj6-6f8f-6699CVE-2024-56201PYSEC-2026-1472

Jinja has a sandbox breakout through malicious filenames

Published 23 Dec 2024 · Updated 10 Sept 2026

Is your project on an affected jinja2?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several Python apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected package

jinja2PyPI
Affected
>=3.0.0 <3.1.5
Fixed in
3.1.5
Update to the fixed version for your release line, for example:pip install 'jinja2>=3.1.5'

Details

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 if Jinja's sandbox is used.

To exploit the vulnerability, an attacker needs 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 which execute untrusted templates where the template author can also choose the template filename.

Is GHSA-gmj6-6f8f-6699 in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected jinja2, and gives you the command that fixes it.

More advisories for jinja2

  • MediumCVE-2025-27516Jinja2 vulnerable to sandbox breakout through attr filter selecting format method · 5 Mar 2025
  • MediumCVE-2024-56326Jinja has a sandbox breakout through indirect reference to format method · 23 Dec 2024
  • MediumCVE-2024-34064Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filter · 6 May 2024
  • MediumCVE-2024-22195Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filter · 11 Jan 2024
  • MediumCVE-2014-0012Insecure Temporary File in Jinja2 · 17 May 2022
  • HighCVE-2014-1402Incorrect Privilege Assignment in Jinja2 · 14 May 2022
All 10 advisories for jinja2

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.