CVE-2024-34064
jinja2: accepts keys containing non-attribute characters
Severity
ModerateRed Hat Product Security
CVSS 3.1
Review impact separately from score.
Published · May 6, 2024
Updated · November 1, 2026
Description
A flaw was found in jinja2. The xmlattr filter 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 inject other attributes and perform cross-site scripting (XSS).
Statement
The fix for CVE-2024-22195 only addressed spaces, 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.
Fence agents on RHEL 8 has been fixed as a part of https://access.redhat.com/errata/RHBA-2024:4238
CVSS score applicability
The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.
Mitigation
Do not accept user input as keys to the xmlattr filter without validation. See the statement above for more information.
CVSS / CWE
CVSS 3.1 · 5.4CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N
CWE-79 · Improper Neutralization of Input During Web Page Generation