CVE-2026-126361: Astro Cross-Site Scripting Vulnerability

LOW
Advisory Identifier: GHSA-mh32-jxcr-mh9f
CWE-79 CWE-184
Published
Advisory Summary

CVE-2026-126361 is a LOW cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Astro libraries in the npm ecosystem. The issue involves xss via attribute injection in dynamic tag names. Remediation is available by upgrading affected packages to version 7.4.5.

CVE-2026-126361 at a Glance

CVE Identifier CVE-2026-126361
GHSA Identifier GHSA-mh32-jxcr-mh9f
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Astro
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2026-126361

To remediate this vulnerability, upgrade all affected Astro dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

astro fixed: 7.4.5
npm install astro@7.4.5
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls astro

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-126361, inspect your project dependencies using npm:

npm ls astro

Analyze the terminal output to locate any version of Astro in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 7.4.5), your application is affected.

Note: The npm ls astro command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Astro, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## 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: ```astro --- 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.

CVE-2026-126361 Affected Astro Versions

1 component(s)
Fixed Versions:
7.4.5
Product / Package Ecosystem Affected Versions Fixed Version
astro
npm
< 7.4.5
7.4.5

References

Frequently Asked Questions

What is CVE-2026-126361?
CVE-2026-126361 is a security vulnerability in Astro involving XSS via attribute injection in dynamic tag names under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Astro versions are affected?
Affected versions include releases prior to 7.4.5 across affected packages: astro.
What version fixes CVE-2026-126361?
Upgrading to 7.4.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is astro affected?
Yes, astro is affected in releases prior to 7.4.5. Upgrade your dependency to 7.4.5 or later.
What CWE is associated with CVE-2026-126361?
CVE-2026-126361 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check npm dependencies for CVE-2026-126361?
Run the dependency tree command: 'npm ls astro'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-mh32-jxcr-mh9f",
  "modified" : "2026-11-13T18:39:55Z",
  "published" : "2026-11-13T18:39:54Z",
  "aliases" : [ "CVE-2026-126361" ],
  "summary" : "Astro: XSS via attribute injection in dynamic tag names",
  "details" : "## Summary\n\nWhen 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.\n\nFor example:\n\n```astro\n---\nconst Tag = Astro.url.searchParams.get('as') ?? 'div';\n---\n<Tag>hello</Tag>\n```\n\nrendered `?as=img/src/onerror=alert(1)` as live HTML.\n\n## Impact\n\nReflected 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.\n\nApplications 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`.\n\n## Affected versions\n\n`astro` <= 7.4.4.\n\n## Patches\n\nFixed 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.\n\n## Workarounds\n\nUpgrade 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.\n\n## Credits\n\nReported by @uttej-badwane.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "astro"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "7.4.5"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 7.4.4"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/withastro/astro/security/advisories/GHSA-mh32-jxcr-mh9f"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-126361"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/withastro/astro/pull/18520"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/withastro/astro/commit/e023abac912d7cb6af2b9fb5107ef5dabc667096"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/withastro/astro"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/withastro/astro/releases/tag/astro@7.4.5"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-184", "CWE-79" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-13T18:39:54Z",
    "nvd_published_at" : "2026-11-13T00:20:11Z"
  }
}