# CVE-2025-66400: mdast-util-to-hast unsanitized class attribute

> Attackers can inject unprefixed class names into rendered markdown, potentially disguising malicious elements as legitimate page content.

- **Severity:** Medium 6.9 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 1 Dec 2025
- **Updated:** 2 Dec 2025
- **Also known as:** GHSA-4fh9-h7wg-q85m, MINI-3q6c-x3c8-36q7

## What is CVE-2025-66400?

CVE-2025-66400 is a medium-severity cross-site scripting vulnerability in syntax-tree mdast-util-to-hast, published on 1 Dec 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

mdast-util-to-hast is an mdast utility to transform to hast. From 13.0.0 to before 13.2.1, 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. This vulnerability is fixed in 13.2.1.

Weakness: CWE-915 (Improperly Controlled Modification of Dynamically-Determined Object Attributes), CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2025-66400?

2 open source packages ship an affected version, including mdast-util-to-hast. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `mdast-util-to-hast` | npm | From 13.0.0 | 13.2.1 |
| `mdast-util-to-hast` | npm | From 13.0.0 | 13.2.1 |

Products: Unifiedjs Mdast-Util-to-Hast.

## How do I fix CVE-2025-66400?

Upgrade mdast-util-to-hast to 13.2.1 or later.

## Is CVE-2025-66400 being exploited?

There is no known exploitation of CVE-2025-66400 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-66400 and fix it if it is affected.

What it is: CVE-2025-66400 is a medium-severity cross-site scripting vulnerability in syntax-tree mdast-util-to-hast, published on 1 Dec 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2025-66400 in the wild and no public exploit code.

Affected packages and fixed versions:
- mdast-util-to-hast (npm): affected from 13.0.0; fixed in 13.2.1
- mdast-util-to-hast (npm): affected from 13.0.0; fixed in 13.2.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-66400/ (Markdown: https://insights.sbomify.com/CVE-2025-66400/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-66400
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-66400
- OSV: https://osv.dev/vulnerability/CVE-2025-66400

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-66400/
Summaries are generated and may contain mistakes; the official description above is the record.
