GHSA-GQX6-M769-3X35
URI fragments disclosed in stream handler request targets 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:L/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-GQX6-M769-3X35 divulgada · CVSS 3.7 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
In affected versions, `StreamHandler` passes the request URI to PHP's HTTP stream wrapper with its fragment still attached, and when the `stream_context` option `http.request_fulluri` is enabled the wrapper sends that URI as the HTTP request target, fragment included. The issue is fixed in `7.16.3` and `8.5.2`.
Details
A URI fragment is the part after `#`. It is handled by the client and is not part of the HTTP request target, so neither a proxy nor an origin server is meant to receive it. `StreamHandler` opens the request with `fopen()` on the URI as text. PHP's HTTP stream wrapper normally builds an origin-form request target from the path and query and drops the fragment itself, but with `request_fulluri` enabled it sends the URI exactly as given. Guzzle began removing the fragment before opening the URI in `6.2.1`; `6.3.0` lost that step in the stream handler, and the wrapper's usual behavior hid the change. The cURL handlers remove the fragment before setting `CURLOPT_URL` and are not affected.
This is a summary; the patches are the authority. The issue is fixed in `7.16.3` and `8.5.2`, which remove the fragment before the stream handler opens the URI. The rest of the request does not change. One case stays open on `7.16.3`: the raw `stream_context` option `http.follow_location`, deprecated since `7.12.0` and rejected since `8.0.0`, makes PHP follow redirects without returning to Guzzle, and PHP then sends a fragment from the `Location` header itself. Versions before `7.16.3` and versions `8.0.0` through `8.5.1` are affected, except `6.2.1` through `6.2.3`.
Proof of concept
The defect is reproduced over a real socket on both branches. A vulnerable flow is:
- An application sends a request through `StreamHandler`: the cURL extension is unavailable, the handler is configured explicitly, or the request uses the `stream` option, which the default handler stack routes to the stream handler even when cURL is installed.
- It passes the `stream_context` request option with `http.request_fulluri` enabled, a non-standard form that some proxy servers require.
- The request URI carries private data in its fragment, such as `http://example.com/callback?x=1#secret`.
- The stream handler passes the whole URI to `fopen()`.
- The request line on the wire is `GET http://example.com/callback?x=1#secret HTTP/1.1`.
Impact
The fragment is disclosed to the HTTP proxy when an `http` URI is requested through one, and to the origin server otherwise, including for an `https` URI sent through a proxy tunnel. When Guzzle follows a redirect, a fragment in the `Location` header reaches the next server in the same way. A fragment can hold a one-time login secret, an access token, a state value or other data meant only for the client, which is then disclosed to a party that was never meant to receive it.
Exploitation requires the application to send requests through the stream handler, to enable `request_fulluri`, and to request a URI whose fragment is sensitive, and it requires the attacker to be the proxy or the server that receives the request. Applications that use the cURL handlers, that leave `request_fulluri` disabled, or whose request URIs and redirect targets carry nothing sensitive in a fragment are not affected.
If you cannot upgrade, leave `request_fulluri` disabled. Removing the fragment from the request URI before sending also works, but does not cover a fragment that a redirect adds.
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.3, 8.5.2 | — | — |
7.16.38.5.2Arsenal 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-gqx6-m769-3x35Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
