FOSUserBundle: Entropy of generated tokens is lost

Affected versions

All 1.0.x, 1.1.x, 1.2.x and 1.3.x versions of FOSUserBundle are affected by this security issue. The 2.0.x development version is not affected.

The issue has been fixed in FOSUserBundle 1.3.5. Note that no fixes are provided for FOSUserBundle 1.0, 1.1 and 1.2 as they are not maintained anymore.


Because of the usage of base_convert which looses precision for large inputs, the entropy of tokens generated by FOSUserBundle for the email confirmation and password resetting is lost. This makes these tokens much less random than they are expected to be, and so not cryptographically safe.


The token generation logic used in the 2.0.x branch based on base64 encoding has been backported. This changes the range of characters used in the token. Any route placeholder expected to match a token generated by FOSUserBundle must be updated to allow dashes, which are not allowed by \w in regexes. A \w+ requirement should so become [\w\-]+.


I would like to thank Andreas Forsblom for reporting this security issue and Jonathan McLean for contributing the implementation which has been backported.

Help the Symfony project!

As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.

FOSUserBundle: Entropy of generated tokens is lost

Tweet this


Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.