Latest iPhone hacked to blab all your secrets

Dutch hackers have exploited a WebKit bug in mobile web browser Safari to rinse an iPhone 4S of its photos, address book contacts and its browser history. The flaw exists in Apple's iOS 5.1.1 and the latest developer preview of iOS 6, the first public build of which was released last night to fanbois.

It should thus affect iPhones, iPads and modern iPods - including the iPhone 5 due out tomorrow.

The vulnerability could also exist in BlackBerry and Android phones, which also use the WebKit engine in their built-in web browsers, although the hack hasn't been tested on these platforms.

The bug was demonstrated by the team at small biz Certified Secure at the Pwn2Own Mobile hacking contest in Amsterdam this week. A Samsung Galaxy S3 was also broken into and compromised by a separate team at MWR Labs using wireless NFC technology, but the iPhone hack is regarded as a far more serious breach: Apple's handset is known for its strong defences against security attacks, even though it only took the Dutch hackers a few weeks to build their exploit; WebKit is a widely used engine for web browsers; and NFC has a range of a few centimetres and can be switched off.

Simply visiting a malicious web page with Safari is enough to trigger the infiltration: specially crafted JavaScript code is able to attack the internal operation of Webkit to such an extent that memory can be arbitrarily overwritten in the iPhone. This allows the hackers to construct a new block of executable instructions to which the device's ARM processor is then redirected. This safely bypasses Apple's code-signing security system - that only allows authorised executables to run - and other defences, such as address space layout randomisation. The hackers are free to then raid the phone for data and fire it off to a remote server.

Joost Pol and Daan Keuper of nine-person company Certified Secure earned themselves $30,000 by pulling off the exploit in the contest. Security bods were challenged to break into a range of hardware and earn prizes for successfully compromising the gadgets.

Pol and Keuper said it took them relatively little time to twist their way into the iPhone - three weeks as an after-work project.

"We really wanted to see how much time it would take a motivated attacker to do a clean attack against your iPhone. For me, that was the motivation," Pol said in an interview. He continued:

The easy part was finding the WebKit zero-day. It was a basic vulnerability but we had to chain a lot of things together to write the exploit.

Email and SMS were not not available because they were sealed off from the hijacked Safari process and separately encrypted.

Pol said it was significant that they had pulled off the exploit on an iPhone because, in his mind, that was considered the most secure handset of the Blackberry, Android, Windows Phone and Nokia Symbian kit up for attack.

Pol left with this warning:

The CEO of a company should never be doing e-mail or anything of value on an iPhone or a BlackBerry. It's simple as that. There are a lot of people taking photos on their phones that they shouldn't be taking.

Pwn2Own is a yearly security conference running since 2007, and this year is the first one specifically targeting mobile phones. Pol and Keuper said they have since destroyed all copies of their exploit.