GHSA-XPWF-27H9-7JJJ
HTTP client SSRF preset DeniedDestinationsMiddleware::forPrivateNetworkRanges() misses special-purpose ranges such as 100.64.0.0/10
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-XPWF-27H9-7JJJ divulgada · CVSS 6.8 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Impact
`Psl\HTTP\Client\Middleware\DeniedDestinationsMiddleware::forPrivateNetworkRanges()` is the SSRF protection preset of the HTTP client, documented as suitable for applications that fetch user-supplied URLs. Its deny list covered loopback, RFC 1918, link-local and unspecified addresses, but not the other special-purpose ranges of the IANA registries (RFC 6890). An application that relies on the preset while fetching attacker-supplied URLs can be made to connect to:
- `100.64.0.0/10` (shared address space, RFC 6598), which hosts the Alibaba Cloud ECS instance metadata service at `100.100.100.200` (including RAM role credentials), Tailscale and other overlay network nodes, and carrier-grade NAT segments;
- `240.0.0.0/4` (reserved), which some platforms route internally, for example Kubernetes clusters configured with Class E Pod or Service ranges;
- `198.18.0.0/15` (benchmarking), `192.0.0.0/24` (IETF protocol assignments), the rest of `0.0.0.0/8`, the documentation ranges `192.0.2.0/24`, `198.51.100.0/24` and `203.0.113.0/24`, and `192.88.99.0/24`, wherever a network routes them to internal hosts.
The attacker picks the destination through the URL, or through the DNS records of a hostname they control, since the middleware checks the peer address of the established connection. The impact depends on what is reachable on the missed ranges in a given deployment; where nothing listens there, the gap has no effect. Multicast and broadcast addresses were also missing but cannot carry a TCP connection.
IPv4-mapped IPv6 peers such as `http://[::ffff:127.0.0.1]/` and the missed IPv6 ranges (NAT64 `64:ff9b::/96`, 6to4 `2002::/16`, Teredo, site-local, IPv4-compatible) are not reachable on 6.2.x or 6.3.x: `Network` reported IPv6 peers in brackets, which the middleware could not parse, so every connection to an IPv6 peer failed with `Psl\IP\Exception\InvalidArgumentException` before the request was sent. `php-standard-library/cidr` and `php-standard-library/network` 6.4.0 conflict with `php-standard-library/http-client` older than 6.4.0, so Composer upgrades the three together.
Patches
Fixed in 6.4.0 https://github.com/php-standard-library/php-standard-library/releases/tag/6.4.0.
- Adds `0.0.0.0/8`, `100.64.0.0/10`, `192.0.0.0/24`, `198.18.0.0/15`, `224.0.0.0/4`, `240.0.0.0/4` (which includes `255.255.255.255`), `192.0.2.0/24`, `198.51.100.0/24`, `203.0.113.0/24` and `192.88.99.0/24`, and the IPv6 ranges `::/96`, `100::/64`, `64:ff9b::/96`, `64:ff9b:1::/48`, `2001::/32`, `2001:db8::/32`, `2002::/16`, `3fff::/20`, `fec0::/10` and `ff00::/8` to the preset.
- Strips the brackets of IPv6 peer addresses, matches IPv4-mapped IPv6 peers against IPv4 entries, exact addresses and CIDR blocks alike, and matches IPv4 peers against IPv4-mapped CIDR entries.
- Skips the check for Unix socket connections, which have no peer IP address, instead of throwing.
- Documents that the middleware checks the resolved peer address, so behind an HTTP or SOCKS proxy it sees the proxy, not the target.
Workarounds
Build the middleware with an explicit list that adds the missing ranges to the preset as `CIDR\Block` entries, for example `new CIDR\Block('100.64.0.0/10')`, `new CIDR\Block('198.18.0.0/15')`, `new CIDR\Block('192.0.0.0/24')`, `new CIDR\Block('0.0.0.0/8')` and `new CIDR\Block('240.0.0.0/4')`, and prefer CIDR blocks to exact `IP\Address` entries. Egress filtering at the network layer also blocks these destinations independently of the client.
References
- RFC 6890 (Special-Purpose IP Address Registries)
- RFC 6598 (IANA-Reserved IPv4 Prefix for Shared Address Space)
- RFC 4291 section 2.5.5 (IPv6 addresses with embedded IPv4 addresses)
- RFC 6052 section 2.1 (well-known NAT64 prefix)
- RFC 3056 section 2 (6to4)
- https://www.iana.org/assignments/iana-ipv4-special-registry/
- https://www.iana.org/assignments/iana-ipv6-special-registry/
- https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
- 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-xpwf-27h9-7jjjLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
