{"schema":"threatline.record/2","record":{"id":"CVE-2026-104871","aliases":["GHSA-7g7c-h8rr-7p6q"],"summary":"Angular SSR: Path Traversal to Sibling Directories in CommonEngine on Windows","details":"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.\n\nThe vulnerability occurs due to how relative URLs and Windows file paths are resolved and validated:\n\n1. A request URL containing a backslash parent traversal segment (e.g., `/..\\app-admin`) is passed to `CommonEngine.render({ url })`.\n2. The engine parses the URL using `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`.\n3. The engine constructs the candidate file path using `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`).\n4. The containment check (`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.\n5. If the target file exists and contains the Angular SSG marker (`ng-server-context=\"...ssg...\"`), `CommonEngine` reads and serves the sibling page instead of rendering the requested route.\n\n### Impact\n\nThis vulnerability allows unauthorized access to prerendered static pages from adjacent applications or build outputs:\n\n- **Information Disclosure:** Prerendered HTML pages located in sibling directories sharing the same name prefix as the public directory (e.g., an internal administration app `app-admin` adjacent to `app`) can be accessed by unauthorized users.\n- **Limited Scope:** Only HTML files matching the Angular SSG marker regex are served. Arbitrary non-Angular files, secrets, or configuration files without the SSG context attribute cannot be read through this mechanism.\n\n### Attack Preconditions\n\n- The application must use `CommonEngine` from `@angular/ssr/node` (or `@angular/ssr` in v17–v18).\n- The application must be hosted on Windows (where Node's `path.join` resolves `\\` as a path separator).\n- The application passes a relative request URL (such as `req.url` or `req.originalUrl` without origin) into `CommonEngine.render({ url })`.\n- A sibling directory exists whose name starts with the same prefix as the configured `publicPath` directory (e.g., `dist\\app-admin` alongside `dist\\app`).\n- The targeted sibling directory contains prerendered HTML output containing the Angular SSG marker.\n\n### Affected Versions\n\n- `>= 22.0.0, < 22.1.7`\n- `>= 21.0.0, < 21.2.23`\n- `>= 20.0.0, < 20.3.36`\n- `<= 19.2.27`\n\n### Patches\n\n- `22.1.7`\n- `21.2.23`\n- `20.3.36`\n\n> Versions `<= 19.2.27` have reached End of Support / LTS expiration and will not be patched.\n\n### Workarounds\n\nUntil 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:\n\n```ts\nserver.use((req, res, next) => {\n  const { protocol, originalUrl, headers } = req;\n\n  // Normalize backslashes or construct a full HTTP URL (which forces WHATWG URL normalization)\n  const sanitizedUrl = `${protocol}://${headers.host}${originalUrl.replace(/\\\\/g, '/')}`;\n\n  commonEngine\n    .render({\n      bootstrap,\n      documentFilePath: indexHtml,\n      url: sanitizedUrl,\n      publicPath: distFolder,\n    })\n    .then((html) => res.send(html))\n    .catch((err) => next(err));\n});\n```\n\nAlternatively, migrate from the deprecated `CommonEngine` to `AngularNodeAppEngine`, which relies on manifest-based route matching rather than direct filesystem path resolution.","categories":["Frameworks"],"product":"@angular/ssr","vendor":"angular","ecosystem":"npm","affected_ranges":[{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-7g7c-h8rr-7p6q","source_modified_at":"2026-10-05T22:53:46Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"npm","name":"@angular/ssr"},"range":">= 22.0.0, < 22.1.7"},{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-7g7c-h8rr-7p6q","source_modified_at":"2026-10-05T22:53:46Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"npm","name":"@angular/ssr"},"range":">= 21.0.0, < 21.2.23"},{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-7g7c-h8rr-7p6q","source_modified_at":"2026-10-05T22:53:46Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"npm","name":"@angular/ssr"},"range":">= 20.0.0, < 20.3.36"},{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-7g7c-h8rr-7p6q","source_modified_at":"2026-10-05T22:53:46Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"npm","name":"@angular/ssr"},"range":"<= 19.2.27"},{"source":"CVE List","source_url":"https://www.cve.org/CVERecord?id=CVE-2026-104871","source_modified_at":"2026-10-02T20:12:49.364Z","fetched_at":"2026-10-23T18:45:31.882637Z","product":"angular-cli","vendor":"angular","versions":[{"version":"< 20.3.36","status":"affected"},{"version":">= 21.0.0, < 21.2.23","status":"affected"},{"version":">= 22.0.0, < 22.1.7","status":"affected"}],"defaultStatus":null},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-7g7c-h8rr-7p6q","source_modified_at":"2026-10-05T23:00:04.245230888Z","fetched_at":"2026-10-23T18:45:31.882637Z","package":{"name":"@angular/ssr","ecosystem":"npm","purl":"pkg:npm/%40angular/ssr"},"ranges":[{"type":"SEMVER","events":[{"introduced":"22.0.0"},{"fixed":"22.1.7"}]}],"versions":[]},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-7g7c-h8rr-7p6q","source_modified_at":"2026-10-05T23:00:04.245230888Z","fetched_at":"2026-10-23T18:45:31.882637Z","package":{"name":"@angular/ssr","ecosystem":"npm","purl":"pkg:npm/%40angular/ssr"},"ranges":[{"type":"SEMVER","events":[{"introduced":"21.0.0"},{"fixed":"21.2.23"}]}],"versions":[]},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-7g7c-h8rr-7p6q","source_modified_at":"2026-10-05T23:00:04.245230888Z","fetched_at":"2026-10-23T18:45:31.882637Z","package":{"name":"@angular/ssr","ecosystem":"npm","purl":"pkg:npm/%40angular/ssr"},"ranges":[{"type":"SEMVER","events":[{"introduced":"20.0.0"},{"fixed":"20.3.36"}]}],"versions":[]},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-7g7c-h8rr-7p6q","source_modified_at":"2026-10-05T23:00:04.245230888Z","fetched_at":"2026-10-23T18:45:31.882637Z","package":{"name":"@angular/ssr","ecosystem":"npm","purl":"pkg:npm/%40angular/ssr"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"last_affected":"19.2.27"}]}],"versions":[]}],"fixed_versions":[{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-7g7c-h8rr-7p6q","source_modified_at":"2026-10-05T22:53:46Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"npm","name":"@angular/ssr"},"version":"22.1.7"},{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-7g7c-h8rr-7p6q","source_modified_at":"2026-10-05T22:53:46Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"npm","name":"@angular/ssr"},"version":"21.2.23"},{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-7g7c-h8rr-7p6q","source_modified_at":"2026-10-05T22:53:46Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"npm","name":"@angular/ssr"},"version":"20.3.36"},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-7g7c-h8rr-7p6q","source_modified_at":"2026-10-05T23:00:04.245230888Z","fetched_at":"2026-10-23T18:45:31.882637Z","package":{"name":"@angular/ssr","ecosystem":"npm","purl":"pkg:npm/%40angular/ssr"},"version":"22.1.7"},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-7g7c-h8rr-7p6q","source_modified_at":"2026-10-05T23:00:04.245230888Z","fetched_at":"2026-10-23T18:45:31.882637Z","package":{"name":"@angular/ssr","ecosystem":"npm","purl":"pkg:npm/%40angular/ssr"},"version":"21.2.23"},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-7g7c-h8rr-7p6q","source_modified_at":"2026-10-05T23:00:04.245230888Z","fetched_at":"2026-10-23T18:45:31.882637Z","package":{"name":"@angular/ssr","ecosystem":"npm","purl":"pkg:npm/%40angular/ssr"},"version":"20.3.36"}],"cvss":6.3,"severity":"Medium","kev":{"listed":false},"epss":{"probability":0.0042,"percentile":0.35211,"score_date":"2026-10-23"},"published_at":"2026-10-02T19:43:50.475Z","modified_at":"2026-10-05T23:00:04.245230888Z","provenance":[{"source":"GitHub Advisory Database","url":"https://github.com/advisories/GHSA-7g7c-h8rr-7p6q","fetched_at":"2026-10-23T18:42:43.628194Z","source_modified_at":"2026-10-05T22:53:46Z"},{"source":"CVE List","url":"https://www.cve.org/CVERecord?id=CVE-2026-104871","fetched_at":"2026-10-23T18:45:31.882637Z","source_modified_at":"2026-10-02T20:12:49.364Z"},{"source":"OSV","url":"https://osv.dev/vulnerability/GHSA-7g7c-h8rr-7p6q","fetched_at":"2026-10-23T18:45:31.882637Z","source_modified_at":"2026-10-05T23:00:04.245230888Z"},{"source":"EPSS","url":"https://api.first.org/data/v1/epss?cve=CVE-2026-104871","fetched_at":"2026-10-23T18:42:43.628194Z","source_modified_at":"2026-10-23"}],"sources":["GitHub Advisory Database","CVE List","OSV","EPSS"],"references":[{"source":"CVE List","url":"https://github.com/angular/angular-cli/security/advisories/GHSA-7g7c-h8rr-7p6q","tags":["x_refsource_CONFIRM"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-104871","source":"GitHub Advisory Database"},{"source":"CVE List","url":"https://github.com/angular/angular-cli/commit/645e41a47d21b7651837a4250de99af0509626e2","tags":["x_refsource_MISC"]},{"source":"CVE List","url":"https://github.com/angular/angular-cli/commit/70748ca8e76fe4b42798719410336119d943e755","tags":["x_refsource_MISC"]},{"source":"CVE List","url":"https://github.com/angular/angular-cli/commit/bb72145f9ab45aee29f523236b3a25cd0813a841","tags":["x_refsource_MISC"]},{"source":"CVE List","url":"https://github.com/angular/angular-cli/commit/c3e5982e49705f0f6a913cb94622b4c555d2d914","tags":["x_refsource_MISC"]},{"source":"CVE List","url":"https://github.com/angular/angular-cli/releases/tag/v20.3.36","tags":["x_refsource_MISC"]},{"source":"CVE List","url":"https://github.com/angular/angular-cli/releases/tag/v21.2.23","tags":["x_refsource_MISC"]},{"source":"CVE List","url":"https://github.com/angular/angular-cli/releases/tag/v22.1.7","tags":["x_refsource_MISC"]},{"url":"https://github.com/advisories/GHSA-7g7c-h8rr-7p6q","source":"GitHub Advisory Database"}],"locations":[],"motoko_assessment":{"status":"requires_architecture_review","automatic_remediation":false},"cve_state":"PUBLISHED","ssvc":{"exploitation":"none","automatable":"no","technical_impact":"partial","assessed_at":"2026-10-02T20:12:27.563771Z"},"classification":{"method":"product-first software-layer rules","rules_version":"2.1","matched_on":"product","confidence":"heuristic","reviewed":false},"change_timestamp":"2026-10-05T23:00:04.245230888Z","content_hash":"a313adacbacc5915fca21fd27a7e52544d630fda09b3def4dd46c338c9cecd42"}}
