CVE-2025-66400: Mdast util to hast Mdast-util-to-hast Has Unsanitized Class Attribute Vulnerability

MODERATE
Advisory Identifier: GHSA-4fh9-h7wg-q85m
CVSS 5.3
CWE-20 CWE-915
Published
Advisory Summary

CVE-2025-66400 is a MODERATE (CVSS 5.3) mdast-util-to-hast has unsanitized class attribute vulnerability (CWE-20: Improper Input Validation) affecting Mdast util to hast libraries in the npm ecosystem. The issue involves mdast-util-to-hast has unsanitized class attribute. Remediation is available by upgrading affected packages to version 13.2.1.

CVE-2025-66400 at a Glance

CVE Identifier CVE-2025-66400
GHSA Identifier GHSA-4fh9-h7wg-q85m
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-20: Improper Input Validation
Affected Product Mdast util to hast
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:N/I:L/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 None (C:N)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2025-66400

To remediate this vulnerability, upgrade all affected Mdast util to hast dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mdast-util-to-hast fixed: 13.2.1
npm install mdast-util-to-hast@13.2.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 mdast-util-to-hast

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-66400, inspect your project dependencies using npm:

npm ls mdast-util-to-hast

Analyze the terminal output to locate any version of Mdast util to hast in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 13.2.1), your application is affected.

Note: The npm ls mdast-util-to-hast 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-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 Mdast util to hast, 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

### Impact Multiple (unprefixed) classnames could be added in markdown source by using character references. This could make rendered user supplied markdown `code` elements appear like the rest of the page. The following markdown: ````markdown ```js&#x20;xss ``` ```` Would create `<pre><code class="language-js xss"></code></pre>` If your page then applied `.xss` classes (or listeners in JS), those apply to this element. For more info see <https://github.com/ChALkeR/notes/blob/master/Improper-markup-sanitization.md#unsanitized-class-attribute> ### Patches The bug was patched. When using regular semver, run `npm install`. For exact ranges, make sure to use `13.2.1`. ### Workarounds Update. ### References * bug introduced in https://github.com/syntax-tree/mdast-util-to-hast/commit/6fc783ae6abdeb798fd5a68e7f3f21411dde7403 * bug fixed in https://github.com/syntax-tree/mdast-util-to-hast/commit/ab3a79570a1afbfa7efef5d4a0cd9b5caafbc5d7

CVE-2025-66400 Affected Mdast util to hast Versions

1 component(s)
Fixed Versions:
13.2.1
Product / Package Ecosystem Affected Versions Fixed Version
mdast-util-to-hast
npm
≥ 13.0.0
< 13.2.1
13.2.1

References

Frequently Asked Questions

What is CVE-2025-66400?
CVE-2025-66400 is a security vulnerability in Mdast util to hast involving mdast-util-to-hast has unsanitized class attribute under CWE-20: Improper Input Validation.
Which Mdast util to hast versions are affected?
Affected versions include releases prior to 13.2.1 across affected packages: mdast-util-to-hast.
What version fixes CVE-2025-66400?
Upgrading to 13.2.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mdast-util-to-hast affected?
Yes, mdast-util-to-hast is affected in releases prior to 13.2.1. Upgrade your dependency to 13.2.1 or later.
What is the CVSS score of CVE-2025-66400?
CVE-2025-66400 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:N/I:L/A:N.
What CWE is associated with CVE-2025-66400?
CVE-2025-66400 is classified under CWE-20: Improper Input Validation (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.).
How can I check npm dependencies for CVE-2025-66400?
Run the dependency tree command: 'npm ls mdast-util-to-hast'. 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-4fh9-h7wg-q85m",
  "modified" : "2026-02-06T19:00:13Z",
  "published" : "2025-12-02T01:25:46Z",
  "aliases" : [ "CVE-2025-66400" ],
  "summary" : "mdast-util-to-hast has unsanitized class attribute",
  "details" : "### Impact\n\nMultiple (unprefixed) classnames could be added in markdown source by using character references.\nThis could make rendered user supplied markdown `code` elements appear like the rest of the page.\nThe following markdown:\n\n````markdown\n```js&#x20;xss\n```\n````\n\nWould create `<pre><code class=\"language-js xss\"></code></pre>`\nIf your page then applied `.xss` classes (or listeners in JS), those apply to this element.\nFor more info see <https://github.com/ChALkeR/notes/blob/master/Improper-markup-sanitization.md#unsanitized-class-attribute>\n\n### Patches\n\nThe bug was patched. When using regular semver, run `npm install`. For exact ranges, make sure to use `13.2.1`.\n\n### Workarounds\n\nUpdate.\n\n### References\n\n* bug introduced in https://github.com/syntax-tree/mdast-util-to-hast/commit/6fc783ae6abdeb798fd5a68e7f3f21411dde7403\n* bug fixed in https://github.com/syntax-tree/mdast-util-to-hast/commit/ab3a79570a1afbfa7efef5d4a0cd9b5caafbc5d7",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "mdast-util-to-hast"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "13.0.0"
      }, {
        "fixed" : "13.2.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/syntax-tree/mdast-util-to-hast/security/advisories/GHSA-4fh9-h7wg-q85m"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-66400"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/syntax-tree/mdast-util-to-hast/commit/6fc783ae6abdeb798fd5a68e7f3f21411dde7403"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/syntax-tree/mdast-util-to-hast/commit/ab3a79570a1afbfa7efef5d4a0cd9b5caafbc5d7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/syntax-tree/mdast-util-to-hast"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-915" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-12-02T01:25:46Z",
    "nvd_published_at" : "2025-12-01T23:15:53Z"
  }
}