Skip to main content
← All vulnerabilities
CVE-2024-34064GHSA-H75V-3VVJ-5MFJPYSEC-2026-1474

Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filter

Published
Last modified
published
Not listed in CISA KEV
Fix
Fixed in 3.1.4
7 proofs of concept on GitHub
  • Exploitation: none
  • Automatable: no
  • Technical impact: partial

Summary

Jinja is an extensible templating engine. The `xmlattr` filter in affected versions of Jinja accepts keys containing non-attribute characters. XML/HTML attributes cannot contain spaces, `/`, `>`, or `=`, as each would then be interpreted as starting 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. The fix for CVE-2024-22195 only addressed spaces but not other characters. Accepting keys as user input is now explicitly considered an unintended use case of the `xmlattr` filter, and code that does so without otherwise validating the input should be flagged as insecure, regardless of Jinja version. Accepting values as user input continues to be safe. This vulnerability is fixed in 3.1.4.

Timeline

  1. CVE published
  2. CISA SSVC assessment

    Exploitation: none · Automatable: no · Technical impact: partial

  3. Record last updated

Affected versions

  • pallets jinja

    fixed in 3.1.4

  • jinja2PyPI

    fixed in 3.1.4

References 13

GitHub · pallets/jinja

lists.fedoraproject.org

GitHub · SandBlastx/flask-vuln-baseline

GitHub · SandBlastx/flask-vuln-v1

GitHub · SandBlastx/flask-vuln-v2

GitHub · SandBlastx/flask-vuln-v3

GitHub · SandBlastx/flask-vuln-v4

GitHub · SandBlastx/flask-vuln-v5

GitHub · SandBlastx/flask-vuln-v6