# CVE-2026-50146: withastro Astro reflected XSS in data-astro-template attribute

Source: https://junglewise.ai/threats/cve-2026-50146-withastro-astro-reflected-xss-in-data-astro-template-attribute  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-06-22. Updated: 2026-06-22  
License: CC BY 4.0 with a link back

CVE-2026-50146 · Severity: high · CVSS 7.1 · Published 2026-06-22

Astro is a web framework used to build fast, content-driven websites. A security flaw in how the framework handles component templates allows attackers to inject malicious scripts into a website if the site uses dynamic slot names based on user input. This could lead to unauthorized actions being performed in a user's browser, such as stealing session information or defacing the site's content.

Technologies: [astro (npm)](https://junglewise.ai/threats/technologies/astro). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2026-50146 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-50146 being exploited in the wild.

**How severe is CVE-2026-50146?** High severity, with a CVSS score of 7.1, published 22 June 2026.

**Which products and versions are affected?** astro (npm) < 6.3.3, SEMVER:introduced=0,fixed=6.3.3.

**Is there a fix for CVE-2026-50146?** Yes. astro (npm): upgrade to 6.3.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-50146 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-50146?** Check whether you run astro (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- astro (npm): upgrade to 6.3.3 or later

  ```sh
  npm install astro@6.3.3
  ```


## Technical details

A reflected Cross-Site Scripting (XSS) vulnerability exists in Astro's Server-Side Rendering (SSR) engine. When a component utilizes a 'client:*' directive, the framework generates a 'data-astro-template' attribute. The 'key' representing the slot name is interpolated directly into this attribute without proper HTML escaping in 'packages/astro/src/runtime/server/render/component.ts'. An attacker can provide a crafted slot name (e.g., via URL parameters) containing quotes and HTML tags to break out of the attribute context and execute arbitrary JavaScript in the victim's browser. This issue is fixed in version 6.3.3 by applying HTML escaping to the slot name.

## Affected products

- withastro Astro < 6.3.3

## Identifiers

- CVE-2026-50146
- GHSA-8hv8-536x-4wqp

## Timeline

- 2026-06-12: advisory: GitHub Security Advisory published by maintainers
- 2026-06-22: disclosed: CVE published to NVD
- 2026-06-22: patched: Fix confirmed in version 6.3.3

## References

- [https://github.com/withastro/astro/security/advisories/GHSA-8hv8-536x-4wqp](https://github.com/withastro/astro/security/advisories/GHSA-8hv8-536x-4wqp)

## Related threats

- [Astro HTML injection in script and style element rendering](https://junglewise.ai/threats/cve-2026-114128-astro-is-a-web-framework-for-content-driven-websites-prior-to-7)
- [Astro CSS injection in View Transition animation values](https://junglewise.ai/threats/cve-2026-114127-astro-is-a-web-framework-for-content-driven-websites-from-7-1-0)
- [Astro remote code execution via AVIF image processing](https://junglewise.ai/threats/astro-remote-code-execution-via-avif-image-processing-6b99ffe8)
- [Astro authorization bypass in base path stripping](https://junglewise.ai/threats/cve-2026-84376-astro-authorization-bypass-in-base-path-stripping)
- [Astro composable astro/hono pipeline CSRF via origin check bypass](https://junglewise.ai/threats/cve-2026-73423-astro-composable-astro-hono-pipeline-csrf-via-origin-check-bypass)
