CVE-2024-21501: Sanitize html Sanitize-html Information Exposure Vulnerability Vulnerability
MODERATECVE-2024-21501 is a MODERATE (CVSS 5.3) sanitize-html information exposure vulnerability vulnerability (CWE-538: Insertion of Sensitive Information into Externally-Accessible File or Directory) affecting Sanitize html libraries in the npm ecosystem. The issue involves sanitize-html information exposure vulnerability. Remediation is available by upgrading affected packages to version 2.12.1.
CVE-2024-21501 at a Glance
Security Impact
CVSS: 5.3
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:L/I:N/A:N).
How to Fix CVE-2024-21501
To remediate this vulnerability, upgrade all affected Sanitize html dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install sanitize-html@2.12.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls sanitize-html
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-21501, inspect your project dependencies using npm:
npm ls sanitize-html
Analyze the terminal output to locate any version of Sanitize html in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.12.1), your application is affected.
Note: The npm ls sanitize-html command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-538: Insertion of Sensitive Information into Externally-Accessible File or Directory, where the product places sensitive information into files or directories that are accessible to actors who are allowed to have access to the files, but not to the sensitive information. In Sanitize html, 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-21501 Affected Sanitize html Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
sanitize-html
|
npm |
< 2.12.1
|
2.12.1
|
References
Frequently Asked Questions
What is CVE-2024-21501?
Which Sanitize html versions are affected?
What version fixes CVE-2024-21501?
Is sanitize-html affected?
What is the CVSS score of CVE-2024-21501?
What CWE is associated with CVE-2024-21501?
How can I check npm dependencies for CVE-2024-21501?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-rm97-x556-q36h",
"modified" : "2024-08-28T21:58:16Z",
"published" : "2024-02-24T06:30:17Z",
"aliases" : [ "CVE-2024-21501" ],
"summary" : "sanitize-html Information Exposure vulnerability",
"details" : "Versions of the package sanitize-html before 2.12.1 are vulnerable to Information Exposure when used on the backend and with the style attribute allowed, allowing enumeration of files in the system (including project dependencies). An attacker could exploit this vulnerability to gather details about the file system structure and dependencies of the targeted server.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "sanitize-html"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.12.1"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-21501"
}, {
"type" : "WEB",
"url" : "https://github.com/apostrophecms/sanitize-html/pull/650"
}, {
"type" : "WEB",
"url" : "https://github.com/apostrophecms/sanitize-html/commit/c5dbdf77fe8b836d3bf4554ea39edb45281ec0b4"
}, {
"type" : "WEB",
"url" : "https://gist.github.com/Slonser/8b4d061abe6ee1b2e10c7242987674cf"
}, {
"type" : "WEB",
"url" : "https://github.com/apostrophecms/apostrophe/discussions/4436"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/apostrophecms/sanitize-html"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/4EB5JPYRCTS64EA5AMV3INHDPI6I4AW7"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/P4I5X6V3LYUNBMZ5YOW4BV427TH3IK4S"
}, {
"type" : "WEB",
"url" : "https://security.snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-6276557"
}, {
"type" : "WEB",
"url" : "https://security.snyk.io/vuln/SNYK-JS-SANITIZEHTML-6256334"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-200", "CWE-538" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-03-01T16:55:53Z",
"nvd_published_at" : "2024-02-24T05:15:44Z"
}
}