Headline
CVE-2023-39343: Merge pull request from GHSA-wmwf-49vv-p3mr · sulu/sulu@5f6c98b
Sulu is an open-source PHP content management system based on the Symfony framework. It allows over the Admin Login form to detect which user (username, email) exists and which one do not exist. Sulu Installation not using the old Symfony 5.4 security System and previous version are not impacted by this Security issue. The vulnerability has been patched in version 2.5.10.
@@ -0,0 +1,82 @@ <?php
/* * This file is part of Sulu. * * © Sulu GmbH * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */
namespace Sulu\Bundle\SecurityBundle\Tests\Functional\Security;
use Sulu\Bundle\TestBundle\Testing\SuluTestCase;
class AuthenticationHandlerTest extends SuluTestCase { public function testLoginFail(): void { $client = $this->createClient([], [ ‘CONTENT_TYPE’ => 'application/json’, ‘HTTP_ACCEPT’ => 'application/json’, ‘HTTP_X-Requested-With’ => 'XMLHttpRequest’, ]);
$client->request('POST’, '/admin/login’, [], [], [], ‘{"username": "not-existing-user", "password": "wrong"}’);
$response = $client->getResponse(); $this->assertHttpStatusCode(401, $response); $notExistUserContent = $response->getContent();
$this->assertSame('{"message":"Invalid credentials."}’, $notExistUserContent); }
public function testLoginSuccess(): void { $client = $this->createClient([], [ ‘CONTENT_TYPE’ => 'application/json’, ‘HTTP_ACCEPT’ => 'application/json’, ‘HTTP_X-Requested-With’ => 'XMLHttpRequest’, ]);
$testUser = $this->getTestUser();
$client->request('POST’, '/admin/login’, [], [], [], ‘{"username": "’ . $testUser->getUsername() . ‘", "password": "test"}’);
$response = $client->getResponse(); $this->assertHttpStatusCode(200, $response); $notExistUserContent = $response->getContent();
$this->assertSame( '{"url":"\/admin\/","username":"test","completed":true,"twoFactorMethods":[“trusted_devices”]}’, $notExistUserContent ); }
public function testLoginFailExistUserHasSameMessageAsNotExist(): void { $client = $this->createClient([], [ ‘CONTENT_TYPE’ => 'application/json’, ‘HTTP_ACCEPT’ => 'application/json’, ‘HTTP_X-Requested-With’ => 'XMLHttpRequest’, ]);
$testUser = $this->getTestUser();
$client->request('POST’, '/admin/login’, [], [], [], ‘{"username": "not-existing-user", "password": "wrong"}’);
$response = $client->getResponse(); $this->assertHttpStatusCode(401, $response); $notExistUserContent = $response->getContent();
$client->request('POST’, '/admin/login’, [], [], [], ‘{"username": "’ . $testUser->getUsername() . ‘", "password": "wrong"}’);
$response = $client->getResponse(); $this->assertHttpStatusCode(401, $response); $existUserContent = $response->getContent();
$this->assertSame($notExistUserContent, $existUserContent); $this->assertSame('{"message":"Invalid credentials."}’, $notExistUserContent); } }
Related news
### Impact It allows over the Admin Login form to detect which user (username, email) exists and which one do not exist. Impacted by this issue are Sulu installation >= 2.5.0 and <2.5.10 using the newer Symfony Security System which is default since Symfony 6.0 but can be enabled in Symfony 5.4. Sulu Installation not using the old Symfony 5.4 security System and previous version are not impacted by this Security issue. ### Patches The problem has been patched in version 2.5.10. ### Workarounds Create a custom AuthenticationFailureHandler which does not return the `$exception->getMessage();` instead the `$exception->getMessageKey();` ### References Currently no references.