npm package report

Is @marko/runtime-tags safe?

1 known vulnerability, worst severity MODERATE.

// reach

0 direct dependencies

none carry a known advisory

    0 packages depend on it

    an advisory here reaches each of them

      Create a free accountfor every dependency path, dependent and what to upgrade
      // ai model usage

      Tracked for PyPI packages. HuggingFace models declare Python dependencies, so npm packages are not covered.


      cvss
      0.0
      medium

      severity out of 10

      epss
      0.00%
      low

      chance of exploitation in 30 days, 17th percentile of all CVEs

      xyz score
      not scored

      CyberXYZ composite out of 10

      fig. 01 — GHSA-x9fj-57fh-c8wq, the advisory selected below

      // 1 advisories

      GHSA-x9fj-57fh-c8wq

      MODERATECVE-2026-41591
      // summary

      When dynamic text is interpolated into a or 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 or block could break out of the tag with , , 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 = /`, ``, or `` 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 `` and `` 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 = "alert(1)//";

      const data = ${JSON.stringify(userCode)};

      Would yield the following:

      const data = "alert(1)//";

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

      const data = " alert(1)//";

      ### Impact
      
      Cross-site scripting. Any Marko template that explicitly interpolates untrusted data inside a `` or `` 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  or  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 `` or `` tag — e.g. normalize `</script`, `</style`, and their mixed-case variants before interpolation, or avoid direct interpolation of untrusted values inside these tags entirely.
      // cvss v3.1 vector

      CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N

      Attack vector
      Network
      Attack complexity
      Low
      Privileges required
      Low
      User interaction
      None
      Scope
      Changed
      Confidentiality
      Low
      Integrity
      Low
      Availability
      None

      Checked 2026-09-27 at 21:37 UTC. The most recent advisory here was published 2026-04-22. Updated continuously from NVD, GHSA, OSV and CNA feeds.

      Think a verdict here is wrong? Tell us — we respond within 2 business days.