Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐍 PyPI
Not in CISA KEV

CVE-2025-27516 — jinja2

Fix: pallets/jinja@90457bb

CVE-2025-27516 is a CWE-1336 vulnerability in jinja2. A fix is available for jinja2 — see the affected versions and patch details below.

Jinja sandbox breakout through attr filter selecting format method

Also known asGHSA-cpwx-vrp4-4pq7PYSEC-2026-1471
Published
Mar 5, 2025
Updated
Aug 12, 2026
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Sep 23, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

No confirmed exploitation observed yet

  • A successful exploit gives an attacker total control of the affected component, not partial access.
  • CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.

Exploitation and automatability from CISA’s SSVC triage for CVE-2025-27516.

EPSS Exploitation Probability

via FIRST.org ↗
0.5%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs42th percentile — riskier than 42% of all scored CVEsHighest risk

EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.

Real-World Exposure

1 pkg affected
🐍jinja2

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.

Description

Jinja is an extensible templating engine. Prior to 3.1.6, an oversight in how the Jinja sandboxed environment interacts with the |attr filter 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 use the |attr filter to get a reference to a string's plain format method, bypassing the sandbox. After the fix, the |attr filter no longer bypasses the environment's attribute lookup. This vulnerability is fixed in 3.1.6.

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🐍PyPIjinja2all versions3.1.6pip install --upgrade 'jinja2==3.1.6'

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for jinja2, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update jinja2 to 3.1.6 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2025-27516 is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2025-27516 can be triaged on real exposure rather than presence alone.

Tailored to CVE-2025-27516. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Fixing This On Your OS

If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.

Red HatImportant

This vulnerability is rated as important severity due to the potential for an attacker to bypass Jinja's sandbox by exploiting the |attr filter, by controlling template content, an attacker can execute arbitrary Python code, impacting the integrity, confidentiality, and availability of the system. While the attack…

ProductFixed inAdvisory
Ansible Automation Platform Execution Environmentsansible-automation-platform/ee-minimal-rhel8:2.16.14-11RHSA-2025:2664
Red Hat Ansible Automation Platform 2.4 for RHEL 8automation-controller-0:4.5.20-1.el8apRHSA-2025:3123
Red Hat Ansible Automation Platform 2.4 for RHEL 8ansible-automation-platform-24/lightspeed-rhel8:2.4.250225-5RHSA-2025:3124
Red Hat Ansible Automation Platform 2.5 for RHEL 8automation-controller-0:4.6.10-1.el8apRHSA-2025:3160
Red Hat Ansible Automation Platform 2.5 for RHEL 8ansible-automation-platform-25/lightspeed-rhel8:2.5.250318-2RHSA-2025:3162
Red Hat Enterprise Linux 10python-jinja2-0:3.1.6-1.el10_0RHSA-2025:7476
Red Hat Enterprise Linux 8python-jinja2-0:2.10.1-7.el8_10RHSA-2025:3388
Red Hat Enterprise Linux 8.2 Advanced Update Supportpython-jinja2-0:2.10.1-2.el8_2.4RHSA-2025:3671

Frequently Asked Questions

Jinja is an extensible templating engine. Prior to 3.1.6, an oversight in how the Jinja sandboxed environment interacts with the |attr filter 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 use th
O3 Security · Impact-Aware SCA

Is CVE-2025-27516 in your dependencies?

O3 Security finds CVE-2025-27516 across PyPI dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

CVE-2025-27516: jinja2 | O3 Security