CVE-2026-126365

Astro: XSS via unescaped code for unsupported languages in @astrojs/prism

Published Nov 12, 2026 CVSS 3.1 · 5.4 Medium EPSS < 1% KEV · Not listed
Description
Astro is a web framework for content-driven websites. Prior to @astrojs/prism 4.1.2, and from @astrojs/markdoc 0.3.0 until 2.1.2, runHighlighterWithAstro() returned code unchanged when Prism had no grammar for the requested language, and callers inserted that result as raw HTML. A code block labeled with an unsupported language could therefore render embedded HTML and script instead of displaying it as text. The Prism component was affected when applications supplied untrusted code with an unsupported or attacker-controlled lang, and the @astrojs/markdoc prism() extension was affected for less-trusted content authors even when Markdoc's ordinary HTML rendering was disabled. This issue is fixed in @astrojs/prism 4.1.2 and @astrojs/markdoc 2.1.2.

Analysis

AI-generated

Technical impact

Astro’s Prism syntax‑highlighter component returned code unchanged when Prism had no grammar for a requested language. Callers inserted that unchanged output as raw HTML, allowing code blocks labeled with unsupported or attacker‑controlled languages to embed arbitrary HTML and script, which can execute in the viewer’s browser. The flaw is a classic cross‑site scripting vulnerability that can compromise the confidentiality, integrity, and availability of the rendered page for any user who views the affected content.

Affected Systems

The vulnerability affects the Astro web framework and its extensions @astrojs/prism and @astrojs/markdoc. Versions of @astrojs/prism prior to 4.1.2 and @astrojs/markdoc from 0.3.0 through 2.1.2 are vulnerable. The issue is present when user or untrusted content includes code blocks with an unsupported language tag, leading to injection of arbitrary HTML or scripts.

Risk and Exploitability

The CVSS score of 5.4 indicates moderate severity, and the EPSS score of less than 1% suggests a low probability of exploitation. The vulnerability is not listed in the CISA KEV catalog. Attackers can exploit it via content submission or authoring features that allow untrusted code to be processed by Prism or the Markdoc prism extension. Once successful, the attacker can execute arbitrary scripts in the context of the page, potentially stealing user data or defacing the site.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade @astrojs/prism to 4.1.2 and @astrojs/markdoc to 2.1.2 as soon as possible.
  • Validate language tags before rendering or remove unsupported ones from code blocks, ensuring only supported grammar identifiers are accepted for Prism processing.
  • If an immediate upgrade is infeasible, restrict the use of Prism or the Markdoc prism extension to trusted content only and block or sanitize code blocks that contain unsupported language attributes.

Generated by OpenCVE AI on November 13, 2026 at 16:12 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Astro
Astro astro
Astro markdoc
Astro prism
Withastro
Withastro astro
Vendors & Products Astro
Astro astro
Astro markdoc
Astro prism
Withastro
Withastro astro
Type Values Removed Values Added
Description Astro is a web framework for content-driven websites. Prior to @astrojs/prism 4.1.2, and from @astrojs/markdoc 0.3.0 until 2.1.2, runHighlighterWithAstro() returned code unchanged when Prism had no grammar for the requested language, and callers inserted that result as raw HTML. A code block labeled with an unsupported language could therefore render embedded HTML and script instead of displaying it as text. The Prism component was affected when applications supplied untrusted code with an unsupported or attacker-controlled lang, and the @astrojs/markdoc prism() extension was affected for less-trusted content authors even when Markdoc's ordinary HTML rendering was disabled. This issue is fixed in @astrojs/prism 4.1.2 and @astrojs/markdoc 2.1.2.
Title Astro: XSS via unescaped code for unsupported languages in @astrojs/prism
Weaknesses CWE-79
References
Metrics cvssV3_1

{'score': 5.4, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N'}

Weaknesses
  • CWE-79

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Nov 17, 2026, 7:17 PM
Reserved
Nov 10, 2026, 9:12 PM
Status
Awaiting Analysis
Published
Nov 13, 2026, 12:20 AM
Modified
Nov 17, 2026, 10:17 PM
Severity
Moderate
Public date
Nov 12, 2026, 10:36 PM