Title: Angular SSR `ServerXhr` URL parser discrepancy allows SSRF after same-origin validation · Issue #70540 · angular/angular · GitHub
Open Graph Title: Angular SSR `ServerXhr` URL parser discrepancy allows SSRF after same-origin validation · Issue #70540 · angular/angular
X Title: Angular SSR `ServerXhr` URL parser discrepancy allows SSRF after same-origin validation · Issue #70540 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? platform-server Is this a regression? No Description Angular SSR can make its absolute/relative URL decision using a trimmed string, then pass the original untrimmed value to ServerX...
Open Graph Description: Which @angular/* package(s) are the source of the bug? platform-server Is this a regression? No Description Angular SSR can make its absolute/relative URL decision using a trimmed string, then pass...
X Description: Which @angular/* package(s) are the source of the bug? platform-server Is this a regression? No Description Angular SSR can make its absolute/relative URL decision using a trimmed string, then pass...
Opengraph URL: https://github.com/angular/angular/issues/70540
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Angular SSR `ServerXhr` URL parser discrepancy allows SSRF after same-origin validation","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\nplatform-server\n\n### Is this a regression?\n\nNo\n\n### Description\n\nAngular SSR can make its absolute/relative URL decision using a trimmed string, then pass the original untrimmed value to `ServerXhr`.\n\nThe relevant path in `relativeUrlsTransformerInterceptorFn` does this:\n\n```ts\nconst trimmedUrl = request.url.trim();\n\nif (\n URL_SCHEMA_REGEXP.test(trimmedUrl) &&\n !HTTP_OR_HTTPS_NO_AUTHORITY_REGEXP.test(trimmedUrl)\n) {\n return next(request);\n}\n```\n\nThis means Angular classifies `trimmedUrl`, but the XHR backend receives `request.url`.\n\nOne way to reach the mismatch is to prefix an absolute URL with `U+00A0 NO-BREAK SPACE`:\n\n```text\n\u003cU+00A0>http://127.0.0.2:5000/probe\n```\n\nFor an SSR application running at `http://127.0.0.1:4000`, the WHATWG URL parser treats that value as a path on the current origin. An application can therefore allow it during a same-origin check and attach credentials.\n\nAngular removes the leading character for classification, sees an absolute HTTP URL, and takes the early-return path. The original value later reaches `xhr2`, where Node's legacy URL parsing behavior can interpret it as a request to `http://127.0.0.2:5000/probe`.\n\nAs a result, a request approved as same-origin by the application can be sent to another origin with application-supplied headers still attached.\n\n\n### Reproduction\n\nSee https://github.com/SkyZeroZx/angular-serverxhr-poc\n\n The PoC runs two local services:\n\n- Angular SSR at `http://127.0.0.1:4000`\n- A request-capture server at `http://127.0.0.2:5000`\n\nAn application interceptor resolves the attacker-controlled URL with the WHATWG `URL` API. If the result is same-origin, it attaches a fake `Authorization` header and lets the SSR request continue.\n\nThe request is triggered with:\n\n```text\nhttp://127.0.0.1:4000/?target=%C2%A0http%3A%2F%2F127.0.0.2%3A5000%2Fprobe\n```\n\n`%C2%A0` decodes to the leading `U+00A0`. The application resolves the value against `127.0.0.1:4000`, considers it same-origin, and attaches the credential. Angular then classifies the trimmed value as absolute, while `ServerXhr` forwards the original value to `xhr2`.\n\nThe capture server at `127.0.0.2:5000` receives `/probe` with the fake `Authorization` header. Its response is also returned through Angular `HttpClient`, showing that the backend sends the cross-origin request and exposes the response to the SSR application.\n\n ","author":{"url":"https://github.com/SkyZeroZx","@type":"Person","name":"SkyZeroZx"},"datePublished":"2026-09-02T23:02:21Z","url":"https://github.com/angular/angular/issues/70540"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:eb7a9301-3bf3-0d8b-0310-51244307898b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E452:31E99C:14A4D47:1B90601:6B01309B |
| html-safe-nonce | 8890af2870633bf3e4e2c15853da5fb7531fd195df0cc3ea0ee4e24900915d79 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDUyOjMxRTk5QzoxNEE0RDQ3OjFCOTA2MDE6NkIwMTMwOUIiLCJ2aXNpdG9yX2lkIjoiMTIzMjkyMzI4NjY5OTA2MTQwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 156c2e62dd47d94107ab8253bd99dc030a837482ae970e1607d10a9f1517a595 |
| hovercard-subject-tag | issue:5330158198 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/70540/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b0302e33e17d4720b45a077f33c6d393ef7f8f769fa13c2d463c18861becd5b6/angular/angular/issues/70540 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b0302e33e17d4720b45a077f33c6d393ef7f8f769fa13c2d463c18861becd5b6/angular/angular/issues/70540 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? platform-server Is this a regression? No Description Angular SSR can make its absolute/relative URL decision using a trimmed string, then pass... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SkyZeroZx |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width