[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
NetBSD Security Advisory 2013-003: Pseudo-Random bits weaker than expected
-----BEGIN PGP SIGNED MESSAGE-----
NetBSD Security Advisory 2013-003
Topic: Pseudo-Random bits weaker than expected
Version: NetBSD-current: affected prior to Jan 26th, 2013
NetBSD 6.0.*: affected
NetBSD 6.0: affected
NetBSD 5.2.*: not affected
NetBSD 5.1.*: not affected
Severity: Cryptography Weakness
Fixed: NetBSD-current: Jan 26th, 2013
NetBSD-6-0 branch: Jan 26th, 2013
NetBSD-6 branch: Jan 26th, 2013
NetBSD 6.1 will contain the fix.
Please note that NetBSD releases prior to 5.1 are no longer supported.
It is recommended that all users upgrade to a supported release.
Due to a programming error, pseudorandom numbers supplied with a warning
of "insufficient entropy at creation" may only contain sizeof(int) bits
of cryptographic randomness.
When the kernel boots, it creates several instances of the kernel
random number generator very early. Additional random number
generator instances may be created relatively early by, for example,
the sshd script generating keys when it first runs.
Because generators created very early may be keyed when the system
has very little entropy available, the system rekeys those generators
as soon as a "minimum entropy" threshold is passed, where the entropy
collection pool has enough bits to provide bits which are random in the
cryptographic sense: computationally infeasible to distinguish from
actual random noise.
However, internally, the pool has an "entropy estimator" which counts
how many bits have ever been put into the pool, for entropy consumers
who care about information-theoretic randomness rather than cryptographic
randomness. If a consumer asks for "GOOD" bits rather than "ANY" bits,
the consumer will get only entropy-estimate worth of bits -- no more.
The code for keying the stream generators which actually supply bits to
kernel and user consumers requests GOOD bits and then, if it does not
get as many as it wanted, and the user has indicated that cryptographic
randomness is sufficient (for example, by opening /dev/urandom rather
than /dev/random) requests ANY bits for the remainder.
Due to a misplaced parenthesis, if insufficient GOOD bits were available
to satisfy a request, the keying/rekeying code requested either 32 or 64
ANY bits, rather than the balance of bits required to key the stream
The result of this bug is that even after the minimum entropy
threshold was reached, the generators for in-kernel and userspace
consumers could in the worst case be keyed, or re-keyed, with as few
as 32 bits (on 32 bit platforms) or 64 bits (on 64 bit platforms) of
data, plus a 32-bit cycle counter value, plus the name of the generator
(an LWP ID for userspace, a fixed string for kernel consumers),
plus stack noise for the remainder.
Systems which never experience an "insufficient entropy" condition
(for example, systems with hardware random number generators supported
by NetBSD) are not impacted by this bug.
Given that ECDSA ssh host keys are new in NetBSD 6 and get generated
by /etc/rc.d/sshd at system boot if not yet present, it is likely
that for systems that have been updated to NetBSD 6.0 or a netbsd-6
branch kernel before the fix date, ECDSA host keys have being
considerably weakened by lack of actual randomness, especially
since with little system uptime stack contents will be more
predictable than later. Also, for systems newly set up with
NetBSD 6, all ssh host keys are suspect.
Other persistent cryptographic secrets (for example, SSH or SSL keys of
any type) generated using /dev/urandom on NetBSD 6 systems which may have
had insufficient entropy at key generation time may be impacted and should
Solutions and Workarounds
Don't generate cryptographic keys, and don't use random numbers for
critical applications, unless the system has sufficient
"GOOD" entropy. In practice, this means reading from /dev/random
rather than /dev/urandom when using system entropy to generate
Build and install a kernel containing the fix.
For all affected NetBSD versions, you need to obtain fixed kernel
sources, rebuild and install the new kernel, and reboot the system.
The fixed source may be obtained from the NetBSD CVS repository.
The following instructions briefly summarise how to upgrade your
kernel. In these instructions, replace:
ARCH with your architecture (from uname -m), and
KERNCONF with the name of your kernel configuration file.
NEWVERSION with the CVS version of the fix
Versions of src/sys/kern/subr_cprng.c:
To update from CVS, re-build, and re-install the kernel:
# cd src
# cvs update -rNEWVERSION sys/kern/subr_cprng.c
# ./build.sh kernel=KERNCONF
# mv /netbsd /netbsd.old
# cp sys/arch/ARCH/compile/obj/KERNCONF/netbsd /netbsd
# shutdown -r now
For more information on how to do this, see:
Thor Lancelot Simon for causing, finding and fixing the bug and
helping with this advisory.
2013-02-26 Initial release
Advisories may be updated as new information becomes available.
The most recent version of this advisory (PGP signed) can be found at
Information about NetBSD and NetBSD security can be found at
http://www.NetBSD.org/ and http://www.NetBSD.org/Security/ .
Copyright 2013, The NetBSD Foundation, Inc. All Rights Reserved.
Redistribution permitted only in full, unmodified form.
$NetBSD: NetBSD-SA2013-003.txt,v 1.2 2013/02/26 19:40:22 tonnerre Exp $
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (NetBSD)
-----END PGP SIGNATURE-----
Main Index |
Thread Index |