Skip to main content

Astro CVE-2026-59729

| EUVDEUVD-2026-49580 MEDIUM
Cross-site Scripting (XSS) (CWE-79)
2026-07-20 https://github.com/withastro/astro GHSA-f48w-9m4c-m7f5
5.1
CVSS 4.0 · Vendor: https://github.com/withastro/astro
View

Attack ChainAIDerived

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

  1. Access
    Attacker identifies Astro SSR page spreading URL params onto HTMLElement subclass component
  2. Delivery
    Crafts URL with malicious query parameter key (e.g., 'onmouseover=alert(1) x')
  3. Exploit
    Server-side renderHTMLElement interpolates key raw into attribute name string
  4. Execution
    Malicious attribute or script tag injected verbatim into SSR HTML response
  5. Persist
    Victim loads crafted URL in browser
  6. Impact
    Browser executes injected event handler or script under application origin

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 three concurrent conditions to be satisfied simultaneously. First, the Astro SSR runtime must expose a global HTMLElement object - this is true for Deno, Bun (with a DOM shim enabled), or Node.js augmented with jsdom or happy-dom, but is FALSE for standard Node.js SSR where HTMLElement is undefined and the renderHTMLElement branch is never reached. Second, the application must use a class that extends HTMLElement directly as an Astro component. Third, that component must receive spread props whose keys originate from untrusted user input - for example, Object.fromEntries(Astro.url.searchParams) passed via the spread operator. All three conditions must be simultaneously present. The dominant limiting factor for most deployments is the first condition: standard Node.js is by far the most common Astro SSR runtime, and on standard Node.js this vulnerability is entirely unexploitable without a DOM shim. Authenticated or unauthenticated status depends on whether the targeted application requires login before accessing the vulnerable page; the vulnerability itself imposes no authentication prerequisite.

Impact

Real-world risk is moderate but significantly constrained by runtime and application-design preconditions. No CVSS or EPSS score was provided by NVD; the assessment below is independently derived. This CVE is not listed in CISA KEV, and no active exploitation has been reported, though a working proof of concept is publicly available in the GitHub security advisory. The critical limiting factor is reachability: the vulnerable branch executes only when the SSR runtime exposes a global HTMLElement object. Standard Node.js SSR - by far the most common Astro deployment target - leaves HTMLElement as undefined, making this branch entirely dead and the vulnerability unexploitable. Only deployments on Deno, Bun with a DOM shim, or Node.js augmented with jsdom/happy-dom are practically reachable. Additionally, the application must explicitly use a native HTMLElement-subclass class as an Astro component and spread user-controlled prop keys onto it - both are deliberate architectural choices, not default patterns. The combination of a non-default runtime requirement and specific application design significantly narrows the exposed population despite the public POC. Teams running standard Node.js SSR can treat this as low priority; those running Deno, Bun, or jsdom-augmented Node.js with custom elements should patch promptly given the available exploit demonstration.

Exploit ScenarioDerived

A working proof of concept is documented in the GitHub advisory. An attacker targets an Astro SSR application hosted on Deno or Bun that renders a page using a native HTMLElement-subclass component with user-supplied URL search parameters spread as props. The attacker crafts a URL containing a query parameter whose key is a string such as 'onmouseover=alert(document.domain) x' or 'x><script>alert(1)</script>'; renderHTMLElement interpolates this key raw into the attribute string, injecting the event handler or script tag directly into the server-rendered HTML. Any victim who browses to the crafted URL will have the injected JavaScript execute in their browser under the application's origin.

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

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

Alert me

AnalysisAIv1 – Jul 20, 2026

XSS via unescaped attribute name interpolation in Astro's renderHTMLElement affects all versions of the npm package 'astro' prior to 7.0.6, representing an incomplete fix for CVE-2026-54298. The renderHTMLElement() function in dom.ts interpolates spread prop keys directly into HTML attribute names without sanitization - escaping only the value - allowing an attacker who controls prop key names on a native HTMLElement-subclass Astro component to inject event-handler attributes or sibling script elements into SSR-rendered output. Exploitation is constrained to SSR runtimes that expose a global HTMLElement (Deno, Bun with a DOM shim, jsdom/happy-dom in Node); standard Node.js SSR is not reachable. A proof of concept is publicly available in the GitHub advisory (GHSA-f48w-9m4c-m7f5). This CVE is not listed in CISA KEV.

RemediationAI

Upgrade to astro@7.0.6 or later, which applies the INVALID_ATTR_NAME_CHAR guard to renderHTMLElement() in dom.ts - the same guard already in place in addAttribute() in util.ts. The patch is at https://github.com/withastro/astro/pull/17251, with the commit at https://github.com/withastro/astro/commit/5240e26c9dd91f9bc7140dcfacdb48d5a132830d and the release at https://github.com/withastro/astro/releases/tag/astro@7.0.6. If an immediate upgrade is not feasible and the deployment uses Deno, Bun with DOM shims, or jsdom/happy-dom, the most targeted workaround is to audit all Astro components that extend HTMLElement and replace unconstrained spread of user input (e.g., Object.fromEntries(Astro.url.searchParams)) with an explicit allowlist of known-safe prop key names before spreading - this eliminates the untrusted-key condition without requiring a runtime change. As a more aggressive workaround, removing or disabling HTMLElement-subclass Astro components in affected runtimes eliminates the attack surface entirely, at the cost of losing custom element SSR support. Standard Node.js SSR deployments without jsdom or happy-dom are not reachable via this path and can deprioritize the upgrade.

Affected VersionsENISA

astro < 7.0.6

Affected Packages

npm astro fix: 7.0.6

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Astro (pkg:npm/astro) is a JavaScript web framework supporting SSR. The vulnerable code resides in packages/astro/src/runtime/server/render/dom.ts within renderHTMLElement(), which handles Astro components that are native HTMLElement subclasses (custom elements). The function builds attribute HTML via direct string interpolation: attrHTML += ${attr}="${toAttributeString(await props[attr])}" - where the prop key (attr) is inserted raw while only the value is sanitized by toAttributeString. CWE-79 (Improper Neutralization of Input During Web Page Generation) is the root cause class. The incomplete fix history is the key context: CVE-2026-54298 added an INVALID_ATTR_NAME_CHAR guard (/[\s"'>/=]/) to addAttribute() in util.ts, but renderHTMLElement() maintained its own parallel attribute loop that was never updated to apply the same guard. The fix for this CVE exports INVALID_ATTR_NAME_CHAR from util.ts and imports it into dom.ts, applying an identical guard inside the renderHTMLElement attribute loop with a continue statement to skip invalid keys. The routing into the vulnerable path occurs in component.ts when typeof HTMLElement === 'function' and componentIsHTMLElement(Component) returns true.

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/withastro/astro) PRIMARY 5.1 MEDIUM
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
vuln.today AI 4.7 MEDIUM

AC:H reflects three simultaneous preconditions (non-default runtime, custom element component, untrusted key spread); S:C and UI:R reflect classic reflected XSS impacting the victim browser.

3.1 AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N
4.0 AV:N/AC:H/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N

Primary rating from Vendor (https://github.com/withastro/astro).

CVSS VectorVendor: https://github.com/withastro/astro

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
Active
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
None
Vulnerable system: Availability
None
Subsequent system: Confidentiality
Low
Subsequent system: Integrity
Low
Subsequent system: Availability
None

Lifecycle Timeline

1
CVSS changed
Jul 27, 2026 - 20:22 NVD
5.1 (MEDIUM)

DescriptionCVE.org

Summary

The fix for CVE-2026-54298 (GHSA-jrpj-wcv7-9fh9) added an INVALID_ATTR_NAME_CHAR guard to addAttribute() so that spread-prop attribute names containing "' >/= or whitespace are dropped. A second attribute-rendering path, renderHTMLElement() in packages/astro/src/runtime/server/render/dom.ts, has its own inline attribute loop that does not go through addAttribute() and was not updated. It interpolates the attribute name unescaped and only escapes the value, so untrusted prop keys spread onto a native-HTMLElement-subclass component can still break out of the attribute context, resulting in XSS.

Details

renderHTMLElement builds attributes directly:

js
for (const attr in props) {
  attrHTML += ` ${attr}="${toAttributeString(await props[attr])}"`;
}

The attribute name (attr) is interpolated raw; only the value is escaped via toAttributeString. By contrast, the hardened addAttribute in util.ts rejects invalid names:

js
if (INVALID_ATTR_NAME_CHAR.test(key)) { return ''; } // /[\s"'>/=]/

renderHTMLElement is reached from component.ts when the component is a native HTMLElement subclass:

js
if (!renderer && typeof HTMLElement === 'function' && componentIsHTMLElement(Component)) {
  const output = await renderHTMLElement(result, Component, _props, slots);
}

where _props carries spread props verbatim.

Reachability

The branch only runs when typeof HTMLElement === 'function' at SSR time. In default Node SSR HTMLElement is undefined, so the branch is dead. It becomes reachable when the SSR runtime exposes a global HTMLElement (Deno, Bun with a DOM shim, or jsdom/happy-dom in Node) and a class extending HTMLElement is used directly as an Astro component that receives untrusted-keyed spread props.

Proof of Concept

Given malicious spread props:

js
const maliciousProps = {
  'onmouseover=alert(document.domain) x': 'y',
  'x><script>alert(1)</script>': 'z',
};
  • addAttribute (post-fix) → <my-el></my-el> (key stripped - safe)
  • renderHTMLElement → <my-el onmouseover=alert(document.domain) x="y" x><script>alert(1)</script>="z"></my-el> (handler + <script> injected - XSS)

Equivalent Astro template, served by an SSR runtime that defines a global HTMLElement:

astro
---
import MyElement from '../MyElement.js'; // class MyElement extends HTMLElement {}
const userInput = Astro.url.searchParams;  // untrusted keys
---
<MyElement {...Object.fromEntries(userInput)} />

Impact

Cross-site scripting (CWE-79) via attribute-name breakout - the same vulnerability class as CVE-2026-54298, in a code path its fix did not cover. An attacker who controls the keys of an object spread onto a native-HTMLElement-subclass component can inject arbitrary event-handler attributes or sibling elements (including <script>) into the SSR output. Reachability is constrained by the runtime and component preconditions described above.

Threat Intelligence Overview

EPSS Score
0.3%
Top 75% exploitable
Prevalence
Medium
popular modern JS web framework, not universally deployed
Threat Intel
1
1 source
Data Quality
5 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.3%
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

26
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +26
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.

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