GHSA-6Q49-9M5C-9XGG
HTTP client PooledConnector reuses connections opened with different TLS, SNI or proxy settings, skipping certificate checks
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:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-6Q49-9M5C-9XGG divulgada · CVSS 7.4 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Impact
`Psl\HTTP\Client\Connection\PooledConnector`, the default connector of `Psl\HTTP\Client\Client`, keyed its idle HTTP/1.x connections, its HTTP/2 sessions and its pending (coalesced) connections by origin only: scheme, host and port. The TLS configuration, the TLS server name (SNI) and the HTTP or SOCKS proxy settings of the request were not part of the key, so a request could be sent over a connection that had been opened, and authenticated, with different settings.
`SendConfiguration` is documented to override `tlsConfiguration` and `proxyConfiguration` for a single request, and the `Psl\DNS\HTTP\Connector` decorator, documented on top of `PooledConnector`, replaces the host with the resolved IP address and keeps the hostname only as the SNI host. As a result:
- Certificate verification skipped for stricter requests. After a request to an origin with weaker TLS settings (for example `peerVerification: false`, `allowSelfSigned`, another `certificateAuthority`, or no `peerFingerprints`), a later request to the same origin with stricter settings reused that connection, and its own verification never ran. An attacker on the network path who intercepted the weakly verified connection also receives the stricter requests, including their credentials, and controls their responses.
- Certificate name check skipped with `DNS\HTTP\Connector`. Hostnames that resolve to the same IP address shared one pool entry, so a request to `https://b.example/` could reuse a connection whose certificate was only verified for `a.example`, although RFC 9113 section 9.1.1 and RFC 9110 section 4.3.3 require the certificate to be valid for the new origin. An attacker who can influence the DNS answer for `b.example`, and who holds a valid certificate for a name the application connected to first (for example a URL the attacker supplied), receives the requests meant for `b.example` without a certificate for it.
- Client certificate (mTLS) identity confusion. Requests that set different client certificates through `SendConfiguration::$tlsConfiguration` shared connections, so the server authenticated a request under the identity of whichever request opened the connection. In an application that sends per-tenant client certificates to the same upstream, one tenant's requests could run with another tenant's identity, and requests without a certificate could run with one.
- Proxy skipped or unintended proxy used. A request configured to use an HTTP proxy could reuse a direct connection, so the proxy and any filtering, auditing or egress policy it enforces were skipped. A request configured to go direct, through another proxy, or listed in `skipProxyFor` could reuse a CONNECT tunnel through a proxy, authenticated with that proxy's credentials. When one `PooledConnector` instance is shared between `Client` instances, the same applies to `socksConfiguration`: a request meant to go through a SOCKS proxy, for example for anonymity, could go out directly. Traffic inside a reused HTTPS tunnel stays protected by TLS, verified with the settings of the request that opened it.
Affected are applications that reach the same origin with more than one TLS or proxy configuration through one `Client` (per-request `SendConfiguration` overrides) or through one shared `PooledConnector`, and applications that wrap `PooledConnector` in `DNS\HTTP\Connector`. A `Client` used with a single fixed configuration and without `DNS\HTTP\Connector` is not affected, and Unix socket connections were never taken from the pool. The flaws are reachable over the network, but depend on the application's configuration and, for the certificate checks, on a network or DNS position.
Patches
Fixed in 6.4.0 https://github.com/php-standard-library/php-standard-library/releases/tag/6.4.0.
- Pooled HTTP/1.x connections, HTTP/2 sessions and pending connections are keyed by the origin together with the SNI host, the TLS configuration, the HTTP proxy (URL, authorization, SNI and bypass list), the SOCKS configuration, the Unix socket path, the resolved protocol versions and the HTTP/2 settings, so requests with different transport or security settings never share a connection.
- The key is a SHA-256 hash, so the pool keeps no plain-text proxy credentials.
Workarounds
Use a separate `Client` with its own `PooledConnector` for each TLS, proxy or SOCKS configuration, and do not pass `tlsConfiguration` or `proxyConfiguration` through `SendConfiguration` for an origin that is also reached with other settings. With `DNS\HTTP\Connector`, use `Psl\HTTP\Client\Connection\Connector`, which does not pool connections, as the inner connector.
References
- RFC 9113 section 9.1.1 (HTTP/2 connection reuse)
- RFC 9110 section 4.3.3 (https origins) and section 4.3.4 (https certificate verification)
- https://github.com/php-standard-library/php-standard-library/releases/tag/6.4.0
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistphp-standard-library/http-client |
Corregida | 6.4.0 | — | — |
Packagistphp-standard-library/php-standard-library |
Corregida | 6.4.0 | — | — |
6.4.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/php-standard-library/php-standard-library/security/advisories/GHSA-6q49-9m5c-9xggLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
