9.3critical
Parsed HTML anchor links in Markdown provided to parseMarkdown can result in XSS in @nuxtjs/mdc
- Severity
- 9.3critical CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.70% (higher than 54% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-j82m-pc2v-2484
Description
MDC is a tool to take regular Markdown and write documents interacting deeply with a Vue component. In affected versions 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. The parsing logic implement in `props.ts` maintains a deny-list approach to filtering potential malicious payload. It does so by matching protocol schemes like `javascript:` and others. These security guards can be bypassed by an adversarial that provides JavaScript URLs with HTML entities encoded via hex string. Users who consume this library and perform markdown parsing from unvalidated sources could result in rendering vulnerable XSS anchor links. This vulnerability has been addressed in version 0.13.3 and all users are advised to upgrade. There are no known workarounds for this vulnerability.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| nuxt-modules mdc | < 0.13.3 | CVE List |
| @nuxtjs/mdc (npm) | before 0.13.3 | GitHub Advisory Database |
All scores
| GitHub_M | 9.3critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:L |
| GitHub | 9.3critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:L |
Classification
SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial.
What each source says
CVE List
MDC is a tool to take regular Markdown and write documents interacting deeply with a Vue component. In affected versions 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. The parsing logic implement in `props.ts` maintains a deny-list approach to filtering potential malicious payload. It does so by matching protocol schemes like `javascript:` and others. These security guards can be bypassed by an adversarial that provides JavaScript URLs with HTML entities encoded via hex string. Users who consume this library and perform markdown parsing from unvalidated sources could result in rendering vulnerable XSS anchor links. This vulnerability has been addressed in version 0.13.3 and all users are advised to upgrade. There are no known workarounds for this vulnerability.
GitHub Advisory Database
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 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:
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:
# ✅ 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	ascript:alert('XSS');">Click Me 1</a>
- Bypass 2:
<a href="jav
ascript:alert('XSS');">Click Me 2</a>
- Bypass 3:
<a href="jav 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?
NVD (es)
MDC es una herramienta para tomar Markdown regular y escribir documentos que interactúan profundamente con un componente Vue. En las versiones afectadas, la lógica de análisis insegura de la URL de Markdown puede generar código JavaScript arbitrario debido a una omisión de las protecciones existentes en torno al esquema de protocolo `javascript:` en la URL. La lógica de análisis implementada en `props.ts` mantiene un enfoque de lista de denegación para filtrar el payload malicioso potencial. Lo hace al hacer coincidir esquemas de protocolo como `javascript:` y otros. Estas protecciones de seguridad pueden ser omitidas por un adversario que proporcione URL de JavaScript con entidades HTML codificadas a través de una cadena hexadecimal. Los usuarios que consumen esta librería y realizan análisis de Markdown desde fuentes no validadas podrían generar enlaces de anclaje XSS vulnerables. Esta vulnerabilidad se ha solucionado en la versión 0.13.3 y se recomienda a todos los usuarios que actualicen. No existen workarounds para esta vulnerabilidad.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-24981 changed 2025-02-12 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-j82m-pc2v-2484 changed 2025-02-13 | CC-BY-4.0 |
| NVD | CVE-2025-24981 changed 2026-06-17 | Public domain |