Packages / @angular/common / Security

ModerateVulnerabilityGHSA-jfgx-762w-99vrCVE-2026-111753Published 20 Oct 2026

@angular/common: XSRF Token Leakage via URL Parsing Discrepancy in Angular HTTP Client (Incomplete fix for CVE-2025-66035)

Affected releases · @angular/common

  • 21.x21.0.0 – 21.0.2Fixed in 21.0.3
  • 20.x20.0.0 – 20.3.33Fixed in 20.3.34
  • 19.x19.0.0 – 19.2.25No fix on this line yet
  • 18.x and older2.0.0 – 18.2.14No fix, no longer updated

On 21.x, the newest line:

npm install @angular/common@21.0.3
22.x
  1. Not affected

    22.0.0 – 22.2.3

    22 releases, latest

21.x
  1. Affected

    21.0.0 – 21.0.2

    3 releases

  2. Fixed

    21.0.3 – 21.2.25

    40 releases

20.x
  1. Affected

    20.0.0 – 20.3.33

    55 releases

  2. Fixed

    20.3.34

    1 release

19.x
  1. Affected

    19.0.0 – 19.2.25

    43 releases

18.x
  1. Affected

    18.0.0 – 18.2.14

    29 releases

17.x
  1. Affected

    17.0.0 – 17.3.12

    32 releases

16.x
  1. Affected

    16.0.0 – 16.2.12

    30 releases

15.x
  1. Affected

    15.0.0 – 15.2.10

    22 releases

14.x
  1. Affected

    14.0.0 – 14.3.0

    26 releases

13.x
  1. Affected

    13.0.0 – 13.4.0

    30 releases

12.x
  1. Affected

    12.0.0 – 12.2.17

    30 releases

11.x
  1. Affected

    11.0.0 – 11.2.14

    28 releases

10.x
  1. Affected

    10.0.0 – 10.2.5

    28 releases

9.x
  1. Affected

    9.0.0 – 9.1.13

    22 releases

8.x
  1. Affected

    8.0.0 – 8.2.14

    23 releases

7.x
  1. Affected

    7.0.0 – 7.2.16

    27 releases

6.x
  1. Affected

    6.0.0 – 6.1.10

    20 releases

5.x
  1. Affected

    5.0.0 – 5.2.11

    22 releases

4.x
  1. Affected

    4.0.0 – 4.4.7

    30 releases

2.x
  1. Affected

    2.0.0 – 2.4.10

    24 releases

587 stable releases of @angular/common, oldest to newest, one row per major.

Is your project affected?

Paste your package.json, or type the range you declare for @angular/common. It is read in your browser and sent nowhere.

What happens

An incomplete fix for GHSA-58c5-g7wp-6w37 (CVE-2025-66035) in @angular/common's HTTP Client (HttpClient) allows Cross-Site Request Forgery (XSRF) tokens to be leaked to attacker-controlled cross-origin domains when requests use URLs that exploit parsing discrepancies between regular expressions and the browser's WHATWG URL parser.

Technical Description

To address CVE-2025-66035, xsrfInterceptorFn introduced a regular expression (const ABSOLUTE_URL_REGEX = /^(?:https?:)?\/\//i) to detect and skip absolute and protocol-relative URLs before attaching the X-XSRF-TOKEN header.

However, browsers resolve request URLs passed to fetch() and XMLHttpRequest.open() using the WHATWG URL parser. For http: and https: schemes, the WHATWG URL standard performs several normalizations prior to resolving the authority/origin:

  • Backslashes (\) are treated as forward slashes (/) — e.g., /\evil.example/x, \\evil.example/x, \/evil.example/x, https:\\evil.example/x, https:/\evil.example/x.

  • Leading and trailing C0 control characters and spaces (<= 0x20) are stripped — e.g., ' //evil.example/x', '\0//evil.example/x', '\x1f//evil.example/x'.

  • ASCII tab (\t), newline (\n), and carriage return (\r) characters are removed anywhere in the input — e.g., '/\t/evil.example/x', '/\n/evil.example/x', 'htt\tps://evil.example/x'.

Because these URLs do not match /^(?:https?:)?\/\//i, xsrfInterceptorFn treats them as relative same-origin URLs and attaches the X-XSRF-TOKEN header, while the browser resolves and dispatches the request to the cross-origin host (evil.example).

Note: Angular 21.0.3+ and 22.x replaced the regular expression with a WHATWG new URL(req.url, locationOrigin) origin comparison in #65683 and were already unaffected. However, the 20.3.x LTS branch retained the regular expression until 20.3.34.

Impact

The token leakage bypasses Angular's built-in XSRF protection on affected versions, allowing an attacker to capture the user's valid X-XSRF-TOKEN header if their server permits the request and custom header via CORS. Once obtained, the attacker can perform Cross-Site Request Forgery (CSRF) attacks against the victim user's session.

Attack Preconditions

  1. The victim's Angular application must have XSRF protection enabled (enabled by default in HttpClient).

  2. The attacker must be able to make the application send a state-changing HTTP request (e.g., POST, PUT, DELETE, PATCH) to a URL they control (such as /\attacker.example/api or //attacker.example/api).

Patches

The issue is resolved by parsing and comparing the request URL's origin against the application's current origin using the standard URL constructor (new URL(req.url, locationOrigin)).

  • 21.0.3 (and all 22.x releases)

  • 20.3.34

Workarounds

If you cannot immediately upgrade to a patched version:

  • Validate and normalize outgoing request URLs using new URL(url, window.location.origin) and verify that parsedUrl.origin === window.location.origin before passing dynamic URLs to mutating HttpClient requests.

  • Avoid passing untrusted or user-controlled URLs to HttpClient mutating methods.