GHSA-vv2x-vrpj-qqpq
MEDIUMGHSA-vv2x-vrpj-qqpq is a medium-severity (CVSS 6.1) Cross-site Scripting (XSS) vulnerability in bleach. 1 public exploit reference exists, so weaponization risk is real. O3 Security confirms whether GHSA-vv2x-vrpj-qqpq is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.
Cross-site scripting in Bleach
Blast Radius
bleachReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
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]
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | bleach | all versions | 3.3.0 |
Research use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for bleach. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Fix
Update bleach to 3.3.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-vv2x-vrpj-qqpq is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-vv2x-vrpj-qqpq is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-vv2x-vrpj-qqpq. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-vv2x-vrpj-qqpq in your dependencies?
O3 detects GHSA-vv2x-vrpj-qqpq across PyPI dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.