Sign in with
Sign up | Sign in

Explaining The Vulnerability

Exclusive Interview: Hacking The iPhone Through SMS

Alan: So, in essence, you’re slowly transmitting the machine code for a full fledged application of your own, only it’s done over 140 bytes at a time?

Charlie: Sort of. I am also carefully setting things up so that memory is in a predictable fashion. Normally, the layout of memory is very unpredictable. But if you make enough allocations of a particular size, you can start to introduce some predictability. This technique is sometimes called heap feng shui, and is used to make exploits that rely on certain conditions more reliable. For example, I have to make sure data I control shows up right before this array that I can access before the first element.

This attack is especially dangerous for a few reasons. One is that it doesn't require any user interaction. Normally, I do browser exploits where you have to get a user to go to a particular site. Here, I can attack your phone while it’s in your pocket or on the charger or whatever. The other thing that makes it really bad is the process that handles SMS messages, CommCenter, runs as root and has no restrictions. By comparison, the browser runs as the lowly "mobile" user and has a sandbox, which prevents it from doing things like forking or sending SMS messages.

Alan: So how did you first discover the vulnerability?

Charlie: I found the bug by sending in thousands of malformed SMS messages to the device, a process known as fuzzing.

Alan: So, the injection framework allowed you direct access to CommCenter? Thousands? Were you sending thousands of random strings and tracking the output?

Charlie: Actually, the framework sat right between CommCenter and the modem on the device. The framework relays all the information from the modem to CommCenter and also could inject SMS messages as well. In this way, there was no way for CommCenter to know if the message had really come from the modem or if it had come for us. 

The data wasn’t totally random. The way it works is you take good data, obtained by reading the SMS-related specifications, and add small anomalies to them. So the whole SMS message is legitimate except one small part. Repeat this for all small parts. It takes a lot of effort to generate these types of test cases.

Alan: So, once you had identified the vulnerability, what did it take to move it toward the exploit stage?

Charlie: As for writing the exploit, it was extremely difficult. I'm used to writing browser exploits where you have a lot of control in the environment. You can make the browser do whatever you want using JavaScript and HTML. This allows the attacker to set up memory in very predictable ways. Here, I was limited to 140 byte SMS messages and the process performed a lot of actions between each message. It took me about 2.5 weeks to get it all worked out, but it was really cool when it worked.

Alan: 2.5 weeks? Wow. That’s essentially nothing compared to how long the iPhone has been around. Was this in the original iPhone software?

Charlie: The bug’s probably been there forever. I checked back to iPhone OS 2.2. That's the scary thing. How many other bugs like this do bad guys know about? I'm a smart guy, but there are plenty of people as smart and smarter than me out there who can find these kinds of bugs.

Ask a Category Expert

Create a new thread in the Reviews comments forum about this subject

Example: Notebook, Android, SSD hard drive

Display all 18 comments.
This thread is closed for comments
  • 0 Hide
    burnley14 , August 7, 2009 6:24 AM
    Wow, don't make Charlie angry. He can take over your phone remotely and kill you with it.
  • 0 Hide
    ethaniel , August 7, 2009 10:57 AM
    Unless he hacks Chuck Norris's iPhone. That would be the end of him. :p 
  • 1 Hide
    ossie , August 7, 2009 11:28 AM
    As usual, mr. Charlie "no more free bugs" just likes to overemphasize his findings - free advertising is always great - but it seems his greediness isn't finding the proper nourishment (read cash from blackmailed manufacturers).
    Crashing an equipment is one thing (getting easier in these days of consumerism induced fast paced "innovation"), but taking it over is in a whole different lot.
    Why didn't he demo the iPhone takeover code at BH? I'm sure he would have liked to really impress the audience, but, as it needs a lot of very careful setup, the chances for failure would have been way too high. There are a lot of unexpected events which could have taken place in a real environment (read through the network), as opposed to a laboratory environment (frame injection without external disturbance), which would impede the "golden sequence" to reach it's victim in the desired way (out of order message delivery is just one, which comes quickly to mind).
  • 0 Hide
    downer88 , August 7, 2009 4:44 PM
    ethanielUnless he hacks Chuck Norris's iPhone. That would be the end of him.

    Chuck Norris doesn't use a phone, he uses his "outside" voice!

    Seriously, no offense but I though mobile phone exploits were nothing new.
  • 0 Hide
    Anonymous , August 7, 2009 7:24 PM
    This should be considered a nice and very credible rebuttal to the ridiculous interview with Joanna Rutkowska... Charlie is a real security expert, and he says Mac security sucks. Take note, Apple fanboys.
  • 0 Hide
    steiner666 , August 7, 2009 10:08 PM
    downer88Chuck Norris doesn't use a phone, he uses his "outside" voice!


    and of course "jailbroken" iphones couldn't take down a network, how stupid must ppl really be to believe Apple/AT&Ts shit
  • -1 Hide
    anonymousdude , August 7, 2009 11:39 PM
    Charlie_FangirlThis should be considered a nice and very credible rebuttal to the ridiculous interview with Joanna Rutkowska... Charlie is a real security expert, and he says Mac security sucks. Take note, Apple fanboys.

    The safety of a Mac lies in its market share. Less market share less atacks,viruses,trojans, etc. That's why people using linux hardly ever have a problem with security.
  • 2 Hide
    Anonymous , August 8, 2009 12:20 AM
    anonymousdude: Linux has all but idiot-proof security, low-level exploits are very difficult, there are package repositories that have everything you could ever need without resorting to potentially untrustworthy 3rd party downloads, and they were doing Microsoft's UAC long before Microsoft, and far better and less annoying. Not to mention, they have a far better scheme for handling execute bits and possible remote execution of arbitrary code. An OS is only as good as the idiot who's using it, but Linux has done by far the best job of idiot-proofing an OS, if it hits 99% marketshare, it will still have a fraction of the problems Windows and OSX do, and there are viruses for OSX, ask Apple who recommend MULTIPLE antiviruses be installed on Macs. Out of tens of thousands of free, open source Linux packages, there are hardly any antiviruses or firewalls even available for Linux, because it is actually for real, not necessary. No shit...

  • -1 Hide
    Anonymous , August 8, 2009 5:30 PM

    OS X is built on UNIX the same as Linux. Please do some research before you spout about things you obviously no nothing about. Otherwise quite wasting the time of everyone that reads the comments.

  • 1 Hide
    Anonymous , August 8, 2009 5:55 PM
    rorosdad: Obviously you know nothing about UNIX or Linux or the inner-workings of OSX. UNIX operating systems follow a standard called POSIX. There is quite a bit of room for differences in how they are implemented. The BSD kernel OSX stole is not the same kernel that Linux uses, besides, most of the security doesn't necessarily happen in the kernel, user interaction happens in the desktop and window managers. Is there package managers for OSX like Synaptic or Adept? Is anybody at Apple smart enough to thwart low-level exploits, or do they only hire "trend-settings hipsters" to be developers? You obviously don't know much about OSes, maybe you should try to educate yourself before acting defiant to me.
  • 0 Hide
    Anonymous , August 8, 2009 6:33 PM
    @rorosdad: So let me see if I understand your logic correctly:

    UNIX is an OS standard developed in the 70s

    Linux and OSX are both based on UNIX, therefore:

    Both must have equally good security, and:

    It doesn't matter how much OSX's developers suck, because if they screwed anything up, it wouldn't be UNIX anymore, because UNIX is perfect and unhackable.

    If I'm not mistaken, isn't Charlie Miller(subject of this interview) a hacker famous for pwning OSX? Do any of his exploits ever work on Linux? Hasn't he been quoted as saying that Linux and Windows are both much harder to hack than OSX? Isn't Apple's uber-shi.t Safari browser a liability in itself?

  • 1 Hide
    matt87_50 , August 10, 2009 3:57 AM
    "Charlie: I found the bug by sending in thousands of malformed SMS messages to the device, a process known as fuzzing."

    Apple's QA should have done this, this is similar to a Soak test, QA's bread and butter.

    oh and i'm sorry, what? "I can't fault them too much, it was hard to find". yes it would be hard to find, but to call it in the first place and not check the return type? to code it in such a way that it will only work if there is no error in the SMS (expected size == actual size).

    If i was worried about security at all, I would NOT buy a device coded like this. trusting a hardware buffer overrun protection system to handle all your problems? just pathetic!

    Good to see him call BS on the apple jailbreak argument!
    while I bet apple was all too happy to take his advice on how to patch the iphone, they will just ignore him on this point.
  • 0 Hide
    Anonymous , August 10, 2009 2:24 PM
    @Synonymous Dude

    "...but Linux has done by far the best job of idiot-proofing an OS..."

    Yes, typing "tar zxvf blahblahblah-1.1-x86.gz cd /usr/bin/blah" is so "idiot-proof" that everyone will be doing it.
  • 0 Hide
    Anonymous , August 10, 2009 7:26 PM
    vitalDude: Last time I checked, most distros come with a WinRAR-esque utility where you can double-click, extract, etc... Just like you would in Windows, although if you're talking about installing stuff with GNU Make, I doubt most Linux noobs would be installing stuff outside of package managers.

    Epic fail.
  • 0 Hide
    sdbryan , August 10, 2009 8:11 PM
    rorosdads_dadrorosdad: ... Is anybody at Apple smart enough to thwart low-level exploits, or do they only hire "trend-settings hipsters" to be developers? ...

    It seems that you have never been to a Mac developer conference. I only bother to make that observation because the comment about "trend-setting hipsters" in reference to Apple's Mac OS team is so comical. It might be true about marketing people at Apple but it was easy to observe that as the api level got lower, the engineer from Apple got larger (wider rather than taller) and more disheveled. [Obviously being a trend-setting hipster was not a criterion for choosing personnel]. Any technology company that has been a significant player for well over thirty years is going to have its ups and downs but it is absurd to dismiss its engineering bona fides.
  • 0 Hide
    Anonymous , August 10, 2009 10:20 PM
    sdbryan: Apples engineers are so good that they failed at writing their own OS, so they stole BSD because it was literally the only thing they could steal and then make closed-source. As a byproduct of this, they don't even have expertise of their own OS. The Windows API is pretty slick since .NET came out, but since not even Apple properly understands the inner-workings of OSX, they have buggy APIs, which is why nobody can properly port an application to OSX, anything that is cross-platform runs 1000x better on Windows, and much faster.
  • 0 Hide
    Anonymous , August 11, 2009 5:44 AM
    @Ive_seen_the_promised_land: WRONG! OSX originated from NextOS which was an operation system developed by Steve Jobbs's break-away company called NextStep. The monolithic/micro kernel hybrid and base libraries come from a merged NextOS and BSD. The BSD libraries in use were not stolen and still remain open source. Apple help to maintain these libraries. The rest of the operating system including the UI is based on NextOS. NextStep merged with Apple. Many of the designs by NextStep became the modern day Apple designs. The Windows API is not slick - just look at the object model... hideous. No one ports windows applications to OSX because .NET "point and click" programmers can't program in an environment that is not "Visual" nor can they comprehend Java, Objective C or any other slightly intellectually challenging language like Ruby or Scala that allow you to program in a non-imperative way. Recursion? What's that?
  • 0 Hide
    Anonymous , August 11, 2009 1:05 PM
    bottoms: If I understand you correctly, you're saying that Visual Studio makes programming entirely too easy? Of course, that kind of pointless elitism is consistent with Macs and their users. I'm a MS-hating Linux fanboy, but I can admit that Visual Studio raised the bar for IDEs, it is hard to use something lesser after you've used VS. Thankfully, there is Monodevelop, so I can still write C#/.NET apps in Linux without having to resort to more archaic IDEs that require ninja-like concentration skills for the entire coding session.