Loading...
Skip to main content

CVE-2025-24981 — Parsed HTML anchor links in @nuxtjs/mdc — CVE Details

CRITICAL

Parsed HTML anchor links in Markdown provided to parseMarkdown can result in XSS in @nuxtjs/mdc

Published February 6, 2025Updated February 13, 2025Source: osv

Summary

### Summary An unsafe parsing logic of the URL from markdown can lead to arbitrary JavaScript code due to a bypass to the existing guards around the `javascript:` protocol scheme in the URL. ### Details The parsing logic implement at [https://github.com/nuxt-modules/mdc/blob/main/src/runtime/parser/utils/props.ts#L16](https://github.com/nuxt-modules/mdc/blob/main/src/runtime/parser/utils/props.ts#L16) maintains a deny-list approach to filtering potential malicious payload. It does so by matching protocol schemes like `javascript:` and others. Specifically, this is the code from the mdc library's parser that is not secure enough: ```js export const unsafeLinkPrefix = [ 'javascript:', 'data:text/html', 'vbscript:', 'data:text/javascript', 'data:text/vbscript', 'data:text/css', 'data:text/plain', 'data:text/xml' ] export const validateProp = (attribute: string, value: string) => { if (attribute.startsWith('on')) { return false } if (attribute === 'href' || attribute === 'src') { return !unsafeLinkPrefix.some(prefix => value.toLowerCase().startsWith(prefix)) } return true } ``` These security guards can be bypassed by an adversarial that provides JavaScript URLs with HTML entities encoded via hex string. ### PoC The following URL payloads if provided to the markdown parsing library (such as through the usage of `import { parseMarkdown } from '@nuxtjs/mdc/runtime';`) will trigger the alert() dialog: ```markdown # ✅ This is correctly escaped by the parser - XSS Attempt: <a href="javascript:alert(1)"> this gets sanitizied, yay!</a> # ❌ These are vulnerable and not escaped - Bypass 1: <a href="jav&#x09;ascript:alert('XSS');">Click Me 1</a> - Bypass 2: <a href="jav&#x0A;ascript:alert('XSS');">Click Me 2</a> - Bypass 3: <a href="jav&#10;ascript:alert('XSS');">Click Me 3</a> ``` ### Impact Users who consume this library and perform markdown parsing from unvalidated sources such as LLM generative text responses, user input and other untrusted sources could result in rendering vulnerable XSS anchor links. ## Reference You may infer the following write-up for more in-depth walkthrough of URL parsing problems and suggestions on how to securely address them: [How to Parse URLs from Markdown to HTML Securely?](https://www.nodejs-security.com/blog/how-to-parse-urls-from-markdown-to-html-securely)

Advisory Timeline

  • First published February 6, 2025 (613 days ago).
  • Last revised February 13, 2025 — 7 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

npm
Update @nuxtjs/mdc to 0.13.3 or later
npm install @nuxtjs/mdc@0.13.3

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: npm (1).

PackageEcosystemAffectedFixed In
@nuxtjs/mdc
npm
All versions0.13.3

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-79
    Cross-site Scripting (XSS)MITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 9.3 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
None
Availability
Low

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:L

Frequently Asked Questions

What is CVE-2025-24981?
Parsed HTML anchor links in Markdown provided to parseMarkdown can result in XSS in @nuxtjs/mdc This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.3/10).
How do I check if my project is affected by CVE-2025-24981?
CVE-2025-24981 affects @nuxtjs/mdc. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2025-24981 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
9.3

Exploitation is straightforward and causes maximum impact. Patch immediately.

Also Known As

GHSA-j82m-pc2v-2484

Related CVEs

  • CVE-2026-107722
    CRITICAL

    fast-jwt: Incomplete patch of CVE-2026-34950: Non-whitespace key-prefix re-enables RSA→HS256 algorithm confusion

  • CVE-2026-108261
    CRITICAL

    TinaCMS admin preview iframe loads an attacker-controlled origin from the URL fragment

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies