CVE-2026-126365: Astro: XSS via unescaped code for unsupported languages in @astrojs/prism
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.
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
@astrojs/prismto a version that resolves this vulnerability.Fixed in 4.1.2 - Upgrade
Upgrade
@astrojs/markdocto a version that resolves this vulnerability.Fixed in 2.1.2
Event History
Frequently Asked Questions
Which deployments are exposed?
Applications using @astrojs/prism before 4.1.2 are affected when they pass untrusted code together with an unsupported or attacker-controlled language identifier to the Prism component. Applications using the @astrojs/markdoc prism() extension from 0.3.0 through before 2.1.2 are affected when less-trusted authors can provide content.
Does disabling ordinary HTML rendering in Markdoc prevent this issue?
No. The @astrojs/markdoc prism() extension can be affected for less-trusted content authors even when Markdoc's ordinary HTML rendering is disabled.
What must an attacker control to exploit the issue?
The attacker needs to provide code content containing HTML or script and have it processed with a language for which Prism has no grammar. For the Prism component, the language value must be unsupported or attacker-controlled; for the Markdoc extension, less-trusted content authors can supply the triggering content.
Which versions contain fixes?
The issue is fixed in @astrojs/prism 4.1.2 and @astrojs/markdoc 2.1.2.