CVE-2022-24743: Insufficient Session Expiration in Sylius
Summary
CVE-2022-24743: Insufficient Session Expiration in Sylius. Affects sylius/sylius across 2 version ranges.
>= 1.10.0, < 1.10.11
>= 1.11.0, < 1.11.2
Fixed in 1.10.11 or 1.11.2, depending on the release line you run. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Sylius is an open-source e-commerce platform built on top of Symfony. It provides a flexible and customizable solution for creating online stores. The Sylius package is vulnerable to an insufficient session expiration issue, which can lead to unauthorized password changes and token leaks.
Vulnerability Detail
The vulnerability arises from the failure to nullify the reset password token after a password change. This allows the same token to be used multiple times, potentially resulting in unauthorized password changes and the exposure of existing tokens. An attacker could exploit this vulnerability to gain unauthorized access to user accounts and perform malicious actions.
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
>= 1.10.0, < 1.10.111.10.11composer require sylius/sylius:1.10.11 -
>= 1.11.0, < 1.11.21.11.2composer require sylius/sylius:1.11.2
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
If you are unable to immediately update to the fixed versions, you can implement a workaround by overwriting the ResetPasswordHandler class. Below is an example of the code to be used:
<?php
namespace App\CommandHandler\Account;
use Sylius\Bundle\ApiBundle\Command\Account\ResetPassword;
use Sylius\Component\Core\Model\ShopUserInterface;
use Sylius\Component\Resource\Metadata\MetadataInterface;
use Sylius\Component\User\Repository\UserRepositoryInterface;
use Sylius\Component\User\Security\PasswordUpdaterInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Webmozart\Assert\Assert;
final class ResetPasswordHandler implements MessageHandlerInterface
{
private UserRepositoryInterface $userRepository;
private MetadataInterface $metadata;
private PasswordUpdaterInterface $passwordUpdater;
public function __construct(
UserRepositoryInterface $userRepository,
MetadataInterface $metadata,
PasswordUpdaterInterface $passwordUpdater
) {
$this->userRepository = $userRepository;
$this->metadata = $metadata;
$this->passwordUpdater = $passwordUpdater;
}
public function __invoke(ResetPassword $command): void
{
// Code to handle password reset
// ...
$user->setPasswordResetToken(null);
}
}
You should register this class in the container as shown in the following YAML configuration:
App\CommandHandler\Account\ResetPasswordHandler:
arguments:
- '@sylius.repository.shop_user'
- !service
class: Sylius\Component\Resource\Metadata\MetadataInterface
factory: [ '@sylius.resource_registry', 'get' ]
arguments:
- 'sylius.shop_user'
- '@sylius.security.password_updater'
tags:
- { name: messenger.message_handler, bus: sylius.command_bus }
- { name: messenger.message_handler, bus: sylius_default.bus }
This workaround ensures that the reset password token is set to null after a password change, mitigating the vulnerability.
Conclusion
The Sylius package is vulnerable to an insufficient session expiration issue that can lead to unauthorized password changes and token leaks. It is crucial to update the package to the recommended versions or apply the provided workaround to mitigate the vulnerability. For further assistance or support in addressing this vulnerability, please contact DevNack.com.
See every vulnerability recorded for sylius/sylius →
FAQ
The vulnerability allows an attacker to reuse the same reset password token multiple times, potentially leading to unauthorized password changes and token leaks. This can result in unauthorized access to user accounts and malicious actions.
To fix this vulnerability, update the Sylius package to version 1.10.11, 1.11.2, or a later release. Alternatively, you can implement the provided workaround by overwriting the ResetPasswordHandler class.
Yes, you can implement the provided workaround by overwriting the ResetPasswordHandler class. This ensures that the reset password token is properly invalidated after a password change.
For more information, you can open an issue in the Sylius GitHub repository or contact the Sylius team at security@sylius.com.
The vulnerability has a CVSS score of 7.1, indicating a high severity level.
Related vulnerabilities
Recent vulnerabilities recorded for sylius/sylius.