Symfony News

CVE-2016-1902: SecureRandom's fallback not secure when OpenSSL fails

Affected Versions

Symfony 2.3.0 to 2.3.36, 2.6.0 to 2.6.12, 2.7.0 to 2.7.8 versions of the Security component are affected by this security issue when used with PHP 5.x without the paragonie/random_compat library listed in your Composer dependencies. Projects using PHP 7 are not affected.

This issue has been fixed in Symfony 2.3.37, 2.6.13, and 2.7.9. Note that no fixes are provided for Symfony 2.4 and 2.5 as they are not maintained anymore. Symfony 2.8 and 3.0 are not affected.

Description

The SecureRandom Symfony class goal is to generate secure random numbers. Several strategies are used depending on PHP's configuration. On PHP installations where the random_bytes() function is not available, Symfony falls back to using openssl_random_pseudo_bytes(). If that does not work, Symfony generates a secure random number using uniqid() and mt_rand(), which are not suitable for cryptographic contexts.

Resolution

The fix consists in removing all the custom code in favor of using the paragonie/random_compat library as was already done in Symfony 2.8 and 3.0.

The patch for this issue is available here.

Credits

I would like to thank Lander Brandt for reporting this security issue. Thanks to Christian Flothmann for writing the fix for the various Symfony versions.


Be trained by Symfony experts - 2016-01-18 Clichy - 2016-01-25 Clichy - 2016-01-25 Clichy


About us

What a Symfony developer should know about the framework: News, Jobs, Tweets, Events, Videos,...

Resources

Find us on Twitter

Find us on Facebook