MediumGHSA-376h-93r7-7g6fCVE-2026-84376

Astro: Authorization bypass from missing path-segment boundary check when stripping the configured base

Published 8 Sept 2026 · Updated 8 Sept 2026

Is your project on an affected astro?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several JavaScript apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected package

Affected
<7.2.4
Fixed in
7.2.4
Update to the fixed version for your release line, for example:npm install astro@7.2.4

Details

Summary

Astro stripped a configured base path from request pathnames using a string-prefix check that did not verify a path-segment boundary. With base: "/app", a request to /appX/admin was treated as being under the base and resolved internally to the /admin route, while middleware still observed the public pathname /appX/admin. Middleware that authorizes routes by inspecting context.url.pathname could therefore be bypassed.

Impact

An unauthenticated remote attacker can bypass pathname-based middleware authorization in applications that:

  • Configure a non-root base.
  • Protect base-prefixed routes in middleware using context.url.pathname.

Because routing and middleware resolved different effective pathnames, a request such as /appX/admin (or other single-character extensions like /app2/admin or /app-/admin) reached the protected /admin route without passing the middleware check that guards /app/admin. Astro's authentication guide demonstrates protecting routes in middleware via context.url.pathname, so this is a reasonable and expected pattern.

Affected versions

astro <= 7.2.3.

Patches

Fixed in astro 7.2.4. Base stripping now requires the pathname to equal the base without its trailing slash, or to be followed by a /, so a prefix that does not end on a path-segment boundary is no longer treated as being under the base. Routing and context.url.pathname now resolve the same pathname.

Workarounds

Upgrade to astro 7.2.4 or later. As a mitigation before upgrading, avoid relying solely on prefix checks of context.url.pathname for authorization, or reject requests whose pathname does not begin with the configured base followed by a path-segment boundary.

Credits

Reported by @Ryoga-exe.

Is GHSA-376h-93r7-7g6f in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected astro, and gives you the command that fixes it.

More advisories for astro

  • MediumCVE-2026-114128Astro: Reflected/Stored XSS via unescaped <script>/<style> tag content in JSX/MDX rendering · 22 Oct 2026
  • LowCVE-2026-114127Astro: Arbitrary CSS injection in Astro View Transitions · 22 Oct 2026
  • CriticalGHSA-26w7-cxv4-gfx2Astro: Remote code execution through AVIF image optimization · 8 Sept 2026
  • MediumCVE-2026-73423Astro: composable `astro/hono` pipeline bypasses `security.checkOrigin` when `middleware()` is absent or misordered · 20 Jul 2026
  • MediumCVE-2026-59729Astro: XSS via unescaped spread attribute names in renderHTMLElement (incomplete fix for CVE-2026-54298) · 20 Jul 2026
  • LowCVE-2026-59727Astro: Cross-site scripting via unescaped transition:* directive values on hydrated islands · 20 Jul 2026
All 29 advisories for astro

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.