Skip to main content
VulnerabilityPublished Updated

CVE-2024-22195: Jinja2 · Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filter

Affects jinja2Source GCVE Database

0
Compare
Authoritative record:CVE-2024-22195· Medium 5.4

Not known to be exploited · CVSS 5.4 Medium : upgrade to 3.1.3 when convenient.

Data as of 31 Oct 2026, 01:25 UTC

CVSS 3.1 base score
5.4Medium
How severe the flaw is on the 0–10 CVSS scale.

Thin evidence

One scorer or none
CVSS scores by source
CNA (GitHub_M)CVSS 3.15.4
Patch
Available – fixed in 3.1.3
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 11 Jan 2024

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponized: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq Mirage: no evidence on record.

    No attack traffic recorded by OffSeq Mirage sensors

A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 30 Oct 2026.

What to do

Upgrade jinja2 to 3.1.3.

Affected software

ProductAffectedFixed in
PyPIjinja2Affected
  • <3.1.3
Fixed in
  • 3.1.3

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

A patch is available in Jinja2 version 3.1.3 that fixes this vulnerability. Users should upgrade to version 3.1.3 or later. Additionally, applications should avoid accepting user input as keys to the xmlattr filter or validate keys rigorously to prevent injection of malicious attributes.

Description

Jinja2 versions prior to 3.1.3 have a vulnerability in the xmlattr filter that allows HTML attribute injection when user input is passed as keys. This occurs because keys containing spaces are accepted, which can be interpreted as multiple attributes, enabling potential cross-site scripting (XSS) if untrusted keys are rendered. This issue is mitigated by verifying keys or upgrading to version 3.1.3 or later.

References

Community reviews

Loading reviews…