Vulnerabilities in pkg:golang/github.com/microcosm-cc/bluemonday
PACKAGECVE-2021-42576 is a HIGH (CVSS 9.8) remote code execution vulnerability (CWE-20: Improper Input Validation) affecting Pybluemonday libraries in the PyPI ecosystem. The issue involves policies not properly enforced in bluemonday. Remediation is available by upgrading affected packages to version 0.0.8, 1.0.16.
pkg:golang/github.com/microcosm-cc/bluemonday
Vulnerability advisories affecting package pkg:golang/github.com/microcosm-cc/bluemonday. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-x95h-979x-cf3j | CVE-2021-42576 | HIGH | Policies not properly enforced in bluemonday |
| GHSA-3x58-xr87-2fcj | CVE-2021-29272 | MODERATE | Cross-site scripting in bluemonday |
CVE-2021-42576 at a Glance
Security Impact
CVSS: 9.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2021-42576
To remediate this vulnerability, upgrade all affected Pybluemonday dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install pybluemonday>=0.0.8
Upgrade github.com/microcosm-cc/bluemonday to 1.0.16
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show pybluemonday
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2021-42576, inspect your installed packages using pip:
pip show pybluemonday
Analyze the terminal output to locate any version of Pybluemonday in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.8), your application is affected.
Note: The pip show pybluemonday command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Pybluemonday, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-42576 Affected Pybluemonday Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
pybluemonday
|
PyPI |
< 0.0.8
|
0.0.8
|
|
github.com/microcosm-cc/bluemonday
|
Go |
< 1.0.16
|
1.0.16
|
References
Frequently Asked Questions
What is CVE-2021-42576?
Which Pybluemonday versions are affected?
What version fixes CVE-2021-42576?
Is pybluemonday affected?
Is github.com/microcosm-cc/bluemonday affected?
What is the CVSS score of CVE-2021-42576?
What CWE is associated with CVE-2021-42576?
How can I check PyPI dependencies for CVE-2021-42576?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-x95h-979x-cf3j",
"modified" : "2024-10-21T20:18:42Z",
"published" : "2021-10-19T20:15:30Z",
"aliases" : [ "CVE-2021-42576" ],
"summary" : "Policies not properly enforced in bluemonday",
"details" : "The bluemonday sanitizer before 1.0.16 for Go, and before 0.0.8 for Python (in pybluemonday), does not properly enforce policies associated with the SELECT, STYLE, and OPTION elements.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "pybluemonday"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.0.8"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/microcosm-cc/bluemonday"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.0.16"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-42576"
}, {
"type" : "WEB",
"url" : "https://github.com/microcosm-cc/bluemonday/commit/c788a2a4d42e081ad54a31368478820bb4a42fb4"
}, {
"type" : "WEB",
"url" : "https://docs.google.com/document/d/11SoX296sMS0XoQiQbpxc5pNxSdbJKDJkm5BDv0zrX50"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-x95h-979x-cf3j"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/microcosm-cc/bluemonday"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/pybluemonday/PYSEC-2021-849.yaml"
}, {
"type" : "WEB",
"url" : "https://pkg.go.dev/vuln/GO-2022-0588"
}, {
"type" : "WEB",
"url" : "https://pypi.org/project/pybluemonday"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-10-19T16:10:19Z",
"nvd_published_at" : "2021-10-18T15:15:00Z"
}
}