---
title: "GHSA-mh32-jxcr-mh9f: Astro: XSS via attribute injection in dynamic tag names"
description: "Low severity. Astro: XSS via attribute injection in dynamic tag names. Affects astro; fixed in 7.4.5."
url: https://inlinr.com/advisories/GHSA-mh32-jxcr-mh9f
lang: en
---

[Packages](https://inlinr.com/packages) / [astro](https://inlinr.com/packages/astro) / [Security](https://inlinr.com/packages/astro/security)

Low Vulnerability GHSA-mh32-jxcr-mh9f CVE-2026-126361 Published 13 Nov 2026

# Astro: XSS via attribute injection in dynamic tag names

Your version 

Affected releases · [astro](https://inlinr.com/packages/astro)

- 7.x 7.0.0 – 7.4.4 Fixed in 7.4.5
- 6.x 6.0.0 – 6.4.8 No fix on this line yet
- 5.x 5.0.0 – 5.18.2 No fix on this line yet
- 4.x and older 0.0.1 – 4.16.19 No fix, no longer updated

On 7.x, the newest line:

```
npm install astro@7.4.5
```

Every release on a timeline

7.x 

1. Affected

7.0.0 – 7.4.4  
42 releases
2. Fixed

7.4.5 – 7.4.13  
9 releases, latest

6.x 

1. Affected

6.0.0 – 6.4.8  
41 releases

5.x 

1. Affected

5.0.0 – 5.18.2  
137 releases

4.x 

1. Affected

4.0.0 – 4.16.19  
145 releases

3.x 

1. Affected

3.0.0 – 3.6.5  
48 releases

2.x 

1. Affected

2.0.0 – 2.10.15  
93 releases

1.x 

1. Affected

1.0.0 – 1.9.2  
65 releases

0.x 

1. Affected

0.0.1 – 0.26.1  
162 releases

742 stable releases of astro, oldest to newest, one row per major.

## What happens

Summary

When a dynamic tag (`const Tag = ...; <Tag />`) resolves to a string, Astro renders it as a raw HTML element name. The name was filtered to remove characters that could inject attributes, but the filter did not handle `/`. Because HTML parsers treat `/` inside a tag as an attribute separator, a tag name such as `img/src/onerror=alert(1)` was rendered as an `<img>` element with an `onerror` attribute. The JSX renderer used for MDX did not filter string tag names at all.

For example:

```
---
const Tag = Astro.url.searchParams.get('as') ?? 'div';
---
<Tag>hello</Tag>
```

rendered `?as=img/src/onerror=alert(1)` as live HTML.

Impact

Reflected or stored cross-site scripting, but only in applications that use untrusted input (such as a request parameter or an uncontrolled CMS field) as all or part of an element name. Astro itself never derives element names from request data.

Applications that let content choose an element should map that input to a fixed set of known tags. Letting untrusted input choose an element name is unsafe even with a correct filter, because it can still select elements such as `script` or `iframe`.

Affected versions

`astro` <= 7.4.4.

Patches

Fixed in `astro` 7.4.5\. String tag names in `.astro` dynamic tags, JSX, and MDX now render only the leading valid element name, so characters such as `/` or `=` can no longer change the generated markup. Strings that do not start with a valid element name now throw an error.

Workarounds

Upgrade to `astro` 7.4.5 or later. Before upgrading, do not use untrusted input as an element name, or map it to a fixed set of known tags.

Credits

Reported by [@uttej-badwane](https://github.com/uttej-badwane).

## How it is exploited

Exploitable over the network, with no account and a user to do something.

- **Confidentiality**: low
- **Integrity**: low
- **Availability**: none

CVSS:4.0/​AV:N/​AC:L/​AT:P/​PR:N/​UI:P/​VC:L/​VI:L/​VA:N/​SC:L/​SI:L/​SA:N

## References

- [Reference](https://github.com/withastro/astro/security/advisories/GHSA-mh32-jxcr-mh9f "https://github.com/withastro/astro/security/advisories/GHSA-mh32-jxcr-mh9f")  
github.com/withastro/astro/security/advisories/…
- [NVD](https://nvd.nist.gov/vuln/detail/CVE-2026-126361 "https://nvd.nist.gov/vuln/detail/CVE-2026-126361")  
nvd.nist.gov/vuln/detail/CVE-2026-126361
- [Pull request](https://github.com/withastro/astro/pull/18520 "https://github.com/withastro/astro/pull/18520")  
#18520
- [Fix commit](https://github.com/withastro/astro/commit/e023abac912d7cb6af2b9fb5107ef5dabc667096 "https://github.com/withastro/astro/commit/e023abac912d7cb6af2b9fb5107ef5dabc667096")  
e023aba
- [Package](https://github.com/withastro/astro "https://github.com/withastro/astro")  
github.com/withastro/astro
- [Reference](https://github.com/withastro/astro/releases/tag/astro@7.4.5 "https://github.com/withastro/astro/releases/tag/astro@7.4.5")  
github.com/withastro/astro/releases/tag/astro@7…

A whole project to check? Paste its package.json in the [dependency check](https://inlinr.com/tools/dependency-check): every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.
