guzzlehttp/psr7 accepted URI hosts that contained characters such as @, / or #, a port, or broken IPv6 brackets. When that happens, Uri::getHost() can name a different host from the one a request really goes to. An app that trusts getHost() to decide where a request may go can be tricked into sending it somewhere else.

That can lead to host allowlist bypasses, server-side request forgery (getting your server to make requests on an attacker's behalf), or Host header confusion.

Who is affected

Apps on guzzlehttp/psr7 before 2.12.3 that build a Uri, or call Uri::withHost(), with host data an attacker controls, and then use getHost() for a security or routing decision. The psr7 advisory also lists apps that parse, forward or re-send raw HTTP messages from untrusted sources. Guzzle uses psr7, so apps that build Guzzle request URLs from untrusted host input are affected the same way. If every host you put in a Uri is already trusted and well formed, you aren't affected.

What to do

Update guzzlehttp/psr7 to 2.12.3. The fix rejects these malformed hosts. Until you can update, check host values yourself before building a Uri, and don't treat getHost() as a trust boundary.

Reported by GrahamCampbell.