6.9medium
mdast-util-to-hast unsanitized class attribute
- Severity
- 6.9medium CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.33% (higher than 27% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-4fh9-h7wg-q85m
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| syntax-tree mdast-util-to-hast | >= 13.0.0, < 13.2.1 | CVE List |
| mdast-util-to-hast (npm) | from 13.0.0 before 13.2.1 | GitHub Advisory Database |
| unifiedjs mdast-util-to-hast | from 13.0.0 before 13.2.1 | NVD |
All scores
| GitHub_M | 6.9medium CVSS:4.0 | 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 |
| GitHub | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N |
| GitHub | medium CVSS:4.0 | 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 |
| NVD | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N |
Classification
What each source says
CVE List
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.
GitHub Advisory Database
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 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
NVD (es)
mdast-util-to-hast es una utilidad de mdast para transformar a hast. Desde la 13.0.0 hasta la 13.2.1, múltiples nombres de clase (sin prefijo) podían añadirse en el código fuente de markdown mediante el uso de referencias de caracteres. Esto podría hacer que los elementos de código markdown renderizados y proporcionados por el usuario aparecieran como el resto de la página. Esta vulnerabilidad está corregida en la 13.2.1.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-66400 changed 2025-12-02 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-4fh9-h7wg-q85m changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2025-66400 changed 2026-10-18 | Public domain |