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.