Project

General

Profile

Actions

Bug #4579

closed

SecureRandom + OpenSSL may repeat with fork

Added by normalperson (Eric Wong) over 13 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
ruby -v:
-
Backport:
[ruby-core:35765]

Description

=begin
This could arguably be a bug in OpenSSL or the openssl extension, but
I think it's easier to fix in Ruby right now.

The PRNG in OpenSSL uses the PID to seed the PRNG. Since PIDs get
recycled over time on Unix systems, this means independent processes
over a long time span will repeat random byte sequences. This has
security implications, but fortunately very little software forks
very frequently. I am not a security expert.

I am using OpenSSL 0.9.8g-15+lenny11 (Debian Lenny)

Attached is a script that reproduces the issue (takes a while to run).
It'll output two identical lines to illustrate the issue.

=end


Files

test_fork_random.rb (292 Bytes) test_fork_random.rb normalperson (Eric Wong), 04/15/2011 11:46 AM
ossl_rand.patch (848 Bytes) ossl_rand.patch kosaki (Motohiro KOSAKI), 04/16/2011 12:00 AM
ossl_rand2.patch (923 Bytes) ossl_rand2.patch kosaki (Motohiro KOSAKI), 04/16/2011 12:14 AM
securerandom_opensslfree.diff (2.69 KB) securerandom_opensslfree.diff nahi (Hiroshi Nakamura), 06/11/2011 06:36 PM
securerandom-openssl-pid-recycle.patch (543 Bytes) securerandom-openssl-pid-recycle.patch akr (Akira Tanaka), 06/13/2011 01:11 AM
securerandom.rb.diff (4.82 KB) securerandom.rb.diff nahi (Hiroshi Nakamura), 06/16/2011 08:05 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0