CVE-2021-42576: Vulnerability in bluemonday

pybluemonday Updated 02 Oct 2025

Summary

19/10/2021
Yes i
High
9.8

CVE-2021-42576: Policies not properly enforced in bluemonday. Affects pybluemonday versions < 0.0.8. Fixed in 0.0.8. How to fix ↓

Also tracked for

The same CVE-2021-42576 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The bluemonday package is a sanitizer library used in Go and Python applications. It provides functionality to sanitize and enforce policies on HTML content. The package is widely used in web applications to prevent cross-site scripting (XSS) attacks and ensure secure rendering of user-generated content. However, versions before 1.0.16 for Go and before 0.0.8 for Python (pybluemonday) have a vulnerability that allows policies associated with the SELECT, STYLE, and OPTION elements to be improperly enforced.

Vulnerability Detail

The bluemonday sanitizer fails to properly enforce policies related to the SELECT, STYLE, and OPTION elements. This can lead to potential security risks, as attackers can exploit this vulnerability to inject malicious content or execute arbitrary code through these elements. The lack of proper policy enforcement undermines the intended security measures of the bluemonday package, making applications vulnerable to cross-site scripting attacks and other HTML-related vulnerabilities.

How To Fix

Minimum fixed version

0.0.8

This is the first release that contains the fix.

pip install --upgrade "pybluemonday==0.0.8"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no known workaround for this vulnerability. It is crucial to update to the fixed versions of the bluemonday package to mitigate the risk of exploitation.

Conclusion

The bluemonday package has a vulnerability that allows policies associated with SELECT, STYLE, and OPTION elements to be improperly enforced. This can lead to potential security risks, including cross-site scripting attacks. It is crucial for developers to update their bluemonday dependencies to the fixed versions to mitigate the risk of exploitation. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for pybluemonday →

Share this vulnerability

FAQ

bluemonday is a sanitizer library used in Go and Python applications to enforce policies on HTML content and prevent cross-site scripting attacks.

This vulnerability allows attackers to bypass policy enforcement and inject malicious content or execute arbitrary code through SELECT, STYLE, and OPTION elements, potentially leading to cross-site scripting attacks and other HTML-related vulnerabilities.

Versions before 1.0.16 for Go and before 0.0.8 for Python (pybluemonday) are affected by this vulnerability.

No, there are no known workarounds for this vulnerability. Updating to the fixed versions is the recommended solution.

To update the bluemonday package, you can use package managers like pip for Python or Go modules for Go. Simply update the package to version 1.0.16 for Go or version 0.0.8 for Python (pybluemonday).

How To Fix

Minimum fixed version

0.0.8

This is the first release that contains the fix.

pip install --upgrade "pybluemonday==0.0.8"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback