bleach cross-site scripting in HTML sanitization

Severity: info · CVSS 6.1 · Published 2020-09-03

bleach is a popular open-source library used to sanitize and clean HTML content, preventing malicious scripts from being embedded in web applications. A vulnerability in bleach's sanitization logic allows attackers to bypass the HTML filtering with specially crafted payloads, enabling them to inject and execute arbitrary JavaScript in users' browsers—potentially leading to session hijacking, credential theft, or malware distribution.

Vendors: npm.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
Informational severity, with a CVSS score of 6.1, published 3 September 2020.
Which products and versions are affected?
bleach (npm) SEMVER:introduced=0.0.0.
Is there a fix for This vulnerability?
No fixed version is recorded yet. Check the vendor's advisory in the references below. If you run it, Junglewise drafts a mitigation that fits your setup and applies it once you approve, with senior security engineers behind it.
How is This vulnerability attacked?
It is attacked over the network.
Am I affected?
Check whether you run bleach (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

Technical details

This is a cross-site scripting (CWE-79) vulnerability in bleach's HTML sanitization filter. The vulnerability allows attackers to bypass the package's sanitization mechanism using polyglot payloads such as "<<script><<\/script>script>alert('xss');<\/<<\/script><<\/script>script>" that confuse the parser into misinterpreting tag boundaries. The attack is network-based and requires no authentication or user interaction beyond the victim viewing content sanitized with the vulnerable bleach version. A successful exploit allows arbitrary JavaScript execution in the victim's browser context. At the time of disclosure, no patch was available, and the advisory recommended switching to alternative HTML sanitization libraries.

Affected products

  • bleach contributors bleach

Timeline

  • 2020-09-03: disclosed: Vulnerability disclosed via GitHub Security Advisory GHSA-5634-rv46-48jf
  • 2020-08-31: advisory: Advisory reviewed and added to GitHub advisory database

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.