{"id":"CVE-2026-59882","aliases":["CVE-2026-59882","GHSA-c2w2-prh8-qm98"],"related":[],"kind":"vulnerability","state":"published","title":"guzzlehttp/psr7: Host Confusion via Weak URI Host Validation","summary":"guzzlehttp/psr7 is a PSR-7 HTTP message library implementation in PHP. Prior to 2.12.3, Uri::assertValidHost() does not reject URI host components containing authority delimiters, embedded ports, or malformed IPv6 brackets, allowing Uri::getHost() to disagree with the URI authority used for security or routing decisions. This issue is fixed in version 2.12.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"guzzlehttp/psr7 is a PSR-7 HTTP message library implementation in PHP. Prior to 2.12.3, Uri::assertValidHost() does not reject URI host components containing authority delimiters, embedded ports, or malformed IPv6 brackets, allowing Uri::getHost() to disagree with the URI authority used for security or routing decisions. This issue is fixed in version 2.12.3.","source":"cvelist"},{"lang":"en","text":"### Impact\n\n`guzzlehttp/psr7` did not reject URI host components containing authority delimiters (`/`, `?`, `#`, `@`, or `\\`), an embedded port such as `host:8080`, or IPv6 brackets that do not frame the host (such as `[::1` or `::1]`). `Uri::assertValidHost()` rejected only control characters, so these malformed hosts were accepted both when parsing a URI string — including through `new Uri()`, an absolute-form request target passed to `Message::parseRequest()`, and the synthetic `SERVER_NAME` or `SERVER_ADDR` fallback used by `ServerRequest::fromGlobals()` — and when setting a host with `Uri::withHost()`. Because the stored host was not validated, `Uri::getHost()` could return a value that does not agree with the URI's authority or with the host that is actually used on the wire. For example, `Uri::withHost('good.com@evil.com')` is accepted, and `new Uri('http://[gggg::1]/')` produces a `getHost()` of `'[gggg:'` while `getAuthority()` returns `'[gggg::1'`.\n\nYou are affected if your application builds a `Uri` or calls `Uri::withHost()` with host data that is wholly or partly attacker-controlled and then relies on `Uri::getHost()` for a security or routing decision, such as host allowlisting or denylisting, an SSRF guard, cookie scoping, or proxy-bypass selection. You are also affected if you parse, forward, proxy, or re-serialize URIs that come from untrusted raw HTTP messages or from synthetic `$_SERVER` values. Because `getHost()` can then disagree with the real connection target, the concrete impact depends on how your application and any downstream HTTP/1.x component use the URI, and may include host-based access-control bypass, server-side request forgery, routing to an unintended host, or `Host` header confusion. You are not affected if every host you place into a `Uri` is already trusted and well formed.\n\nApplications using `guzzlehttp/guzzle` are affected in the same way through Guzzle's use of PSR-7. Guzzle derives the request `Host` header from the request URI, and its cookie matching and `no_proxy` proxy-bypass matching both read `Uri::getHost()`. An application that builds a Guzzle request URI from attacker-controlled host input can therefore have its `Host` header, cookie scope, or proxy-bypass decision computed against a host that differs from the one Guzzle connects to. This is not the normal request-sending path, and an application that passes only trusted, well-formed URIs to Guzzle and never builds a request URI from attacker-controlled host input is not affected through Guzzle's standard client APIs.\n\n### Patches\n\nThe issue is patched in `2.12.3` and later. Starting in that release, `guzzlehttp/psr7` rejects URI host components that contain authority delimiters, an embedded port, or IPv6 brackets that do not frame the host, both when parsing a URI and via `Uri::withHost()`, so `Uri::getHost()` agrees with the URI authority. A framed bracketed literal whose contents are not a valid IPv6 address is preserved rather than rejected, so `getHost()` still agrees with the authority.\n\n### Workarounds\n\nIf you cannot upgrade immediately, validate and normalize host values before you build or modify a `Uri` from untrusted input, and do not treat `Uri::getHost()` as a trust boundary for a host you have not independently checked. Before passing a host to `Uri`, reject any value that contains `/`, `?`, `#`, `@`, or `\\`, that contains a colon outside a bracketed IPv6 literal, or that has unbalanced brackets. Applications that parse, forward, replay, or re-serialize raw HTTP messages, or that run with attacker-controlled `$_SERVER` values, should validate the host before calling `Message::parseRequest()` or `ServerRequest::fromGlobals()`, and should avoid reparsing untrusted input.\n\n### References\n\n* https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2\n* https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3\n* https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.3","format":"markdown","source":"ghsa"},{"lang":"es","text":"guzzlehttp/psr7 es una implementación de la biblioteca de mensajes HTTP PSR-7 en PHP. Antes de la versión 2.12.3, Uri::assertValidHost() no rechaza los componentes de host de URI que contienen delimitadores de autoridad, puertos incrustados o corchetes IPv6 mal formados, lo que permite que Uri::getHost() no concuerde con la autoridad de URI utilizada para decisiones de seguridad o enrutamiento. Este problema se ha corregido en la versión 2.12.3.","source":"nvd"}],"published":"2026-07-08T15:50:03.077Z","modified":"2026-10-25T17:10:00.197Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N","score":4.2,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N","score":4.2,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N","score":4.2,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-20","CWE-436"],"affected":[{"ranges":[{"version":"< 2.12.3","status":"affected"}],"vendor":"guzzle","product":"psr7","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.12.3"}],"ecosystem":"Packagist","package":"guzzlehttp/psr7","purl":"pkg:composer/guzzlehttp/psr7","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"2.12.3"}],"vendor":"guzzlephp","product":"psr-7","cpe":"cpe:2.3:a:guzzlephp:psr-7:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/guzzle/psr7/security/advisories/GHSA-c2w2-prh8-qm98","tags":["mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/guzzle/psr7/pull/811","tags":["issue-tracking","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/guzzle/psr7/commit/ddd64f17d4cc1f7e5ffe6fd2c989ec7221712580","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/guzzle/psr7/releases/tag/2.12.3","tags":["product","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-59882","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/guzzle/psr7","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-07-08T16:50:26.023Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-59882","url":"https://www.cve.org/CVERecord?id=CVE-2026-59882","licence":"CVE Terms of Use","modified":"2026-07-08T17:00:22.945Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-c2w2-prh8-qm98","url":"https://github.com/advisories/GHSA-c2w2-prh8-qm98","licence":"CC-BY-4.0","modified":"2026-07-21T18:46:10.537Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-59882","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-59882","licence":"Public domain","modified":"2026-10-25T17:10:00.197Z"}],"updatedAt":"2026-11-25T22:59:27.399Z","epss":{"score":0.00186,"percentile":0.08579,"date":"2026-12-01T12:00:22.000Z"}}