News for hackers. Stuff that matters.
Re:Ruby Bug: SecureRandom should try /dev/urandom first by viraptor on Tuesday May 03, 2016 @08:15PM (#11625278)
So once again, the man page for urandom creates more problems than solutions. (https://bugzilla.kernel.org/show_bug.cgi?id=71211)
Re:Ruby Bug: SecureRandom should try /dev/urandom first by ryuuchin on Tuesday May 03, 2016 @10:14PM (#11625696)
Obligatory "How To Safely Generate A Random Number" link[1] that I always wind up posting in threads like these. There's also the getrandom syscall[2] which uses the /dev/urandom pool.

[1] http://sockpuppet.org/blog/2014/02/25/safely-generate-random...

[2] http://man7.org/linux/man-pages/man2/getrandom.2.html

Re:Ruby Bug: SecureRandom should try /dev/urandom first by duaneb on Tuesday May 03, 2016 @10:27PM (#11625734)
Why are the man pages not so clear?
Re:Ruby Bug: SecureRandom should try /dev/urandom first by ryuuchin on Tuesday May 03, 2016 @10:59PM (#11625848)
I'm not sure. I think part of the problem is that Linux still uses entropy estimation. This is also one of the issues I have with the proposed replacement[1][2] for Linux's current CSPRNG implementation since it still retains entropy estimations.

[1] https://lwn.net/Articles/684568/

[2] https://news.ycombinator.com/item?id=11561340 (HN thread for [1])

Re:Ruby Bug: SecureRandom should try /dev/urandom first by disposeofnick9 on Wednesday May 04, 2016 @06:12AM (#11627321)
Re:Ruby Bug: SecureRandom should try /dev/urandom first by masklinn on Wednesday May 04, 2016 @04:22AM (#11626963)
> There's also the getrandom syscall[2] which uses the /dev/urandom pool.

Sadly they just had to include GRND_RANDOM then compound that with GRND_NONBLOCK.

Re:Ruby Bug: SecureRandom should try /dev/urandom first by nitrogen on Tuesday May 03, 2016 @09:50PM (#11625614)
Why is there such a discrepancy between the prevailing sentiment on HN and the actions of whoever controls the manual? What is preventing one side from convincing the other, apart from stubbornness?

Also, why are the Ruby devs so dead set on the manual page?

Re:Ruby Bug: SecureRandom should try /dev/urandom first by tptacek on Tuesday May 03, 2016 @10:00PM (#11625650)
It's not the prevailing sentiment "on HN". It's the prevailing sentiment among virtually all experts everywhere. I can make a list of those experts, but I'll leave it to someone else, so as not to bogart an lay-up high-quality upvote magnet comment.

The reason this is a problem is simply that the Linux maintainer is obstinately wrong. Theodore Ts'o was on HN a year or so ago, and in defending the current design (and man pages), made some incoherent arguments, such as that urandom might be OK for nonces, but not key generation (a head-scratcher for anyone familiar with cryptography engineering).

Re:Ruby Bug: SecureRandom should try /dev/urandom first by matt_wulfeck on Wednesday May 04, 2016 @01:58AM (#11626519)
Cryptographers really are part of the problem. Do you ever Read the discussions in the metzdowd/crypto list? Nobody agrees on anything.
Re:Ruby Bug: SecureRandom should try /dev/urandom first by tptacek on Wednesday May 04, 2016 @08:07AM (#11627728)
The metzdowd list is a running joke among practitioners. The direct answer to your question is "no."
Re:Ruby Bug: SecureRandom should try /dev/urandom first by azet on Wednesday May 04, 2016 @10:33AM (#11628616)
I stopped reading these 'cypherpunk'-epilog lists a few years back. I'm still subscribed because of cross-postings. The amount of tinfoil-hattery is just unsustainable. And there's barely any interesting information for people working on real cryptography-, systems or engineering.
Re:Ruby Bug: SecureRandom should try /dev/urandom first by nitrogen on Wednesday May 04, 2016 @01:25AM (#11626396)
I didn't mean to dismiss the word of the experts. I only said "on HN" because that's where I'm familiar with your arguments, which I already put into practice by reading /dev/urandom when I need pseudorandom bytes.
Re:Ruby Bug: SecureRandom should try /dev/urandom first by viraptor on Tuesday May 03, 2016 @10:02PM (#11625658)
I have no answer to the first one. Since urandom is periodically reseeded, I believe tptacek and others - at least they provide arguments that justify their position. The other side seems to be just silent.

As for "Also, why are the Ruby devs so dead set on the manual page?" - because it makes sense. If I didn't know much about random number generation, I'd rely on manuals and most widely adopted software. That means: urandom says it's not good for that usage, while openssl is used by almost every system. If you used a dependency that documents it does X and someone tells you that actually it does Y, but you have no ability to prove it either way, would you listen to the docs or random-internet-person.

Re:Ruby Bug: SecureRandom should try /dev/urandom first by zaphar on Tuesday May 03, 2016 @10:30PM (#11625750)

    would you listen to the docs or random-internet-person.
I mean given that scenario as you describe it yes, obviously you go with the docs. But these aren't random-internet people. These are the acknowledged experts in the field. If you are writing crypto related code and aren't familiar with these people then there is far more wrong here than just this bug.
Re:Ruby Bug: SecureRandom should try /dev/urandom first by viraptor on Tuesday May 03, 2016 @11:58PM (#11626069)
I think the problem is that this person is not writing crypto-related code. (or they don't think they do) They write an interface to N underlying interfaces providing RNGs and don't necessarily understand how they work internally or the theory behind them. And that's kind of ok - they made it work correctly, but it could be better.

We don't expect person writing a Ruby binding for sqlite to know the theory behind database indexes and who are the acknowledged experts in that field. Yet we seem to expect that from a person writing binding for RNGs.

Re:Ruby Bug: SecureRandom should try /dev/urandom first by cwyers on Wednesday May 04, 2016 @01:34AM (#11626431)
> We don't expect person writing a Ruby binding for sqlite to know the theory behind database indexes and who are the acknowledged experts in that field.

We don't? More to the point, do we expect them to close a bug related to those things without educating themselves on the subject enough to make a rational decision on it?

Re:Ruby Bug: SecureRandom should try /dev/urandom first by viraptor on Wednesday May 04, 2016 @01:40AM (#11626457)
I don't think it's reasonable to expect they already know that. Whether they should educate themselves... that's up for discussion I guess. The maintainer here effectively says: I read the docs and don't see a reason for a change; if the docs are wrong, prove it by changing them, if there's a bug in dependency handle the issue there.

It's not the best solution, but if I ignored everything I know about this issue, I think it's a reasonable maintainer's approach.

Re:Ruby Bug: SecureRandom should try /dev/urandom first by disposeofnick9 on Wednesday May 04, 2016 @06:22AM (#11627346)
The probability distribution function of average coder understandable-documentation decays exponentially with subject matter expertise, in most cases. Furthermore, it is often semi-rational, usually unconscious non-/for-profit "job-securitization" to lay landmines and obscure functionality to reinforce in-group, elite, "arcane knowledge" hoarding and seem "expert."

A startup founder often wants to work themselves out of a job to do more useful things, most will do all they can to insulate themselves into indispensability (a lot of technical people are super insecure, I'm proly one of them, and a lot of corporate gigs are cut-throat fiefdoms).

Re:Ruby Bug: SecureRandom should try /dev/urandom first by lmm on Wednesday May 04, 2016 @06:56AM (#11627459)
I think it would be entirely reasonable for the person maintaining a Ruby binding for sqlite to follow the sqlite documentation and close any bugs telling them to go against that documentation, yes.
Re:Ruby Bug: SecureRandom should try /dev/urandom first by cwyers on Wednesday May 04, 2016 @11:24AM (#11629002)
It goes against the Linux kernel documentation, yes. As has been pointed out to them, it doesn't go against the documentation on OS X or any of the BSDs. But they engage in the same behavior on those systems.
Re:Ruby Bug: SecureRandom should try /dev/urandom first by lmm on Friday May 06, 2016 @10:21AM (#11644147)
Well, perfectly reasonable to take the intersection of capabilities rather than special-case each platform. AIUI the behaviour of /dev/urandom and /dev/random is the same on OSX and *BSD, so there's no problem with their behaviour there.
Re:Ruby Bug: SecureRandom should try /dev/urandom first by zaphar on Wednesday May 04, 2016 @12:21PM (#11629437)
Except they totally are writing crypto related code. It's called SecureRandom for a reason. If I as a user of Ruby see that code I have certain expectations regarding that. If the Ruby coder maintaining that code is not capable of doing the work required to satisfy those expectations then as I said there is much more wrong than just this bug.

It's reasonable to make this mistake initially sure. But when it's pointed out to you that the documentation is flat out wrong for reasons outside your and others control and you are pointed at articles and research by the experts in this field and you elect to ignore them then the security flaws that will result are very much on you just as much as they are on the linux man page maintainer.

Re:Ruby Bug: SecureRandom should try /dev/urandom first by mintplant on Tuesday May 03, 2016 @10:58PM (#11625846)
> these people

Which people? Could you please name some of them? Honest question - the only name I can think of right now is tptacek's, but I'm sure there are more.

Re:Ruby Bug: SecureRandom should try /dev/urandom first by twr on Tuesday May 03, 2016 @11:41PM (#11626005)
djb, Adam Langley, Dave Wagner, Thomas Pornin, among others.
Re:Ruby Bug: SecureRandom should try /dev/urandom first by jhall1468 on Tuesday May 03, 2016 @10:36PM (#11625784)
Well, to be honest, this isn't the man page creating problems; this is the Ruby core team stubbornly refusing to fix a known problem. Using the man page as justification for their refusal is both stupid and weird. Who uses the Linux man page to determine their security?
Re:Ruby Bug: SecureRandom should try /dev/urandom first by krzyk on Wednesday May 04, 2016 @01:23AM (#11626386)
Well, manpage has always been the source of information, the only better one is kernel source. I think majority would choose it over what some random (an average user doesn't know experts from crypto field by their names) people wrote on a forum on the Web.
Re:Ruby Bug: SecureRandom should try /dev/urandom first by jhall1468 on Wednesday May 04, 2016 @09:05AM (#11628010)
I'd hope the Ruby core team is slightly above average users, and even if not, they could easily verify the claims. They selected not to purely out of stubborness and an unwillingness to admit they were wrong.