{"id":"GHSA-mpr7-6m5w-76rw","summary":"Astro: Arbitrary CSS injection in Astro View Transitions","details":"### Summary\n\nAstro'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.\n\nThe injected content remains inside the generated `\u003cstyle\u003e` element. It cannot terminate that element or inject HTML or JavaScript because Astro escapes `\u003c` before emitting the stylesheet.\n\n### Severity\n\nExploitation 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.\n\nThe 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.\n\n### Details\n\nAnimation values are collected by `stringifyAnimations()` in `packages/astro/src/runtime/server/transition.ts` and passed to `addAnimationProperty()`. String values were converted directly with `toString()`:\n\n```ts\nfunction addAnimationProperty(builder: AnimationBuilder, prop: string, value: string | number) {\n  let arr = builder[prop];\n  if (Array.isArray(arr)) {\n    arr.push(value.toString());\n  } else {\n    builder[prop] = [value.toString()];\n  }\n}\n```\n\nThe animation builder then interpolated each value into a declaration:\n\n```ts\nout += `\\n\\t${k}: ${value.join(', ')};`;\n```\n\nThe completed stylesheet passes through `escapeStyleText()`, which escapes literal `\u003c` characters to keep the content inside its HTML `\u003cstyle\u003e` element. CSS delimiters such as `;`, `{`, and `}` remained active, allowing a value to escape its intended declaration and add another rule.\n\nThe shared serializer handles `duration`, `delay`, `easing`, `direction`, `fillMode`, and animation names, so custom transition objects using those string properties followed the same path.\n\nThe fix encodes CSS declaration delimiters while serializing each animation value. Supported CSS functions and strings, including `calc()` and `var()`, remain unchanged.\n\n### Proof of Concept\n\nUsing `astro@7.3.2`, create an on-demand rendered page:\n\n```astro\n---\nimport { fade } from \"astro:transitions\";\nconst duration = Astro.url.searchParams.get(\"duration\") ?? \"1ms\";\n---\n\u003cdiv id=\"target\" transition:animate={fade({ duration })}\u003eSAFE\u003c/div\u003e\n```\n\nRequest the page with:\n\n```text\n/?duration=1ms%3B%7D%23target%7Bcolor%3Argb(1%2C2%2C3)%3Bfont-size%3A37px%7Dx%7Banimation-duration%3A1ms\n```\n\nBefore the fix, the generated stylesheet contains an active rule equivalent to:\n\n```css\n#target {\n  color: rgb(1, 2, 3);\n  font-size: 37px;\n}\n```\n\nIn 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.\n\n### Impact\n\nAn 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.\n\nCSS 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.\n\n### Affected Versions\n\n`astro \u003e= 7.1.0, \u003c= 7.3.2`.\n\nVersions through 7.0.9 are covered by GHSA-4g3v-8h47-v7g6 / CVE-2026-73422, which had the stronger impact of escaping the `\u003cstyle\u003e` element and injecting HTML or JavaScript.\n\n### Patched Versions\n\nThis issue is patched in `astro@7.3.3`. Fix: https://github.com/withastro/astro/pull/17970\n\n### Workarounds\n\nDo 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.\n\n### Credits\n\nReported by @avrlab233.","aliases":["CVE-2026-114127"],"modified":"2026-10-22T16:45:03.723634874Z","published":"2026-10-22T16:29:28Z","database_specific":{"nvd_published_at":"2026-10-21T18:17:25Z","cwe_ids":["CWE-79"],"severity":"LOW","github_reviewed":true,"github_reviewed_at":"2026-10-22T16:29:28Z"},"references":[{"type":"WEB","url":"https://github.com/withastro/astro/security/advisories/GHSA-mpr7-6m5w-76rw"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-114127"},{"type":"WEB","url":"https://github.com/withastro/astro/pull/17970"},{"type":"WEB","url":"https://github.com/withastro/astro/commit/0b4dc3a211910b589d3805ab4dfedf11b0e712bb"},{"type":"PACKAGE","url":"https://github.com/withastro/astro"},{"type":"WEB","url":"https://github.com/withastro/astro/releases/tag/astro@7.3.3"}],"affected":[{"package":{"name":"astro","ecosystem":"npm","purl":"pkg:npm/astro"},"ranges":[{"type":"SEMVER","events":[{"introduced":"7.1.0"},{"fixed":"7.3.3"}]}],"database_specific":{"last_known_affected_version_range":"\u003c= 7.3.2","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-mpr7-6m5w-76rw/GHSA-mpr7-6m5w-76rw.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N"}]}