@angular/ssr
Affected
- introduced
22.0.0, fixed22.1.7(semver)
Fixed versions
22.1.7
Fix
- Fixed version
22.1.7npm install @angular/[email protected]
Advisory
Also known as: CVE-2026-104871
Angular SSR: Path Traversal to Sibling Directories in CommonEngine on Windows
A Path Traversal vulnerability exists in the prerendered (SSG) page retrieval logic of CommonEngine in @angular/ssr/node (and @angular/ssr in earlier versions). When deployed on Windows, an attacker can craft a request path with backslash directory traversal sequences that causes CommonEngine to serve prerendered pages from sibling output directories.
The vulnerability occurs due to how relative URLs and Windows file paths are resolved and validated:
/..\app-admin) is passed to CommonEngine.render({ url }).new URL(url, 'resolve://'). Because resolve:// is a non-special scheme under the WHATWG URL standard, backslashes are not normalized to forward slashes, leaving the pathname unnormalized as /..\app-admin.join(publicPath, pathname, 'index.html'). On Windows, path.join treats \ as a path delimiter, resolving the parent segment (..\) out of publicPath (e.g., dist\app) into a sibling directory (e.g., dist\app-admin\index.html).pagePath.startsWith(normalize(publicPath))) performs a prefix match without a trailing path delimiter. Because the sibling folder name starts with the configured public folder name (e.g., dist\app-admin starts with dist\app), the check erroneously succeeds.ng-server-context="...ssg..."), CommonEngine reads and serves the sibling page instead of rendering the requested route.Impact
This vulnerability allows unauthorized access to prerendered static pages from adjacent applications or build outputs:
app-admin adjacent to app) can be accessed by unauthorized users.Attack Preconditions
CommonEngine from @angular/ssr/node (or @angular/ssr in v17–v18).path.join resolves \ as a path separator).req.url or req.originalUrl without origin) into CommonEngine.render({ url }).publicPath directory (e.g., dist\app-admin alongside dist\app).Affected Versions
>= 22.0.0, < 22.1.7>= 21.0.0, < 21.2.23>= 20.0.0, < 20.3.36<= 19.2.27Patches
22.1.721.2.2320.3.36> Versions <= 19.2.27 have reached End of Support / LTS expiration and will not be patched.
Workarounds
Until a patch is applied, developers using CommonEngine on Windows can sanitize request URLs in server.ts before passing them to CommonEngine.render, ensuring backslashes are replaced or that an absolute HTTP URL is constructed:
server.use((req, res, next) => {
const { protocol, originalUrl, headers } = req;
// Normalize backslashes or construct a full HTTP URL (which forces WHATWG URL normalization)
const sanitizedUrl = `${protocol}://${headers.host}${originalUrl.replace(/\\/g, '/')}`;
commonEngine
.render({
bootstrap,
documentFilePath: indexHtml,
url: sanitizedUrl,
publicPath: distFolder,
})
.then((html) => res.send(html))
.catch((err) => next(err));
});
Alternatively, migrate from the deprecated CommonEngine to AngularNodeAppEngine, which relies on manifest-based route matching rather than direct filesystem path resolution.
Medium Basis: The source's own band: MODERATE
22.0.0, fixed 22.1.7 (semver)22.1.7
22.1.7npm install @angular/[email protected]21.0.0, fixed 21.2.23 (semver)21.2.23
21.2.23npm install @angular/[email protected]20.0.0, fixed 20.3.36 (semver)20.3.36
20.3.36npm install @angular/[email protected]0, last affected 19.2.27 (semver)None listed
No fixed version is listed.
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