GHSA-Q8H8-PJJQ-CQ2H
Malformed proxy URL can silently bypass the configured proxy in guzzlehttp/guzzle
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-Q8H8-PJJQ-CQ2H divulgada · CVSS 5.9 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
In affected versions, the built-in cURL handlers pass the configured proxy URL to libcurl as text, and some libcurl releases discard a proxy URL they cannot parse instead of failing the transfer. The request then goes directly to its destination, or in one case to another host, and succeeds, so nothing reports that the proxy was not used. The issue is fixed in `7.16.5` and `8.5.4`.
Details
The proxy can come from the `proxy` request option, from a proxy environment variable such as `https_proxy`, or on Guzzle 7 from the raw `CURLOPT_PROXY` and `CURLOPT_PRE_PROXY` cURL options. Five forms are affected. Credentials with a percent-encoded control character, `%00` through `%1F`, make libcurl `7.76.0` through `8.17.0` continue without a proxy; a secret read from a file with its trailing newline produces one, as in `http://user:secret%0A@proxy.example.com:8080`. A proxy host of `.` does the same on libcurl `7.47.0` through `7.51.0`. With more than one `@`, as an unencoded `@` in a password produces, libcurl before `7.65.0` takes the text after the first `@` for the proxy host: most such URLs fail, but the request can go out without a proxy, or to that host. On Guzzle 7 only, a proxy URL with no host, such as `http://user:pass@`, is dropped by libcurl before `7.65.0`, and one with an empty username, such as `http://:token@proxy.example.com:8080`, by libcurl before `7.31.0`; Guzzle 8 rejects the first itself and requires a newer libcurl. Other libcurl releases use the proxy or fail the request.
This is a summary; the patches are the authority. The issue is fixed in `7.16.5` and `8.5.4`, in which the cURL handlers reject these proxy URLs before connecting, whatever the installed libcurl, with a `RequestException` on Guzzle 7 and an `InvalidArgumentException` on Guzzle 8; an empty username is rejected only on libcurl before `7.31.0`. Credentials that really contain a control character can be passed in the raw `CURLOPT_PROXYUSERPWD` cURL option instead. One case stays open on `7.16.5`: libcurl before `7.65.0` reads a single `@` after a `/`, `?` or `#`, as in `http://proxy.example.com:8080/x@other.example`, as the end of the credentials and sends the request to `other.example`; that form is also a working password with an unencoded `/`, `?` or `#`, so it is not rejected. Versions before `7.16.5` and versions `8.0.0` through `8.5.3` are affected.
Proof of concept
A vulnerable flow, reproduced over a real socket on `7.16.4` and `8.5.3` with libcurl `7.88.1` and `8.14.1`, is:
- An application sends its requests through an outbound proxy that restricts or records what it may reach, using the built-in cURL handlers, the default when the cURL extension is installed.
- It reads the proxy password from a file that ends with a newline, percent-encodes it, and configures the proxy `http://user:secret%0A@proxy.example.com:8080`.
- The installed libcurl is `7.76.0` through `8.17.0`.
- libcurl fails to decode the credentials, drops the proxy and reports no error.
- The request reaches `http://example.com/` directly and succeeds; the proxy is never contacted.
Impact
A request that was meant to go through the proxy leaves the host directly: the proxy's restrictions, filtering and logging do not apply to it, and the destination sees the application's own address. From libcurl `7.52.0`, a request sent without the proxy carries nothing derived from the proxy credentials; older releases can send the destination a `Proxy-Authorization` header built from them, and with more than one `@` the username and the start of the password reach the host taken for the proxy.
Exploitation requires the application to use the built-in cURL handlers, to rely on the proxy as a control and not only for reachability, and to run with one of these proxy URLs on a libcurl release in the matching range. No request or response content can trigger it, so it arises by accident, or where someone who is not fully trusted can influence the proxy URL or its credentials. Applications that use the stream handler are not affected.
If you cannot upgrade, remove surrounding whitespace from secrets before building a proxy URL from them, percent-encode an `@` in credentials as `%40`, and refuse to start when the proxy host is empty, for proxy environment variables as well as the `proxy` option.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistguzzlehttp/guzzle |
Corregida | 7.16.5, 8.5.4 | — | — |
7.16.58.5.4Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/guzzle/guzzle/security/advisories/GHSA-q8h8-pjjq-cq2hLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
