Medium

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

  • Disclosed: 20.10.2026
  • Updated: 20.10.2026 23:22

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.

What to do

Upgrade to patched versions:

  • 21.0.3 (and all subsequent 22.x releases)
  • 20.3.34

The vulnerability is resolved by parsing and comparing the request URL origin against the application current origin using URL (new URL(req.url, locationOrigin)).

If an immediate upgrade is not possible:

  • 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.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
npm package @angular/common >= 21.0.0, < 21.0.3, >= 20.0.0, < 20.3.34, <= 19.2.25 21.0.3, 20.3.34

References

CVSS score -
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
Weakness (CWE)
CWE-201, CWE-359
Platform
npm
Package
@angular/common
Disclosed
20.10.2026
Updated
20.10.2026 23:22

Sources and licenses · Edited or translated by DockRay; source rights and applicable licenses are retained.

OSV / GitHub Advisory Database - GHSA-jfgx-762w-99vr - CC BY 4.0

Vulnerability history: @angular/common

All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.

Total entries
8
First → latest
11.2025 10.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • High 6
  • Medium 2

Disclosures per year

  1. 2025: 1
  2. 2026: 7
  1. @angular/common: XSRF Token Leakage via URL Parsing Discrepancy in Angular HTTP Client (Incomplete fix for CVE-2025-66035) this entry
    Medium CVE-2026-111753 >= 21.0.0, < 21.0.3, >= 20.0.0, < 20.3.34, <= 19.2.25 21.0.3, 20.3.34
  2. Medium · 4.0 CVE-2026-88059 >= 22.0.0, < 22.1.1, >= 21.0.0, < 21.2.20, >= 20.0.0, < 20.3.28, <= 19.2.25 22.1.1, 21.2.20, 20.3.28
  3. High CVE-2026-68945 >= 22.0.0-next.0, < 22.0.2, >= 21.0.0-next.0, < 21.2.19, >= 20.0.0-next.0, < 20.3.27, <= 19.2.25 22.0.2, 21.2.19, 20.3.27
  4. High · 7.5 CVE-2026-54268 >= 22.0.0-next.0, < 22.0.1, >= 21.0.0-next.0, < 21.2.17, >= 20.0.0-next.0, < 20.3.25, <= 19.2.25 22.0.1, 21.2.17, 20.3.25
  5. High · 6.1 CVE-2026-54266 >= 22.0.0-next.0, < 22.0.1, >= 21.0.0-next.0, < 21.2.17, >= 20.0.0-next.0, < 20.3.25, <= 19.2.25 22.0.1, 21.2.17, 20.3.25
  6. High · 6.1 CVE-2026-50171 >= 22.0.0-next.0, < 22.0.0-rc.2, >= 20.0.0-next.0, < 20.3.22, >= 19.0.0-next.0, < 19.2.23, <= 18.2.14, >= 21.0.0-next.0, < 21.2.15 22.0.0-rc.2, 20.3.22, 19.2.23, 21.2.15
  7. High · 7.5 CVE-2026-50170 >= 22.0.0-next.0, < 22.0.0-rc.2, >= 20.0.0-next.0, < 20.3.22, >= 19.0.0-next.0, < 19.2.23, <= 18.2.14, >= 21.0.0-next.0, < 21.2.15 22.0.0-rc.2, 20.3.22, 19.2.23, 21.2.15
  8. High CVE-2025-66035 >= 21.0.0-next.0, < 21.0.1, >= 20.0.0-next.0, < 20.3.14, < 19.2.16 21.0.1, 20.3.14, 19.2.16

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.