@angular/ssr
Affected
- introduced
21.2.0-next.0, fixed21.2.0-rc.1(semver)
Fixed versions
21.2.0-rc.1
Fix
- Fixed version
21.2.0-rc.1npm install @angular/[email protected]
Advisory
Also known as: CVE-2026-27738
Angular SSR has an Open Redirect via X-Forwarded-Prefix
An Open Redirect vulnerability exists in the internal URL processing logic in Angular SSR. The logic normalizes URL segments by stripping leading slashes; however, it only removes a single leading slash.
When an Angular SSR application is deployed behind a proxy that passes the X-Forwarded-Prefix header, an attacker can provide a value starting with three slashes (e.g., ///evil.com).
redirectTo or i18n locale switch).///evil.com as the prefix.//evil.com.Location header.// as a protocol-relative URL, redirecting the user from https://your-app.com to https://evil.com.Impact
This vulnerability allows attackers to conduct large-scale phishing and SEO hijacking:
Attack Preconditions
X-Forwarded-Prefix header to the SSR process without sanitization.X-Forwarded-Prefix header.Patches
Workarounds
Until the patch is applied, developers should sanitize the X-Forwarded-Prefix header in theirserver.ts before the Angular engine processes the request:
app.use((req, res, next) => {
const prefix = req.headers['x-forwarded-prefix']?.trim();
if (prefix) {
// Sanitize by removing all leading slashes
req.headers['x-forwarded-prefix'] = prefix.replace(/^[/\\]+/, '/');
}
next();
});
Resources
Medium Basis: The source's own band: MODERATE
21.2.0-next.0, fixed 21.2.0-rc.1 (semver)21.2.0-rc.1
21.2.0-rc.1npm install @angular/[email protected]21.0.0-next.0, fixed 21.1.5 (semver)21.1.5
21.1.5npm install @angular/[email protected]20.0.0-next.0, fixed 20.3.17 (semver)20.3.17
20.3.17npm install @angular/[email protected]19.0.0-next.0, fixed 19.2.21 (semver)19.2.21
19.2.21npm install @angular/[email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0