Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
📦 npm
Not in CISA KEV

Astro: Arbitrary CSS injection in Astro View TransitionsGHSA-mpr7-6m5w-76rw

Fix: withastro/astro#17970

GHSA-mpr7-6m5w-76rw is a Cross-site Scripting (XSS) vulnerability in astro. A fix is available for astro — see the affected versions and patch details below.

Also known asCVE-2026-114127
Published
Updated
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Oct 22, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

EPSS Exploitation Probability

via FIRST.org ↗
0.3%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs25th percentile — riskier than 25% of all scored CVEsHighest risk

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

Real-World Exposure

1 pkg affected

How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.

720other npm packages depend on this — each one inherits the vulnerability until it's patched upstream
astronpm
4.8Mdownloads / week

Description

Summary

Astro's server-side View Transition CSS generator did not keep string animation properties within their generated CSS declarations. In an application that passes attacker-controlled data into an animation property such as duration, a value containing CSS delimiters could terminate the declaration and rule, then add attacker-selected CSS to the server-rendered page.

The injected content remains inside the generated <style> element. It cannot terminate that element or inject HTML or JavaScript because Astro escapes < before emitting the stylesheet.

Severity

Exploitation requires an application to pass untrusted, request-derived, or user-controlled content directly into a transition animation value. This is an uncommon application pattern, and applications using static or otherwise trusted transition values are unaffected.

The resulting capability is limited to CSS in the rendered document. The proof of concept does not demonstrate JavaScript execution, HTML injection, an origin-boundary bypass, or access to server-only data.

Details

Animation values are collected by stringifyAnimations() in packages/astro/src/runtime/server/transition.ts and passed to addAnimationProperty(). String values were converted directly with toString():

function addAnimationProperty(builder: AnimationBuilder, prop: string, value: string | number) {
  let arr = builder[prop];
  if (Array.isArray(arr)) {
    arr.push(value.toString());
  } else {
    builder[prop] = [value.toString()];
  }
}

The animation builder then interpolated each value into a declaration:

out += `\n\t${k}: ${value.join(', ')};`;

The completed stylesheet passes through escapeStyleText(), which escapes literal < characters to keep the content inside its HTML <style> element. CSS delimiters such as ;, {, and } remained active, allowing a value to escape its intended declaration and add another rule.

The shared serializer handles duration, delay, easing, direction, fillMode, and animation names, so custom transition objects using those string properties followed the same path.

The fix encodes CSS declaration delimiters while serializing each animation value. Supported CSS functions and strings, including calc() and var(), remain unchanged.

Proof of Concept

Using [email protected], create an on-demand rendered page:

---
import { fade } from "astro:transitions";
const duration = Astro.url.searchParams.get("duration") ?? "1ms";
---
<div id="target" transition:animate={fade({ duration })}>SAFE</div>

Request the page with:

/?duration=1ms%3B%7D%23target%7Bcolor%3Argb(1%2C2%2C3)%3Bfont-size%3A37px%7Dx%7Banimation-duration%3A1ms

Before the fix, the generated stylesheet contains an active rule equivalent to:

#target {
  color: rgb(1, 2, 3);
  font-size: 37px;
}

In Chromium, the target's computed styles change to rgb(1, 2, 3) and 37px. This behavior is reproducible in a production standalone SSR build, not only in the development server.

Impact

An attacker can inject CSS into the affected application's rendered page when the application places attacker-controlled data into a transition animation value. The CSS can restyle or conceal content, reposition existing controls, add generated text, or otherwise misrepresent the page's UI.

CSS selectors and conditional resource loads may expose data already present in selectable DOM attributes in some applications, depending on the page and its Content Security Policy. The issue does not expose cookies, server-only values, arbitrary DOM text, or cross-origin response data by itself.

Affected Versions

astro >= 7.1.0, <= 7.3.2.

Versions through 7.0.9 are covered by GHSA-4g3v-8h47-v7g6 / CVE-2026-73422, which had the stronger impact of escaping the <style> element and injecting HTML or JavaScript.

Patched Versions

This issue is patched in [email protected]. Fix: https://github.com/withastro/astro/pull/17970

Workarounds

Do not pass untrusted or request-derived values into View Transition animation properties. If dynamic values are required, validate them according to the expected CSS grammar before constructing the transition. For duration and delay, prefer finite numbers or strictly validated CSS time values.

Credits

Reported by @avrlab233.

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
📦npmastro≥ 7.1.0&&< 7.3.37.3.3npm install astro@7.3.3

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for astro, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update astro to 7.3.3 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-mpr7-6m5w-76rw is resolved across your whole dependency graph.

  3. Workarounds

    Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.

Frequently Asked Questions

### Summary Astro's server-side View Transition CSS generator did not keep string animation properties within their generated CSS declarations. In an application that passes attacker-controlled data into an animation property such as `duration`, a value containing CSS delimiters could terminate the declaration and rule, then add attacker-selected CSS to the server-rendered page. The injected content remains inside the generated `<style>` element. It cannot terminate that element or inject HTML or JavaScript because Astro escapes `<` before emitting the stylesheet. ### Severity Exploitation
O3 Security · Impact-Aware SCA

Is GHSA-mpr7-6m5w-76rw in your dependencies?

Find it across npm, including transitive dependencies.

Astro: Arbitrary CSS injection in Astro View Transitions