The Angular team has issued a high-severity security advisory regarding a logic flaw in the framework’s HTTP Client that could render applications vulnerable to Cross-Site Request Forgery (CSRF) attacks.
The vulnerability, tracked as CVE-2025-66035, allows an attacker to steal a user’s XSRF token by exploiting how Angular handles “protocol-relative” URLs.
Angular applications typically have built-in protection against CSRF attacks. The framework is designed to automatically attach an authentication token (the X-XSRF-TOKEN header) to requests sent to the “same origin” (the application’s own server). To determine if a URL is external, Angular checks if the URL starts with http:// or https://.
However, the vulnerability reveals a blind spot: Protocol-Relative URLs.
If an application makes an HTTP request to a URL starting with // (e.g., //attacker.com), Angular incorrectly identifies this as a “same-origin” request. Consequently, it automatically attaches the user’s secret XSRF token to the outgoing request header.
This leakage completely undermines Angular’s built-in CSRF defenses. If an attacker can coerce the application into making a POST request to a domain they control using the // format, they will receive the victim’s valid token.
With the token in hand, the attacker can successfully forge requests on behalf of the victim, performing unauthorized actions within the user’s active session.
The Angular team has released patches for three major versions. Developers are strongly advised to upgrade their applications to the following versions immediately:
- v21.0.1
- v20.3.14
- v19.2.16
If patching is not immediately feasible, developers must ensure that HttpClient requests never use protocol-relative URLs. All backend communication should be hardcoded to use:
- Relative paths (starting with a single /).
- Fully qualified, trusted absolute URLs (e.g., https://api.my-app.com).