Packages / @astrojs/node / Security
@astrojs/node's trailing slash handling causes open redirect issue
Affected releases · @astrojs/node
- 9.x9.0.0 – 9.4.0Fixed in 9.4.1
- 8.x and older0.0.2 – 8.3.4No fix, no longer updated
On 9.x, the newest line:
npm install @astrojs/node@9.4.1Not affected
11.0.0 – 11.1.9
14 releases, latest
Affected
9.0.0 – 9.4.0
16 releases
Fixed
9.4.1 – 9.5.5
12 releases
Affected
8.0.0 – 8.3.4
14 releases
Affected
7.0.0 – 7.0.4
5 releases
Affected
6.0.0 – 6.1.0
6 releases
Affected
5.0.0 – 5.3.6
18 releases
Affected
4.0.0
1 release
Affected
3.0.0 – 3.1.1
3 releases
Affected
2.0.0 – 2.0.2
3 releases
Affected
1.0.0 – 1.1.0
3 releases
Affected
0.0.2 – 0.2.1
10 releases
Is your project affected?
Paste your package.json, or type the range you declare for @astrojs/node. It is read in your browser and sent nowhere.
What happens
Summary
Following github.com/withastro/astro/security/advisories/…, there's still an Open Redirect vulnerability in a subset of Astro deployment scenarios.
Details
Astro 5.12.8 fixed a case where https://example.com//astro.build/press would redirect to the external origin //astro.build/press. However, with the Node deployment adapter in standalone mode and trailingSlash set to "always" in the Astro configuration, https://example.com//astro.build/press still redirects to //astro.build/press.
Proof of Concept
Create a new minimal Astro project (
astro@5.12.8)Configure it to use the Node adapter (
@astrojs/node@9.4.0) and force trailing slashes:// astro.config.mjs import { defineConfig } from 'astro/config'; import node from '@astrojs/node'; export default defineConfig({ trailingSlash: 'always', adapter: node({ mode: 'standalone' }), });Build the site by running
astro build.Run the server, e.g. with
astro preview.Append
//astro.build/pressto the preview URL, e.g. localhost//astro.build/pressThe site will redirect to the external Astro Build origin.
Example reproduction
Open the preview in a separate window so the StackBlitz embed doesn't cause security errors.
Append
//astro.build/pressto the preview URL, e.g.https://x.local-corp.webcontainer.io//astro.build/press.See it redirect to the external Astro Build origin.
Impact
This is classified as an Open Redirection vulnerability (CWE-601). It affects any user who clicks on a specially crafted link pointing to the affected domain. Since the domain appears legitimate, victims may be tricked into trusting the redirected page, leading to possible credential theft, malware distribution, or other phishing-related attacks.
No authentication is required to exploit this vulnerability. Any unauthenticated user can trigger the redirect by clicking a malicious link.