Security Experts:

Predictable SSH Host Key Flaw Affects Raspberry Pi Devices

Some Raspberry Pi devices are affected by a security issue stemming from the Raspbian operating system generating weak and predictable SSH keys.

In a post on the Raspberry Pi forums, developer “oittaa” revealed that the hardware random number generator was not enabled in Raspbian by default, which automatically resulted in predictable SSH host keys being generated on the first boot. He also suggested that the issue would reside in the system not being able to seed /dev/urandom before generating SSH keys.

“Raspbian doesn't enable hardware random number generator by default. This causes generation of predictable SSH host keys on the first boot. As soon as the systems starts up systemd-random-seed tries to seed /dev/urandom, but /var/lib/systemd/random-seed is missing, because it hasn't been created yet. /etc/rc2.d/S01regenerate_ssh_host_keys is executed, but /dev/urandom pool doesn't have that much entropy at this point and predictable SSH host keys will be created,” he said.

Based on Debian, the free platform optimized for Raspberry Pi called Raspbian takes advantage of the /dev/urandom function for generating random numbers, the same as Linux does. The function should not depend on the user entropy data, thus making it more popular compared to /dev/random, which generates better random numbers based on user-generated entropy.

Apparently, the /dev/urandom function in Raspbian does not have enough entropy data to work with because the platform tries to generate SSH host keys at boot, and the sequence fails. The operating system generates predictable values, making the SSH keys less secure than they would be should enough entropy data be available.

However, it seems that the Raspbian developers are aware of the entropy issue and are already looking into it, with plans to patch it soon, most probably in the next image, one forum moderator said. Given that the security flaw is being analyzed internally, additional details on the matter are not likely to be provided soon.

To ensure that their devices are kept secure, the owners of Raspberry Pi’s running on Raspbian are advised to update them as soon as a new image is available, which should include a patch for this issue.

As David Holmes, evangelist for F5 Networks' security solutions, explained in a SecurityWeek column earlier this year, entropy is a must for cryptography because keys are generated from random data. However, he also explains that making up random data to have entropy for system’s random number generator (RNG) is not a good idea either, as the stream can be determined if the initial seed values can be guessed.

Holmes also cited a 2009 research paper according to which “between 1 and 2 percent of all SSL keys on the Internet are factorable (and therefore recoverable), largely due to bad entropy. In 2008, a screw-up in the RNG of one of the Debian distributions resulted in only 15 bits of entropy in their keys. This key generation weakness went unnoticed for years.” He also added that “the problem is going to keep happening.”


view counter