Closed cweagans closed 9 years ago
See the latest comments in #5 -- if we drop support for old OpenSSL we'll have to tag that as a 1.1.0 branch because of BC concerns.
Actually, this doesn't have anything to do with OpenSSL.
The idea is that if some process manages to write a file to /dev/urandom
on Windows, anything that's trying to read /dev/urandom
will get a decidedly non-random value (i.e. just the contents of the file).
/dev/urandom on Windows
?
Yes, I know it doesn't exist. If you try to write a file to /dev/urandom
, it's presumably saved somewhere, right? I'm really not sure, to be honest. It's been a long, long time since I've done anything on a Windows box. Followed up on the d.o issue for clarification: https://www.drupal.org/node/2550519#comment-10443329
I get it. On Windows, an attacker could write a file to "C:\dev\urandom"
and an unwitting PHP script might read that when reading from path "/dev/random"
and not know that it's bogus.
I have to try this out right away. It's a terrifying idea.
Right. It seems like PHP should complain loudly about that, but then again, there's a lot of things PHP should do that it doesn't (and vice versa).
https://gist.github.com/tom--/556f475c44516d296270
This is really serious.
omfg.
Right. This won't work on random_compat because we have sanity checks already.
But excluding Windows from ever attempting /dev/urandom
hurts nothing: https://github.com/paragonie/random_compat/commit/f56c3e7cf10c5860f69ef67c24d84fc8508c2140
This has never been a problem for random_compat - I know because I was looking for it while initially reviewing the code and would've alerted about it.
I'm very glad to hear that.
What's terrifying is for years we've been telling people "use dev urandom" without warning them about this hazard. This is a very easy thing to overlook.
@cweagans I produced an infographic. Perhaps you'd like to share it on that Drupal issue.
Do the added checks, plus the ones that we arleady had in place, solve this issue?
@paragonie-scott I think so.
See https://www.drupal.org/node/2550519#comment-10442967 for the concern. Is this something that you'd be interested in mitigating in random_compat?