Related topics

iOS 7's weak random number generator stuns kernel security – claim

'Trivial' to break PRNG used to mitigate against attacks, says researcher

In an effort to improve iDevice security, Apple replaced its internal random number generator between iOS 6 and iOS 7 – but a security researcher believes Cupertino inadvertently downgraded security.

The issue is outlined here by Azimuth Security, whose Tarjei Mandt also detailed the issue at last week's CanSecWest conference in Vancouver.

Mandt says the early_random() PRNG (pseudo-random number generator), shipped in the latest iOS 7 update, is “alarmingly weak”. According to ThreatPost, he told the conference the PRNG is “deterministic and trivial to brute force”.

The PRNG is started at boot time, and as Azimuth Security explains, it uses what's called a linear congruential generator (LCG) to provide entropy for the PRNG. The company's white paper explains the LRG thus:

“An LCG is an algorithm that yields a sequence of random numbers calculated with a linear equation. LCGs are one of the oldest and best-known pseudo-random number generator algorithms, and are commonly leveraged in standard libraries and applications for being fast and easy to implement. Although these algorithms perform well in resource-constrained environments and have appealing statistical properties, they exhibit some severe defects and are easily broken when confronted by an adversary who can monitor outputs”.

Mandt writes that the vulnerability could recover PRNG outputs “without being assisted by additional vulnerabilities or having prior knowledge about the kernel address space … this may allow trivial exploitation of vulnerabilities previously deemed non-exploitable”.

The early_random() in iOS 7, the company explains in its blog post, can only produce a maximum of 219 unique outputs, and after 217 outputs: the longest sequence of unique PRNG outputs, he writes, is just 131,072.

“An attacker can recover arbitrary outputs if the lower 19 bits of the internal state is known,” Mandt writes in his slide-pack (here). While the system discards the lower three bits of that state, these are trivial to recover from two successive states of the PRNG.

That means the PRNG seed generated at power-up by iBoot is recoverable, he writes.

“An unprivileged attacker, even when confined by the most restrictive sandbox, can recover arbitrary outputs from the generator and consequently bypass all the exploit mitigations that rely on the early random PRNG,” Mandt concludes. ®

Sponsored: Designing and building an open ITOA architecture