Symfony: Programmatic Logins Skip the checkPostAuth() Method of User Checkers
- CVE-2026-123746
- GHSA-8f57-m8wj-x65w
Description
Show the whole descriptionHide the whole description
### Description `Security::login()` and `UserAuthenticatorInterface::authenticateUser()` log a user in programmatically, for example after a password reset or after an email verification link. The fix for CVE-2024-50341 made `Security::login()` call the `checkPreAuth()` method of the user checker of the firewall. But neither method ran `checkPostAuth()`: this method runs on the `security.authentication.success` event, which `AuthenticatorManager::authenticateUser()` did not dispatch. As a consequence, an account that a user checker rejects in `checkPostAuth()`, such as an expired account, was refused by form login and the other authenticators of the firewall, but could still be logged in through these methods. Applications are affected when they use a custom user checker that rejects users in `checkPostAuth()` and log users in programmatically. On 6.4 and up, the default user checker does nothing in `checkPostAuth()`. On 5.4, it rejects users of the deprecated `User` class whose credentials expired. ### Resolution `AuthenticatorManager::authenticateUser()` now dispatches the `security.authentication.success` event once the token is created and before it is stored, as authentications through the firewall do. `checkPostAuth()` runs on this event and can reject the user. As a consequence, an exception thrown by `checkPostAuth()` now comes out of `Security::login()` and `authenticateUser()`. Code that logs users in programmatically, such as a registration controller, may need to catch it. `UserAuthenticatorInterface::authenticateUser()` still doesn't call `checkPreAuth()`, on purpose. That's where checks like "the email isn't verified yet" usually are, and registration controllers use this method to log in users that just registered. The patches for this issue are available [here](https://github.com/symfony/symfony/commit/af0aae5012beedf0a0c3fd581fd8b9ef696240c4) for branch 5.4 (and forward-ported to 6.4, 7.4, 8.1 and 8.2). ### Credits Symfony would like to thank Vincent Cassiau (CyberVanguard) for reporting the issue and Nicolas Grekas for providing the fix. Symfony would also like to thank [Bruno Dias](https://github.com/cx-bruno-dias) from Checkmarx for their help getting a CVE assigned.
Text from the GitHub Advisory record.
Affected
symfony/security-httpPackagist
- all versions, fixed in 5.4.56
- from 6.0.0, fixed in 6.4.50
- from 7.0.0, fixed in 7.4.23
- from 8.0.0, fixed in 8.1.11
symfony/symfonyPackagist
- all versions, fixed in 5.4.56
- from 6.0.0, fixed in 6.4.50
- from 7.0.0, fixed in 7.4.23
- from 8.0.0, fixed in 8.1.11
Timeline
- Published
Related news
No article from the followed outlets names this vulnerability.