CVE-2021-42576: Cross-site scripting in github.com/microcosm-cc/bluemonday

Summary

15/08/2022
Yes i
Unrated
Not published

CVE-2021-42576: Cross-site scripting in github.com/microcosm-cc/bluemonday. Affects github.com/microcosm-cc/bluemonday versions < 1.0.16. Fixed in 1.0.16. 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 Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The package under scrutiny is github.com/microcosm-cc/bluemonday, an HTML sanitizer for Go. It is designed to prevent cross-site scripting (XSS) attacks by sanitizing HTML input. The package provides various policies to customize the allowed HTML elements and attributes. However, user-defined policies allowing 'select', 'style', and 'option' elements are vulnerable to a cross-site scripting vulnerability.

Vulnerability Detail

The bluemonday HTML sanitizer can leak the contents of a 'style' element into HTML output, potentially causing XSS vulnerabilities. This vulnerability affects user-defined policies that allow 'select', 'style', and 'option' elements. The default bluemonday sanitization policies are not vulnerable. It is important to note that permitting the 'style' element in policies is hazardous because bluemonday does not contain a CSS sanitizer. Newer versions of bluemonday suppress 'style' and 'script' elements even when allowed by a policy unless the policy explicitly requests unsafe processing.

How To Fix

Minimum fixed version

1.0.16

This is the first release that contains the fix.

go get github.com/microcosm-cc/bluemonday@v1.0.16

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

Workaround

There is no specific workaround mentioned for this vulnerability. It is advised to update the package to the fixed version.

Conclusion

In conclusion, the package github.com/microcosm-cc/bluemonday is vulnerable to a cross-site scripting (XSS) vulnerability when user-defined policies allow 'select', 'style', and 'option' elements. It is recommended to update the package to version 1.0.16 or later to fix this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for github.com/microcosm-cc/bluemonday →

Share this vulnerability

FAQ

Bluemonday is an HTML sanitizer for Go that helps prevent cross-site scripting (XSS) attacks by sanitizing HTML input.

Versions prior to 1.0.16 are affected by this vulnerability.

No, the default bluemonday sanitization policies are not vulnerable to this XSS vulnerability.

This vulnerability can lead to cross-site scripting (XSS) attacks, potentially allowing an attacker to execute malicious scripts on the affected website.

No, bluemonday does not contain a CSS sanitizer. It is hazardous to permit the 'style' element in policies.

Related vulnerabilities

Recent vulnerabilities recorded for github.com/microcosm-cc/bluemonday.

How To Fix

Minimum fixed version

1.0.16

This is the first release that contains the fix.

go get github.com/microcosm-cc/bluemonday@v1.0.16

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