# CVE-2025-66400: mdast-util-to-hast XSS — Fixed in 13.2.1

📦 npm

Not in CISA KEV

# CVE-2025-66400 — mdast-util-to-hast

[Fix: syntax-tree/mdast-util-to-hast@6fc783a](https://github.com/syntax-tree/mdast-util-to-hast/commit/6fc783ae6abdeb798fd5a68e7f3f21411dde7403)

CVE-2025-66400 is a Improper Input Validation vulnerability in mdast-util-to-hast. A fix is available for mdast-util-to-hast — see the affected versions and patch details below.

mdast-util-to-hast unsanitized class attribute

Also known as[GHSA-4fh9-h7wg-q85m](/vulnerability/GHSA-4fh9-h7wg-q85m)

Published

Dec 1, 2025

Updated

Oct 28, 2026

Affected

1 pkg

Patched

1 / 1

Exploits

None indexed

Exploitation data as of Nov 6, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

## Exploitation Status

### No confirmed exploitation observed yet

-   CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
-   CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.

Exploitation and automatability from CISA’s SSVC triage for CVE-2025-66400.

## EPSS Exploitation Probability

[via FIRST.org ↗](https://www.first.org/epss/)

0.3%probability of exploitation in next 30 days

Lower Risk0.00%

Lower risk than most CVEs26th percentile — riskier than 26% of all scored CVEsHighest risk

0.00%0.28%0.55%0.83%0.1%0.3%May 26Sep 26Nov 26

Probability of exploitation in the next 30 days, from [FIRST.org EPSS](https://www.first.org/epss/).

## Real-World Exposure

1 pkg affected

How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.

405other npm packages depend on this — each one inherits the vulnerability until it's patched upstream

`mdast-util-to-hast`npm

81.3Mdownloads / week

## Description

#### 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:

````
```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](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](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](https://github.com/syntax-tree/mdast-util-to-hast/commit/ab3a79570a1afbfa7efef5d4a0cd9b5caafbc5d7)

## Affected Packages

1 total 1 fixed

Ecosystem

Package

Vulnerable range

Fix

📦npm

`mdast-util-to-hast` 

≥ 13.0.0&&< 13.2.1

13.2.1`npm install mdast-util-to-hast@13.2.1`

## Affected Products

1 product · 1 configurations

Application

`mdast-util-to-hast`unifiedjs

≥ 13.0.0 && < 13.2.1

range

## Detection & mitigation playbook

Open-source dependency

1.  ### Detect
    
    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for mdast-util-to-hast, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
    
2.  ### Fix
    
    Update mdast-util-to-hast to 13.2.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2025-66400 is resolved across your whole dependency graph.
    
3.  ### Workarounds
    
    Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.
    

## Fixing This On Your OS

If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.

Red HatModerate

This vulnerability is rated Moderate for Red Hat products. The \`mdast-util-to-hast\` library, in versions 13.0.0 to before 13.2.1, allows unsanitized class attributes in user-supplied markdown. This could enable an attacker to alter the visual presentation of rendered markdown code elements, potentially leading to user…

Workaround published by Red Hat

> Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base, or stability.

Source: [Red Hat security advisory for CVE-2025-66400](https://access.redhat.com/security/cve/cve-2025-66400) (CC BY 4.0)

## Frequently Asked Questions

\### 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 re

O3 Security · Impact-Aware SCA

### Is CVE-2025-66400 in your dependencies?

Find it across npm, including transitive dependencies.

[Scan my dependencies](/book-demo) [How O3 SCA works](/impact-aware-sca)