CVE-2024-34064

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

Published May 6, 2024 CVSS 3.1 · 5.4 Medium EPSS < 1% KEV · Not listed
Description
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.

Remediation

No solution or workaround provided in the CVE record

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Debian DLA Debian DLA DLA-3988-1 jinja2 security update
EUVD EUVD EUVD-2024-1641 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.
Github GHSA Github GHSA GHSA-h75v-3vvj-5mfj Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filter
Ubuntu USN Ubuntu USN USN-6787-1 Jinja2 vulnerability
History
Type Values Removed Values Added
First Time appeared Fedoraproject
Fedoraproject fedora
Palletsprojects
Palletsprojects jinja
CPEs cpe:2.3:a:palletsprojects:jinja:*:*:*:*:*:*:*:*
cpe:2.3:o:fedoraproject:fedora:39:*:*:*:*:*:*:*
cpe:2.3:o:fedoraproject:fedora:40:*:*:*:*:*:*:*
Vendors & Products Fedoraproject
Fedoraproject fedora
Palletsprojects
Palletsprojects jinja
Type Values Removed Values Added
CPEs cpe:2.3:a:palletsprojects:jinja:*:*:*:*:*:*:*:*
Vendors & Products Palletsprojects
Palletsprojects jinja
Type Values Removed Values Added
Metrics epss

{'score': 0.00191}

epss

{'score': 0.00168}

Type Values Removed Values Added
First Time appeared Redhat rhui
CPEs cpe:/a:redhat:rhui:4::el8
Vendors & Products Redhat rhui
Type Values Removed Values Added
First Time appeared Palletsprojects
Palletsprojects jinja
CPEs cpe:2.3:a:palletsprojects:jinja:*:*:*:*:*:*:*:*
Vendors & Products Palletsprojects
Palletsprojects jinja
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
CPEs cpe:/a:redhat:openshift_ironic:4.12::el9
Type Values Removed Values Added
CPEs cpe:/a:redhat:openshift_ironic:4.13::el9
Type Values Removed Values Added
First Time appeared Redhat satellite
Redhat satellite Capsule
CPEs cpe:/a:redhat:satellite:6.15::el8
cpe:/a:redhat:satellite_capsule:6.15::el8
Vendors & Products Redhat satellite
Redhat satellite Capsule
Type Values Removed Values Added
CPEs cpe:/a:redhat:openshift_ironic:4.15::el9