NIST deprecates RSA-2048 from 2030. Find every one of them before attackers do.
🐍
🐍 PyPI
Not in CISA KEV
MEDIUM severity

CVE-2024-22195 — jinja2

MEDIUMFix: pallets/jinja@7167953

CVE-2024-22195 is a medium-severity (CVSS 5.4) Cross-site Scripting (XSS) vulnerability in jinja2. A fix is available for jinja2 — see the affected versions and patch details below.

Jinja vulnerable to Cross-Site Scripting (XSS)

Also known asGHSA-h5c8-rqwp-cp95PYSEC-2026-1473
Published
Updated
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Nov 6, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

No confirmed exploitation observed yet

  • 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-2024-22195.

EPSS Exploitation Probability

via FIRST.org ↗
0.9%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs60th percentile — riskier than 60% of all scored CVEsHighest risk
0.00%0.46%0.93%1.39%0.1%0.9%May 26Sep 26Nov 26

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

How urgent is this, really

Where this sits among everything scored

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

The xmlattr filter in affected versions of Jinja accepts keys containing spaces. XML/HTML attributes cannot contain spaces, as each would then be interpreted as a separate attribute. If an application accepts keys (as opposed to only values) as user input, and renders these in pages that other users see as well, an attacker could use this to inject other attributes and perform XSS. Note that accepting keys as user input is not common or a particularly intended use case of the xmlattr filter, and an application doing so should already be verifying what keys are provided regardless of this fix.

Affected Packages

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

Affected Products

1 product · 1 configurations
Application
jinjapalletsprojects
< 3.1.3
range

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.3 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2024-22195 is resolved across your whole dependency graph.

  3. Workarounds

    Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.

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 HatModerate

The identified issue is classified as moderate due to a cross-site scripting (XSS) vulnerability in Jinja2. This flaw arises from the xmlattr filter, which permits keys with spaces, contrary to XML/HTML attribute standards. In scenarios where an application accepts user-input keys and renders them for other users,…

Workaround published by Red Hat
Mitigation for this issue is either not available or the currently available options don't meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base or stability.
Source: Red Hat security advisory for CVE-2024-22195 (CC BY 4.0)
ProductFixed inAdvisory
Red Hat Ansible Automation Platform 2.4 for RHEL 8python3x-jinja2-0:3.1.3-1.el8apRHSA-2024:1057
Red Hat Ansible Automation Platform 2.4 for RHEL 8automation-controller-0:4.5.5-2.el8apRHSA-2024:1640
Red Hat Ceph Storage 7.1rhceph/ceph-nvmeof-cli-rhel9:1.2.13-4RHSA-2024:3927
Red Hat Enterprise Linux 8fence-agents-0:4.2.1-121.el8_9.4RHBA-2024:0891
Red Hat Enterprise Linux 8fence-agents-0:4.2.1-129.el8RHSA-2024:2968
Red Hat Enterprise Linux 8python27:2.7-8100020240208011952.5f0f67deRHSA-2024:2987
Red Hat Enterprise Linux 8python-jinja2-0:2.10.1-4.el8RHSA-2024:3102
Red Hat Enterprise Linux 8.4 Advanced Mission Critical Update Supportfence-agents-0:4.2.1-65.el8_4.14RHBA-2024:1398

Frequently Asked Questions

The `xmlattr` filter in affected versions of Jinja accepts keys containing spaces. XML/HTML attributes cannot contain spaces, as each would then be interpreted as a separate attribute. If an application accepts keys (as opposed to only values) as user input, and renders these in pages that other users see as well, an attacker could use this to inject other attributes and perform XSS. Note that accepting keys as user input is not common or a particularly intended use case of the `xmlattr` filter, and an application doing so should already be verifying what keys are provided regardless of this f
O3 Security · Impact-Aware SCA

Is CVE-2024-22195 in your dependencies?

Find it across PyPI, including transitive dependencies.

CVE-2024-22195: jinja2 XSS — Fixed in 3.1.3