Description
Astro is a web framework. Prior to 6.1.6, the defineScriptVars function in Astro's server-side rendering pipeline uses a case-sensitive regex /<\/script>/g to sanitize values injected into inline <script> tags via the define:vars directive. HTML parsers close <script> elements case-insensitively and also accept whitespace or / before the closing >, allowing an attacker to bypass the sanitization with payloads like </Script>, </script >, or </script/> and inject arbitrary HTML/JavaScript. This vulnerability is fixed in 6.1.6.
Published: 2026-04-24
Score: 6.1 Medium
EPSS: < 1% Very Low
KEV: No
Impact: Cross‑Site Scripting
Action: Apply Patch
AI Analysis

Impact

Astro’s server‑side rendering code, before version 6.1.6, sanitized values that are inserted into inline <script> tags via the define:vars directive with a case‑sensitive regular expression. Web browsers treat the closing </script> tag case‑insensitively and also accept variations that contain whitespace or a slash before the closing greater‑than sign, such as </Script>, </script >, or </script/>. An attacker can take advantage of this mismatch to inject arbitrary JavaScript or HTML into the rendered page, leading to classic cross‑site scripting that can hijack user sessions, steal credentials, or modify page content. The vulnerability does not expose system internals or allow arbitrary OS command execution, but it permits arbitrary script execution in the victim’s browser context, which is a high‑impact attack vector for web applications.

Affected Systems

The affected product is withastro:astro, any installation running a version older than 6.1.6. The flaw exists in Astro’s server‑side rendering pipeline, specifically the function that handles the define:vars directive. All Node.js environments that are serving Astro templates and have not upgraded past 6.1.6 remain vulnerable; this includes any web sites or applications that build or render pages with Astro and expose user‑controlled data to the define:vars directive.

Risk and Exploitability

The CVSS score is 6.1, indicating a moderate severity. The EPSS score is less than 1%, showing a very low probability of exploitation, and the bug is not listed in CISA’s KEV catalog. Exploitation requires that an attacker be able to supply data that Astro will inject into a <script> tag via define:vars, which usually means there is some user input or a configuration file that is rendered without proper validation. If such an input source exists, the attacker can inject the crafted closing tag variants and run arbitrary client‑side code; otherwise, the easily mitigable nature of the issue keeps the risk moderate.

Generated by OpenCVE AI on April 28, 2026 at 06:01 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Astro to version 6.1.6 or later to apply the patched sanitization logic.
  • Ensure that any data fed into the define:vars directive originates from trusted sources or is sanitized to remove <script> close tags before rendering.
  • Deploy a Content Security Policy that blocks inline scripts and restricts script execution to trusted origins as an additional defense while the patch is pending.

Generated by OpenCVE AI on April 28, 2026 at 06:01 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-j687-52p2-xcff Astro: XSS in define:vars via incomplete </script> tag sanitization
History

Mon, 27 Apr 2026 20:00:00 +0000

Type Values Removed Values Added
First Time appeared Withastro
Withastro astro
Vendors & Products Withastro
Withastro astro

Mon, 27 Apr 2026 13:45:00 +0000

Type Values Removed Values Added
First Time appeared Astro
Astro astro
CPEs cpe:2.3:a:astro:astro:*:*:*:*:*:node.js:*:*
Vendors & Products Astro
Astro astro

Fri, 24 Apr 2026 19:15:00 +0000

Type Values Removed Values Added
Metrics ssvc

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


Fri, 24 Apr 2026 17:15:00 +0000

Type Values Removed Values Added
Description Astro is a web framework. Prior to 6.1.6, the defineScriptVars function in Astro's server-side rendering pipeline uses a case-sensitive regex /<\/script>/g to sanitize values injected into inline <script> tags via the define:vars directive. HTML parsers close <script> elements case-insensitively and also accept whitespace or / before the closing >, allowing an attacker to bypass the sanitization with payloads like </Script>, </script >, or </script/> and inject arbitrary HTML/JavaScript. This vulnerability is fixed in 6.1.6.
Title Astro: XSS via incomplete `</script>` sanitization in `define:vars` allows case-insensitive and whitespace-based bypass
Weaknesses CWE-79
References
Metrics cvssV3_1

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


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-04-24T18:16:55.536Z

Reserved: 2026-04-16T16:43:03.174Z

Link: CVE-2026-41067

cve-icon Vulnrichment

Updated: 2026-04-24T17:30:46.335Z

cve-icon NVD

Status : Analyzed

Published: 2026-04-24T17:16:21.083

Modified: 2026-04-27T13:41:42.313

Link: CVE-2026-41067

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-04-28T06:15:24Z

Weaknesses