GHSA-h5c8-rqwp-cp95

Suggest an improvement
Source
https://github.com/advisories/GHSA-h5c8-rqwp-cp95
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2024/01/GHSA-h5c8-rqwp-cp95/GHSA-h5c8-rqwp-cp95.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-h5c8-rqwp-cp95
Aliases
Published
2024-01-11T15:20:48Z
Modified
2024-02-16T08:18:43.206475Z
Severity
  • 5.4 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N CVSS Calculator
Summary
Jinja vulnerable to HTML attribute injection when passing user input as keys to xmlattr filter
Details

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.

References

Affected packages

PyPI / jinja2

Package

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
3.1.3

Affected versions

2.*

2.0rc1
2.0
2.1
2.1.1
2.2
2.2.1
2.3
2.3.1
2.4
2.4.1
2.5
2.5.1
2.5.2
2.5.3
2.5.4
2.5.5
2.6
2.7
2.7.1
2.7.2
2.7.3
2.8
2.8.1
2.9
2.9.1
2.9.2
2.9.3
2.9.4
2.9.5
2.9.6
2.10
2.10.1
2.10.2
2.10.3
2.11.0
2.11.1
2.11.2
2.11.3

3.*

3.0.0a1
3.0.0rc1
3.0.0rc2
3.0.0
3.0.1
3.0.2
3.0.3
3.1.0
3.1.1
3.1.2