Vulnerability GHSA-vv2x-vrpj-qqpq
Medium Risk
MEDIUM RISK
CVSS Score: 6.1
Score Range: 4.0–6.9
Medium severity vulnerabilities (CVSS 4.0–6.9). Important issues that meaningfully reduce security confidence.
5 years ago
February 02, 2021 at 05:58 PM UTC
Cross-site scripting in Bleach
0.1 - 3.2.3
0.1 - 3.2.3
Summary
Cross-site scripting in Bleach
Details
Impact
A mutation XSS affects users calling bleach.clean with all of:
svgormathin the allowed tagsporbrin allowed tagsstyle,title,noscript,script,textarea,noframes,iframe, orxmpin allowed tags- the keyword argument
strip_comments=False
Note: none of the above tags are in the default allowed tags and strip_comments defaults to True.
Patches
Users are encouraged to upgrade to bleach v3.3.0 or greater.
Note: bleach v3.3.0 introduces a breaking change to escape HTML comments by default.
Workarounds
-
modify
bleach.cleancalls to at least one of:- not allow the
style,title,noscript,script,textarea,noframes,iframe, orxmptag - not allow
svgormathtags - not allow
porbrtags - set
strip_comments=True
- not allow the
-
A strong Content-Security-Policy without
unsafe-inlineandunsafe-evalscript-srcs) will also help mitigate the risk.
References
- https://bugzilla.mozilla.org/show_bug.cgi?id=1689399
- https://advisory.checkmarx.net/advisory/CX-2021-4303
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-23980
- https://cure53.de/fp170.pdf
Credits
- Reported by Yaniv Nizry from the CxSCA AppSec group at Checkmarx
- Additional eject tags not mentioned in the original advisory and the CSP mitigation line being truncated in the revised advisory reported by Michał Bentkowski at Securitum
For more information
If you have any questions or comments about this advisory:
- Open an issue at https://github.com/mozilla/bleach/issues
- Email us at [email protected]
Related Vulnerabilities
Other vulnerabilities affecting the same packages
Medium Risk
5 months ago
Bleach clean() / Cleaner() fails to sanitize dangerous URI schemes in allowed formaction attributes
0.1 - 6.3.0 GHSA-gj48-438w-jh9v
0.1 - 6.3.0 GHSA-gj48-438w-jh9v
Medium Risk
5 months ago
Bleach linkify(parse_email=True) CPU exhaustion via unbounded email regex scanning
6.3.0 GHSA-g75f-g53v-794x
6.3.0 GHSA-g75f-g53v-794x
Low Risk
5 months ago
Bleach: URI sanitization allows disallowed URI schemes with Unicode > U+00A0 in output
0.1 - 6.3.0 GHSA-8rfp-98v4-mmr6
0.1 - 6.3.0 GHSA-8rfp-98v4-mmr6
Unknown
5 years ago
No summary available
0.1 - 3.2.3 PYSEC-2021-865
0.1 - 3.2.3 PYSEC-2021-865
High Risk
6 years ago
regular expression denial-of-service (ReDoS) in Bleach
0.1 - 3.1.3 GHSA-vqhp-cxgc-6wmm
0.1 - 3.1.3 GHSA-vqhp-cxgc-6wmm
Impacted packages
Timeline
Published
5 years ago
February 02, 2021 at 05:58 PM UTC
Fixed (3.3.0)
5 years ago
February 01, 2021 at 05:15 PM UTC
Last Modified
4 months ago
July 08, 2026 at 06:27 AM UTC