Vulnerabilities in pkg:pypi/html-sanitizer
PACKAGECVE-2024-34078 is a HIGH arbitrary html present after sanitization vulnerability (General Security Weakness) affecting Html sanitizer libraries in the PyPI ecosystem. The issue involves arbitrary html present after sanitization because of unicode normalization. Remediation is available by upgrading affected packages to version 2.4.2.
pkg:pypi/html-sanitizer
Vulnerability advisories affecting package pkg:pypi/html-sanitizer. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-wvhx-q427-fgh3 | CVE-2024-34078 | HIGH | Arbitrary HTML present after sanitization because of unicode normalization |
CVE-2024-34078 at a Glance
How to Fix CVE-2024-34078
To remediate this vulnerability, upgrade all affected Html sanitizer 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 html-sanitizer>=2.4.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show html-sanitizer
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-34078, inspect your installed packages using pip:
pip show html-sanitizer
Analyze the terminal output to locate any version of Html sanitizer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.4.2), your application is affected.
Note: The pip show html-sanitizer command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under General Security Weakness. In Html sanitizer, 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-2024-34078 Affected Html sanitizer Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
html-sanitizer
|
PyPI |
< 2.4.2
|
2.4.2
|
References
Frequently Asked Questions
What is CVE-2024-34078?
Which Html sanitizer versions are affected?
What version fixes CVE-2024-34078?
Is html-sanitizer affected?
What CWE is associated with CVE-2024-34078?
How can I check PyPI dependencies for CVE-2024-34078?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-wvhx-q427-fgh3",
"modified" : "2024-05-06T14:33:32Z",
"published" : "2024-05-06T14:33:32Z",
"aliases" : [ "CVE-2024-34078" ],
"summary" : "Arbitrary HTML present after sanitization because of unicode normalization",
"details" : "### Impact\n\nIf using `keep_typographic_whitespace=False` (which is the default), the sanitizer normalizes unicode to the NFKC form at the end. Some unicode characters normalize to chevrons; this allows specially crafted HTML to escape sanitization.\n\n### Patches\n\nThe problem has been fixed in 2.4.2.\n\n### Workarounds\n\nSet `keep_typographic_whitespace=True` explicitly, or normalize to NFKC yourself earlier.\n",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "html-sanitizer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.4.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/matthiask/html-sanitizer/security/advisories/GHSA-wvhx-q427-fgh3"
}, {
"type" : "WEB",
"url" : "https://github.com/matthiask/html-sanitizer/commit/48db42fc5143d0140c32d929c46b802f96913550"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/matthiask/html-sanitizer"
} ],
"database_specific" : {
"cwe_ids" : [ ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-05-06T14:33:32Z",
"nvd_published_at" : null
}
}