CVE-2024-21501: Sanitize html Sanitize-html Information Exposure Vulnerability Vulnerability

MODERATE
Advisory Identifier: GHSA-rm97-x556-q36h
CVSS 5.3
CWE-538 CWE-200
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2024-21501
GHSA Identifier GHSA-rm97-x556-q36h
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-538: Insertion of Sensitive Information into Externally-Accessible File or Directory
Affected Product Sanitize html
Package Ecosystem npm
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (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.

sanitize-html fixed: 2.12.1
npm install sanitize-html@2.12.1
Verify Direct and Transitive Dependencies

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

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.

CVE-2024-21501 Affected Sanitize html Versions

1 component(s)
Fixed Versions:
2.12.1
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?
CVE-2024-21501 is a security vulnerability in Sanitize html involving sanitize-html Information Exposure vulnerability under CWE-538: Insertion of Sensitive Information into Externally-Accessible File or Directory.
Which Sanitize html versions are affected?
Affected versions include releases prior to 2.12.1 across affected packages: sanitize-html.
What version fixes CVE-2024-21501?
Upgrading to 2.12.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is sanitize-html affected?
Yes, sanitize-html is affected in releases prior to 2.12.1. Upgrade your dependency to 2.12.1 or later.
What is the CVSS score of CVE-2024-21501?
CVE-2024-21501 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2024-21501?
CVE-2024-21501 is classified under CWE-538: Insertion of Sensitive Information into Externally-Accessible File or Directory (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.).
How can I check npm dependencies for CVE-2024-21501?
Run the dependency tree command: 'npm ls sanitize-html'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}