Security
Headlines
HeadlinesLatestCVEs

Headline

CVE-2022-29248: [7.x] Fix cross-domain cookie leakage (#3018) · guzzle/guzzle@74a8602

Guzzle is a PHP HTTP client. Guzzle prior to versions 6.5.6 and 7.4.3 contains a vulnerability with the cookie middleware. The vulnerability is that it is not checked if the cookie domain equals the domain of the server which sets the cookie via the Set-Cookie header, allowing a malicious server to set cookies for unrelated domains. The cookie middleware is disabled by default, so most library consumers will not be affected by this issue. Only those who manually add the cookie middleware to the handler stack or construct the client with [‘cookies’ => true] are affected. Moreover, those who do not use the same Guzzle client to call multiple domains and have disabled redirect forwarding are not affected by this vulnerability. Guzzle versions 6.5.6 and 7.4.3 contain a patch for this issue. As a workaround, turn off the cookie middleware.

CVE
#vulnerability#php

@@ -271,7 +271,7 @@ public function getMatchingCookiesDataProvider() /** * @dataProvider getMatchingCookiesDataProvider */ public function testReturnsCookiesMatchingRequests($url, $cookies) public function testReturnsCookiesMatchingRequests(string $url, string $cookies) { $bag = [ new SetCookie([ @@ -386,16 +386,13 @@ public function getCookiePathsDataProvider() ['/foo’, ‘/’], ['/foo/bar’, ‘/foo’], ['/foo/bar/’, ‘/foo/bar’], ['foo’, ‘/’], ['foo/bar’, ‘/’], ['foo/bar/’, ‘/’], ]; }
/** * @dataProvider getCookiePathsDataProvider */ public function testCookiePathWithEmptySetCookiePath($uriPath, $cookiePath) public function testCookiePathWithEmptySetCookiePath(string $uriPath, string $cookiePath) { $response = (new Response(200)) ->withAddedHeader( @@ -407,13 +404,45 @@ public function testCookiePathWithEmptySetCookiePath($uriPath, $cookiePath) “bar=foo; expires={$this->futureExpirationDate()}; domain=www.example.com; path=foobar;” ) ; $request = (new Request('GET’, $uriPath))->withHeader('Host’, ‘www.example.com’); $request = (new Request('GET’, “https://www.example.com{$uriPath}”)); $this->jar->extractCookies($request, $response);
self::assertSame($cookiePath, $this->jar->toArray()[0][‘Path’]); self::assertSame($cookiePath, $this->jar->toArray()[1][‘Path’]); }
public function getDomainMatchesProvider() { return [ ['www.example.com’, 'www.example.com’, true], ['www.example.com’, 'www.EXAMPLE.com’, true], ['www.example.com’, 'www.example.net’, false], ['www.example.com’, 'ftp.example.com’, false], ['www.example.com’, 'example.com’, true], ['www.example.com’, 'EXAMPLE.com’, true], ['fra.de.example.com’, 'EXAMPLE.com’, true], ['www.EXAMPLE.com’, 'www.example.com’, true], ['www.EXAMPLE.com’, 'www.example.COM’, true], ]; }
/** * @dataProvider getDomainMatchesProvider */ public function testIgnoresCookiesForMismatchingDomains(string $requestHost, string $domainAttribute, bool $matches) { $response = (new Response(200)) ->withAddedHeader( 'Set-Cookie’, “foo=bar; expires={$this->futureExpirationDate()}; domain={$domainAttribute}; path=/;” ) ; $request = (new Request('GET’, “https://{$requestHost}/”)); $this->jar->extractCookies($request, $response);
self::assertCount($matches ? 1 : 0, $this->jar->toArray()); }
private function futureExpirationDate() { return (new DateTimeImmutable)->add(new DateInterval(‘P1D’))->format(DateTime::COOKIE);

Related news

Patch released for cross-domain cookie leakage flaw in Guzzle

Drupal rolls out update for issue that is contingent on cookie middleware being enabled

GHSA-cwmx-hcrq-mhc3: Cross-domain cookie leakage in Guzzle

### Impact Previous version of Guzzle contain a vulnerability with the cookie middleware. The vulnerability is that it is not checked if the cookie domain equals the domain of the server which sets the cookie via the `Set-Cookie` header, allowing a malicious server to set cookies for unrelated domains. For example an attacker at `www.example.com` might set a session cookie for `api.example.net`, logging the Guzzle client into their account and retrieving private API requests from the security log of their account. Note that our cookie middleware is disabled by default, so most library consumers will not be affected by this issue. Only those who manually add the cookie middleware to the handler stack or construct the client with `['cookies' => true]` are affected. Moreover, those who do not use the same Guzzle client to call multiple domains and have disabled redirect forwarding are not affected by this vulnerability. ### Patches Affected Guzzle 7 users should upgrade to Guzzle 7.5.0...

CVE: Latest News

CVE-2023-50976: Transactions API Authorization by oleiman · Pull Request #14969 · redpanda-data/redpanda
CVE-2023-6905
CVE-2023-6903
CVE-2023-6904
CVE-2023-3907