-
Notifications
You must be signed in to change notification settings - Fork 47
Weak PRNG used #132
Comments
For balance, random_compat is used by WordPress (as of 4.4) and currently works cross-platform even on ancient versions of PHP. It will almost certainly work for your users (as you require PHP 5.4+).
I think you're thinking of
|
Scary to say the least. It's rather easy to make a generator that draws entropy from |
Sorry, I hit the You are correct, I was thinking When we create packages for developers to use, we try to use built in php functions and limit the number of external packages we require during the installation of the package. This is the main reason why we initially used built in methods.
|
Luckily, random_compat is a polyfill for the new internal functions in PHP 7. In PHP 7, including the library is a NOP. In PHP 5, it uses the most secure backend available. |
@paragonie-scott so for a little bit of information on how we currently use the As I said before, We are happy to look at these suggestions of changing our current |
Say's who? For reference, urandom is what you want: http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers/ |
As you linked to, if you have access to a kernelspace CSPRNG, whether through an API, or accessing the device directly, you should use it, instead of relying on a userspace CSPRNG, unless you know you need otherwise. Chances are high that the system CSPRNG has already been correctly seeded with sufficient entropy, and it's output is indistinguishable from true random. |
Herp. For some reason pre-coffee I misread that as "Use of /dev/urandom doesn't follow..." Ignore me! |
Thank you again for reporting this. We have removed the weak PRNG from our API Key Options file as it was dead code. Since the PHP SDK requires PHP 5.4 and above, there is never a case where openssl_random_pseudo_bytes would not be available. |
Please be aware that OpenSSL's userspace PRNG isn't fork-safe. |
@paragonie-scott, Thank you for mentioning this. After discussing this with our internal team, I would like to re-visit this. I will reach out to you via email to discuss this further and the possibility of adding this into our SDK. |
Insecure RNG:
stormpath-sdk-php/src/Util/UUID.php
Lines 167 to 181 in 15aee30
Insecure RNG fallback:
stormpath-sdk-php/src/Authc/Api/ApiKeyEncryptionOptions.php
Lines 48 to 50 in 62698ea
Background: https://paragonie.com/blog/2015/07/how-safely-generate-random-strings-and-integers-in-php
Might I recommend https://github.com/paragonie/random_compat instead?
The text was updated successfully, but these errors were encountered: