CVE-2026-59882: guzzlehttp/psr7: Host Confusion via Weak URI Host Validation

Published Jul 8, 2026
·
Updated

Impact

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 SERVERNAME or SERVERADDR 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'.

You 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.

Applications 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 noproxy 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.

Patches

The 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.

Workarounds

If 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.

References

https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2 https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3 https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.3

Other sources

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.

MITRE

Affected Software

3 affected componentsFixes available
guzzlehttp/psr7<2.12.3
Guzzlephp Psr-7<2.12.3
composer/guzzlehttp/psr7<2.12.3
2.12.3

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/guzzlehttp/psr7 to a version that resolves this vulnerability.

    Fixed in 2.12.3
  2. Upgrade

    Upgrade guzzlehttp/psr7 to a version that resolves this vulnerability.

    Fixed in 2.12.3
  3. Configuration

    If you cannot upgrade immediately, validate/normalize attacker-influenced host values before building or modifying a `Uri` (including before calling `Uri::withHost()`), and do not rely on `Uri::getHost()` unless the host value has been independently checked using these rules (reject `/`, `?`, `#`, `@`, `\`; reject a colon outside a bracketed IPv6 literal; reject unbalanced brackets).

    guzzlehttp/psr7 (Uri host handling) Uri::assertValidHost() host validation = Reject URI host components containing authority delimiters (`/`, `?`, `#`, `@`, `\`), reject colon outside bracketed IPv6 literal, and reject unbalanced brackets
  4. Configuration

    If parsing/forwarding/proxying/re-serializing URIs from untrusted raw HTTP messages or attacker-controlled `$_SERVER`, validate the host before calling `Message::parseRequest()` or `ServerRequest::fromGlobals()`, and avoid treating `Uri::getHost()` as a trust boundary for any security/routing decision.

    Guzzle / PSR-7 URI usage Trust boundary for Uri::getHost() = Not trusted unless independently validated

Event History

Jul 8, 2026
CVE Published
via MITRE·03:50 PM
Data Sourced
via MITRE·03:50 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·05:17 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jul 21, 2026
Advisory Published
via GitHub·06:35 PM
Data Sourced
via GitHub·06:35 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-59882?

CVE-2026-59882 has a medium severity rating of 6.5.

2

What impact does CVE-2026-59882 have on applications?

CVE-2026-59882 allows malformed URI host components to pass validation, potentially leading to host confusion and SSRF vulnerabilities.

3

How can I mitigate the risks associated with CVE-2026-59882?

To mitigate CVE-2026-59882, ensure the usage of updated versions of guzzlehttp/psr7 that include enhanced URI validation.

4

Which software is affected by CVE-2026-59882?

CVE-2026-59882 affects guzzlehttp/psr7, Guzzlephp Psr-7, and composer/guzzlehttp/psr7.

5

What is the nature of the vulnerability in CVE-2026-59882?

CVE-2026-59882 is related to improper input validation concerning URI host components that could facilitate SSRF attacks.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203