Packages / @astrojs/node / Security
@astrojs/node: Backslash-prefixed paths not recognized as internal by trailing-slash redirect
Affected releases · @astrojs/node
- 11.x11.0.0 – 11.0.1Fixed in 11.0.2
- 10.x10.0.0 – 10.1.4No fix on this line yet
- 9.x9.0.0 – 9.5.5No fix on this line yet
- 8.x8.1.0 – 8.3.4No fix on this line yet
On 11.x, the newest line:
npm install @astrojs/node@11.0.2Affected
11.0.0 – 11.0.1
2 releases
Fixed
11.0.2 – 11.1.9
12 releases, latest
Affected
10.0.0 – 10.1.4
12 releases
Affected
9.0.0 – 9.5.5
28 releases
Not affected
8.0.0
1 release
Affected
8.1.0 – 8.3.4
13 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
Impact
With trailingSlash: 'always' configured, the @astrojs/node standalone server's static file handler appends a trailing slash to request paths and issues a 301 redirect. Paths beginning with /\ (slash-backslash) were not recognized as internal paths, so the handler would echo the raw path back in the Location header. Because browsers treat \ as / per the WHATWG URL specification, the resulting redirect could resolve to an external host.
Preconditions:
trailingSlash: 'always'must be set (non-default; the default is'ignore')The request path must not have a file extension in its final segment
An attacker must deliver the crafted link to a user
Patches
Fixed by treating backslash-prefixed paths the same as //-prefixed paths in isInternalPath(), so they are no longer rewritten with a trailing slash.
Workarounds
Use the default trailingSlash: 'ignore' setting, which does not issue trailing-slash redirects in the static file handler.
References