A severe Server-Side Request Forgery (SSRF) flaw in Angular’s server-side rendering (SSR) packages lets attackers trick apps into sending sensitive requests to arbitrary servers.
Discovered by security researcher alan-agius4, the issue (GHSA-x288-3778-4hhx) stems from unvalidated user-controlled headers like Host and X-Forwarded-*.
This allows header injection, enabling attacks on internal networks. Angular has patched its update now to avoid risks.
How the Vulnerability Works
Angular SSR’s URL reconstruction logic blindly trusts headers to set the app’s base origin. Attackers manipulate:
- Host Domain: Fake Host or X-Forwarded-Host to point to external domains.
- Path Manipulation: Inject paths or special characters via X-Forwarded-Host.
- Port Issues: Non-numeric X-Forwarded-Port creates malformed URIs.
This affects HttpClient relative URL resolution and manual REQUEST object use. Attackers steer requests to steal credentials, probe internal services (e.g., cloud metadata at 169.254.169.254), or breach confidentiality.
Preconditions include SSR usage, relative URLs or direct header access, and no proxy validation.
| Package | Affected Versions | Patched Versions |
|---|---|---|
| @angular/ssr | >=21.2.0-next.0 <21.2.0-rc.1 =21.0.0-next.0 <21.1.5 =20.0.0-next.0 <20.3.17 =19.0.0-next.0 <19.2.21 <=18.2.21 | 21.2.0-rc.1 21.1.5 20.3.17 19.2.21 None |
| @nguniversal/common | <=16.2.0 | None |
| @nguniversal/express-engine | <=16.2.0 | None |
CVE-2026-27739 scores critical at CVSS 4.0: AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:L/VA:N/SC:H/SI:L/SA:N (CWE-918).
Upgrade immediately:
- @angular/ssr to 21.2.0-rc.1, 21.1.5, 20.3.17, or 19.2.21.
Workarounds:
- Switch to absolute URLs; avoid req.headers for bases.
- Add middleware validation:
textconst ALLOWED_HOSTS = new Set(['your-domain.com']);
app.use((req, res, next) => {
const hostHeader = (req.headers['x-forwarded-host'] ?? req.headers['host'])?.toString();
const portHeader = req.headers['x-forwarded-port']?.toString();
if (hostHeader) {
const hostname = hostHeader.split(':')[0];
if (!/^[a-z0-9.:-]+$/i.test(hostname) || (!ALLOWED_HOSTS.has(hostname) && hostname !== 'localhost')) {
return res.status(400).send('Invalid Hostname');
}
}
if (portHeader && !/^\d+$/.test(portHeader)) {
return res.status(400).send('Invalid Port');
}
next();
});
This flaw highlights SSRF risks in modern frameworks. Developers: Audit header handling and enforce proxies. Stay vigilant, scan your Angular SSR apps today.
Follow us on Google News , LinkedIn and X to Get More Instant Updates. Set Cyberpress as a Preferred Source in Google.