Skip to main content

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

| EUVDEUVD-2025-200113 MEDIUM
Improper Input Validation (CWE-20)
2025-12-01 security-advisories@github.com GHSA-4fh9-h7wg-q85m
6.9
CVSS 4.0 · Vendor: github
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Submit markdown with crafted code-fence language
  2. Exploit
    Character references decode into extra classNames
  3. Execution
    Code element gains unprefixed page classes
  4. Impact
    Spoofed styling or triggered JS listeners apply

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V2 - Validation and Business Logic Input validation, allowlisting
Exploitation Conditions

Exploitation requires the application to process attacker-controlled markdown through mdast-util-to-hast versions 13.0.0 up to but not including 13.2.1, specifically fenced code blocks whose language identifier the attacker can set and which contains HTML character references (e.g. `js xss). The limiting factor that sharply reduces real impact is that the injected unprefixed classnames (like 'xss') only produce visible or behavioral effect if the surrounding page independently defines CSS rules or JavaScript event listeners bound to those class names; absent such rules the extra classes are inert. No authentication, user interaction by a privileged operator, or non-default configuration is required beyond the baseline decision to render untrusted markdown.

Impact

All signals point to a low-priority, low-severity issue despite the 6.9 CVSS 4.0 score. The vendor vector (CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N) describes a remotely reachable, low-complexity, unauthenticated flaw, but the only impact metric set is VI:L (low integrity) with VC:N and VA:N - confirming there is no confidentiality or availability consequence; this is a markup/class-injection (spoofing) bug, not code execution or data theft. EPSS is very low at 0.08% (23rd percentile), the CVE is NOT in CISA KEV, and no weaponized exploit is tracked - the only exploitation proof is the demonstrative payload the GHSA advisory itself publishes. Critically, real-world impact is conditional: the injected unprefixed classes only matter if the hosting page defines CSS rules or JS listeners keyed on those exact class names, so actual harm is far narrower than the AV:N/PR:N metrics suggest. Net: a genuine-but-minor cosmetic/UI-spoofing defect, not an urgent patching priority; treat it as a routine dependency bump.

Exploit ScenarioDerived

An application renders untrusted user-supplied markdown (e.g. comments, issues, docs) through a vulnerable version of mdast-util-to-hast. An attacker submits a fenced code block whose language token embeds a character reference, such as `js&#x20;xss, which the library decodes into class="language-js xss" on the output <code> element. If the page's stylesheet or scripts act on the .xss class, the attacker's content can be made to mimic trusted page UI or trigger class-bound JavaScript behavior; the GHSA advisory includes this exact reproduction payload.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv2 – Oct 18, 2026

Renderer-side class injection in the mdast-util-to-hast npm package (13.0.0 up to but not including 13.2.1) lets attacker-supplied markdown smuggle extra, unprefixed class names onto generated HTML <code> elements, so an untrusted fenced code block can be made to look or behave like trusted page chrome. The fenced-code language identifier is read after HTML character references in the markdown source have been decoded, so a payload such as `js&#x20;xss renders as <code class="language-js xss">; the injected class only matters where the host page already defines CSS rules or JavaScript listeners bound to that name, which sharply limits real-world impact. Unauthenticated remote abuse is possible wherever untrusted markdown is rendered (CVSS 4.0 base 6.9, assessed CVSS 3.1 AV:N/AC:L/PR:N/UI:N/S:U/I:L), but no public exploit code or active exploitation has been identified at time of analysis and EPSS sits at roughly 0.08% (23rd percentile), consistent with a low-priority integrity-only issue rather than a high-severity one.

Earlier versions of this analysis (1)
v1 Mar 15, 2026 - 13:34 CVSS 5.3

RemediationAI

Vendor-released patch: upgrade mdast-util-to-hast to 13.2.1 or later (npm install mdast-util-to-hast@13.2.1, then refresh the lockfile with npm install); applications that only consume the package transitively should re-resolve dependencies or force the version with an npm overrides/Yarn resolutions entry until every parent package (remark-rehype, react-markdown, MDX toolchains) ships an updated dependency range, and should confirm the resolved version with npm ls mdast-util-to-hast or npm audit. The maintainers list no official workaround beyond updating, so where an immediate upgrade is impossible apply compensating controls at the render boundary: sanitize or normalize the fenced-code info string before it reaches the transformer, accepting only a strict ^[A-Za-z0-9_+-]+$ token and dropping anything containing whitespace or HTML character references, or strip the className property from generated code/pre nodes in a hast transform. Both of those will break or degrade syntax highlighting for language aliases that legitimately contain spaces or special characters, and a rehype-sanitize pass is a broader alternative that removes all class names, losing highlighting site-wide. Sites should also avoid binding security-relevant CSS selectors or JavaScript event listeners to generic global class names, since that is the precondition that turns this injection into a visible or behavioral defect. Advisory: https://github.com/syntax-tree/mdast-util-to-hast/security/advisories/GHSA-4fh9-h7wg-q85m.

Affected VersionsENISA

mdast-util-to-hast 13.0.0, < 13.2.1

Affected Packages

npm mdast-util-to-hast fix: 13.2.1

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

mdast-util-to-hast is the syntax-tree utility that converts an mdast (markdown abstract syntax tree) into hast (HTML abstract syntax tree); it sits at the core of the unified/remark ecosystem and is pulled in transitively by remark-rehype, react-markdown, MDX-style pipelines and countless documentation, comment and CMS renderers, which is why the CPE is scoped to the Node.js ecosystem (cpe:2.3:a:unifiedjs:mdast-util-to-hast:*:*:*:*:*:node.js:*:*). The root cause is improper input validation (CWE-20) in the fenced-code handler lib/handlers/code.js: the language- class is derived from the code block's info string after character references in the markdown source have already been decoded, and the historical logic that narrowed the language to a single token up to the first space or tab was weakened. As a result a decoded space (&#x20;) inside the info string yields a second, attacker-chosen class token that is carried through to properties.className and serialized into the HTML class attribute. The bug was introduced in commit 6fc783ae6abdeb798fd5a68e7f3f21411dde7403 and fixed in commit ab3a79570a1afbfa7efef5d4a0cd9b5caafbc5d7, shipped in 13.2.1. The security consequence is a markup-sanitization weakness rather than memory corruption: it is a class-attribute injection that becomes exploitable only when the surrounding application happens to bind styling or event handlers to the injected class names, which is why the advisory frames it as making untrusted code elements 'appear like the rest of the page'.

Know when Mdast Util To Hast gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (github) PRIMARY 6.9 MEDIUM
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
vuln.today AI 5.3 MEDIUM

Attacker-supplied markdown is processed remotely without auth (AV:N/AC:L/PR:N/UI:N); only integrity is lightly affected via injected classnames (I:L), with no confidentiality or availability impact.

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
4.0 AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N
SUSE 5.3 MEDIUM
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
Red Hat 5.3 MEDIUM

Primary rating from Vendor (github).

CVSS VectorVendor: github

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
Low
Vulnerable system: Availability
None
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

4
CVSS changed
Oct 18, 2026 - 18:22 NVD
5.3 (MEDIUM) 6.9 (MEDIUM)
Patch released
Mar 15, 2026 - 13:34 nvd
Patch available
CVE Published
Dec 01, 2025 - 23:15 cve.org
MEDIUM 6.9
CVE Published
Dec 01, 2025 - 23:15 nvd
MEDIUM 5.3

DescriptionCVE.org

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.

Executive ViewAI

Why It Matters

Organizations using mdast-util-to-hast should be aware of moderate risk from CVE-2025-66400, a input validation vulnerability rated CVSS 5.3. Exploitation could compromise the security of affected deployments. A patch is available and should be applied during regular vulnerability management.

Business Impact: Low
Compensating Controls

Apply vendor patch. If patching is delayed: deploy WAF rules, restrict network access, enable logging.

Threat Intelligence Overview

EPSS Score
0.1%
Top 77% exploitable
Prevalence
High
core unified/remark markdown-to-HTML library, dependency of react-markdown/rehype
Data Quality
6 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact
Low

Priority Score

34
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +34
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

Vendor StatusVendor

SUSE

Severity: Medium
Product Status
SUSE Linux Enterprise High Performance Computing 12 Fixed
SUSE Linux Enterprise High Performance Computing 15 SP7 Fixed
SUSE Linux Enterprise High Performance Computing 15 SP7 Fixed
SUSE Linux Enterprise Module for SAP Applications 15 SP7 Fixed
SUSE Linux Enterprise Module for Web and Scripting 15 SP7 Fixed

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy