fix(platform-server): prevent SSRF bypass via obfuscated URL schemes#68954
fix(platform-server): prevent SSRF bypass via obfuscated URL schemes#68954rootvector2 wants to merge 1 commit into
Conversation
Embedded tabs/newlines hide a scheme from the relative-URL guard, letting the WHATWG URL parser re-resolve the value to a remote origin during SSR. Prefix a single slash so the forced value can only stay a same-origin path.
|
Thank you for reporting this and opening the PR to address the parser discrepancy. I’m struggling to see this as a distinct framework-level vulnerability:
To help me understand the impact better, are there specific, common patterns or real-world use-cases in the Angular ecosystem where standard absolute URLs (like http://example.com) are successfully blocked/rejected by standard validators, but this exact parser discrepancy (ht\ttp://) successfully bypasses those validations while still being resolved to a different origin by the server? |
|
Fair pushback, and you're right that egress filtering in general isn't HttpClient's job. The reason I framed this as a framework-level issue is that The bypass is in that fallback. For So it's not a claim that HttpClient should validate arbitrary egress, just that the existing same-origin guard has a gap for inputs the URL parser silently normalises. |
The backslash SSRF guard in
relativeUrlsTransformerInterceptorFnonly collapses leading slashes, so a relative-looking request URL whose scheme is hidden with embedded tabs or newlines (ht\ttp://attacker.com) is still parsed back into an absolute, cross-origin URL by the WHATWG URL parser. During SSR that becomes a server-side request to an attacker-chosen host. Prepend a single slash so the forced value can only resolve as a same-origin path.