Hacking The iPhone, iPod, And iPad With A Web Page

Jailbreaking Apple's iPhone, iPod, And iPad

The best part about being a writer with Tom’s Hardware is not that I get to play with the latest GPUs or CPUs. Sure that stuff is cool, but what’s even more special is the opportunity to meet and talk with the people who make the magic happen. Microsoft’s Cirque du Soleil launch party pales in comparison to meeting with the father of Intel V8 for coffee at the cafeteria on Intel's campus, sitting down with the Nvidia PureVideo engineers over lunch, or simply talking about cars with the guys at AMD.

Today, we’ve got another interview with Charlie Miller of Independent Security Evaluators. As regular readers of Tom’s Hardware know, Charlie was the first person to hack the iPhone and has successfully hacked into a fully-patched Apple MacBook each year at the CanSecWest’s Pwn2Own Contest.

Unless you’ve been living on a remote outpost on Mar Sara, you’ve probably heard about the recent jailbreakme Web site for the iPhone and iPad that launched this month, shortly after the Library of Congress explicitly allowed cell phone “jailbreaking” to be exempt from the DMCA. Although jailbreaking has been around since the original iPhone, and the millions of users of Android-based phones enjoy the opportunity to run any application they want out-of-the-box, the incredible popularity and controversy of the iPhone 4 made it a hot topic for the media, even reaching the New York Times and Wall Street Journal.

The real story doesn’t have to do with jailbreaking, though. It’s how the jailbreak actually happens, and the implications for smartphone security. So without further delay, here’s our interview.

Tom's Hardware: As always, we really appreciate the time you take out for these interviews.

Charlie: No problem. I’m always happy to share technical details with people to give insight into the weeds of security.

TH: What vulnerabilities were exposed for the iPhone and iPad last week?

Charlie: There are two vulnerabilities. The first is a remote code execution in MobileSafari. The error is in the way certain fonts are parsed. The actual exploit uses a PDF to deliver the font, but other methods are possible, I suppose. The second vulnerability is a local privilege escalation in the IOKit framework.

TH: So how does the JailBreakMe website exploit these vulnerabilities to allow the “jailbreaking” to occur?

Charlie: First, jailbreakme gets code running inside MobileSafari with the font bug. However, due to the security architecture of iOS, MobileSafari runs as user “mobile” and within a sandbox. User “mobile” cannot make system configuration changes; only the administrator “root” can do that. Furthermore, the sandbox restricts the actions the exploit can take. For example, the sandbox does not allow MobileSafari to send SMS messages.  

This is where the second exploit comes in. It is the second vulnerability, in IOKit, that allows the code to execute as user root instead of user mobile. From within the context of MobileSafari, the second exploit is launched which raises the privilege of the executing code to that of root. The sandbox is not designed to restrict a root-owned process, and is also easily circumvented at this point. So now the code can write to kernel memory and nothing is sacred. The exploit then disables code signing, and loads some dynamic libraries, which do the work of jailbreaking the phone. 

TH: So the sandbox falls apart. What about the desktop Google Chrome sandbox, and how does MobileSafari compare?

Charlie: They are similar in that they try to restrict the types of actions that code can perform. Adobe Reader will soon also run in a sandbox. In practice, sandboxes force attackers to write two exploits instead of one, as was done here. Sandboxes only provide an additional layer of defense, but do not make exploitation impossible.

TH: Interesting. One of the things I noticed is that the entire jailbreaking process takes a few minutes. How much of this is spent gaining root access to the phone to allow remote execution and how much of this time is the actual installation of the software such as Cydia?

Charlie: The exploit gets code running, elevates to root, and disables code signing almost instantaneously. All the additional time is in performing the actual jailbreak.

  • apache_lives
    Im more interested in Android being installed on the iPhone - looking quite interesting
    Reply
  • who said apple is unbreakable? charlie miller is the man who can kick jobs ball just as easy everytime we visit his website. since I got the iphone4 I found that I had being holding my phone wrong the past 7 years. I have to learn the new way from apple the right way holding my phone but it drops often and hunts my hand too. 2 weeks ago I heard people telling me that my ipad got heatup problem in japan. I believe steve jobs trying to tell everyone in japan that they are holding their mp3 player wrong too after all.
    Reply
  • orionite
    Very interesting article. I take content like this over "Man uses iPhone to cure cancer"-nonsense, any day.
    Reply
  • victorintelr
    Charlie Miller never held it wrong.
    Reply
  • randomizer
    See, real men use Macs.
    Reply
  • rd350
    now if only this worked for a mac :P
    Reply
  • Ragnar-Kon
    randomizerSee, real men use Macs.Oh you are going to get marked down... beware of the windoz trolls.

    Great interview by the way. I had always wondered how he did it, as I had always ran into a dead end when I realized Safari was not run as root. Turns out I was right and it required two exploits. Brilliant.
    Reply
  • kelemvor4
    randomizerSee, real men use Macs.Real men often do what is trendy rather than what makes sense.
    Reply
  • jakthebomb
    George Hotz was the first to hack the iPhone.
    Reply
  • jecastej
    Great interview,

    I think Apple should use its big capital to hire and pay for more engineers to solve all kind of situations. It is not about problems surfacing everywhere or anytime as there are no warranties in real life. And I don't say this just to complain. Now that Apple has the "resources" it should use it on its "own" benefit and, of course, for the benefit of all its users.
    Reply