Iphone protection scheme analysis
Posted on : 05-12-2007 | By : Elie Bursztein | In : Hardware, Security
Tags: hardware device, iphone, ipod, jailbreak, protection scheme
13
With the big buzz around this device, many articles and tutorials have been written on how to “hack” them. In this post I will try to give you an insight of the Iphone is protected and how theses security are bypassed.
The Iphone protection aim at two things
- Enforcing mobile contract subscription
- Preventing third party application installation
The first goal of protection has obvious reasons. While the second it is a little bit harder to understand. Of course I do not know for sure but here are some possible reasons to prevent third party application:
- Making the reverse engineering of the Iphone harder
- Limit the attack surface of the Iphone
- Control the distinction between the Ipod touch and the Iphone
- Try to enforce mobile contract subscription because indeed “unsimlocking” the Iphone requires to run a third party soft on the Iphone
Iphone software
Before getting more into protection details, lets first take a closer look at the different pieces of software used in the Iphone. You have three important pieces:
- The firmware
- The Baseband
- The Bootloader
The firmware is the OS (OSX) and the applications that run on the Iphone. A new firmware is released to correct bugs or add functionalities.
Three majors versions of the firmware are available currently the 1.0.2, 1.1.1, 1.1.2. Here I would like to emphases an important point: contrarily to what it is written in many blog, the ability to bypass Iphone protection is not related to the firmware version but to the Bootloader version.
The bootloader is the piece of software responsible of loading the firmware. It is a kind of BIOS if you want. There is two different version of the bootloader : the 3.9 and the 4.6. To make it simple if your Iphone have a bootloader version 3.9 then every protection can be fully bypass by software. If it has a 4.6 version then the jailbreak is possible but not the software sim unlock. However it is only a question of time before the 4.6 is reversed and can be patched. Moreover hardware techniques are still available for simunlock as we will see.
Every phone sold with the firmware 1.1.1 and above use a bootloader 3.9. It is admitted that the bootloader have been switch to the 4.6 between the week 43 to 44. Hence every Iphone with 1.1.2 firmware use the 4.6 version. This include European Iphone (de, en, fr …) and new US Iphone.
The last important piece of software is the baseband. The baseband is the software used to control the modem. Hence this is the software responsible for telephony part of the Iphone. The bootloader is also used to make the firmware work with the baseband software.
Protection Scheme
The protection scheme is based on three distinct mechanisms:
- The activation
- The jail
- The simlock
Activation
The first protection mechanism is the activation. When you start the Iphone for the first time, it ask you to connect to Itune (see the photo below). This protection is meant to prevent using the iphone before the operator subscription is complete. However as you can notice, on the bottom of the photo, it is still possible to make emergency call. This functionality is used to by pass the protection by accessing the contact list. Once in the contact list, the url of the website is entered as a new contact. Then this newly created contact is used to launch safari and access the site that exploit the Tiff vulnerability to jailbreak and activate the iphone. Note that the vulnerability have been patched in firmware 1.1.2 but we will go back to this later. Amusingly, One of the first vulnerability used to hack the PSP was also this exploit
(who ever said that people learn from the past ?). Once activated every functionalities are available except the telephony part. At this point the iphone is a super ipod touch. One of the possible site that can be used for this is jailbreakme

To be more precise, the iphone detect if the activation is done because it check for the lockdownd file. Nowaday every activation method should create a correct lockdownd file and the activation should be upgrade / downgrade proof (However, I haven’t test this point my self).
Jailbreak
The second protection mechanism is called the “jailbreak”. It is called like this because by default it is not possible to install third party software on the iphone. More technically the jail consist of two things :
- The Operating system file system is mounted as read only: you can’t write on it.
- There is no way to upload a file in the iphone. Itune don’t allow you to do so and safari refuse to download files.
Hence the Tiff vulnerability mentioned above is used to remount the file system in read write so application can be written and to open a communication channel that is used to install the first third party software that act as third party application downloader and installer. The standard one is appTapp installer 3 (see the screenshot below).

Once the iphone is activated and jailbreaked, it is like a super ipod touch with custom apps and theme as show in the screen shots above. Note that because the file system is now in a writable it make the iphone more vulnerable: It is now possible to erase or tamper files.


As I said earlier, the Tiff exploit is only available on firmware 1.1.1 and below so how does it work for firmware 1.1.2 and above ? well the idea is pretty simple: the iphone is upgraded to the desired firmware (1.1.2 for example) and then using the recovery mode it is downgraded to the 1.1.1 firmware for activation and jailbreaking purpose thanks to the tiff vulnerability. This is possible because downgrading the firmware does not downgrade the baseband (the software used to control the modem). Once the jailbreak is effective a software is installed to ensure that a second upgrade to the desired firmware does not remove the jailbreak.
That is why jailbreaking is possible even on 4.6 bootloader iphone such as European one. It is also why I said that the ability to by pass iphone protection is not related to the iphone firmware because it is possible to downgrade to 1.1.1. Successful jailbreak of orange iphone have been reported. In this particular case, the activation is done thanks to the orange sim card. A technical point here is to ensure that the iphone have a sim card without a pin code during the upgrade – downgrade – upgrade process.
The software used to perform the jailbreak are sally ibrickr and idemocracy:

Simlock
The last protection mechanism is used to ensure that the iphone is only used in the legitimate operator network. It is the standard simlock scheme used in every phone. You get a discount on the phone because you subscribe for at least X month. Here European people need to understand that the sale of the iphone differs in US in one key point: you do not subscribe a contract when you buy the iphone. The subscription is done via iTune at home. This mean that you can go to a store, buy an iphone and never subscribe. The only things that prevent people to do so is the protection scheme that I describe here. This particularity and the ability to bypass the protection scheme explain why the Iphone black market is so active. This is of course amplified by the euro dollar exchange rate. Tonight, you can by 1787 iphone on ebay.

There is four methods to bypass this last protection. The two hardware techniques are commonly used on other cellphones.
The SuperSim: You buy a programmable SIM, clone your sim and add infos on it to make the iphone believe that this is a legitmate AT&T sim card.

The TurboSIM : The TurboSIM is a passcard that is placed between your simcard and the phone. As you can see in the photo below, you need to cut your sim to make it work.

The Geohot method. This method involve to open the iphone to be able to write directly the firmware. Because this method requiers to open and modify the iphone physically it is highly risky and have been abandoned.
Finally the most common method is the software method. I am aware of at least two different methods to accomplish the unlock but there maybe other. The first one first work by patching the baseband to update the lockstate tables to unlocked, and removes the utoken check. This method have been replaced by the second one it is however the closest method to a “true” unlock because the lockstate tables are set to unlocked. The second method involves to patch out the carrier check in the modem firmware. It is more reversible. These two methods work only with the bootloader 3.9 because they are based on a flaw that as been corrected in the 4.6. That is why iphone security bypass are related to bootloader version and not firmware one.

If you have read until here (thank by the way), you probably have realized that most of the tutorial floating in the web to have an unsimlocked 1.1.2 iphone have un-necessary steps. Indeed this is true. If you have a 1.1.1 unlocked iphone the upgrade procedure is totally straightforward if you have a simcard with no pin code:
- Install the oktoprep software that will maintain the jailbreak during the upgrade process (not totally accurate here but it give you the idea)
- Upgrade the firmware to 1.1.2 with iTune
- Use jailbreaker 1.1.2 to re-activate and re-jaibreak the iphone thanks to the oktorep software
- Repatch the bootloader with Anysim 1.2.1u. Dont forget that the BSD subsystem need to be installed and that the flight mode should be activated during the unsimlock.
- You are done
That’s really all, no extra steps are requiered and the cycle upgrade / downgrade cycle is totally useless. I have test it myself it work and this is a good thing because it is consistent with the rest of the post ![]()
Let me now explains why I believe that it is only a question of time before iphone with 4.6 bootloader will be broken. This is clearly the most technical part of the post so if you might want to skip it. So far unlocks have relied on 3.9 Bootloader bugs that have been fixed in the 4.6 bootloader. First a hardware unlocking will be possible when the new firmware (1.1.3) will be unleashed. It will be possible because the secpack will be updated. Secondly a baseband exploit in the 4.6 have been reported. While highly difficult to exploit, G. Hotz believe that it is possible. This is confirmed by the fact that the DEV-team work on a simunlock solution for the 1.1.2 firmware for 4.6 bootloader. It will work with a IPSF zeroed-token RSA hack. This method will have the advantage to persists through updates and restores.
I conclude this already to long post by giving three remarks on the relation between the 4.6 and 3.9 bootloader.
First why Apple didn’t upgrade the bootloader in the 1.1.2 firmware ? Well, during the upgrade from 1.0.2 to 1.1.1 the bootloader was updated. In consequence many AT&T customers broke their iphone. Hence the cost associated with the upgrade might prohibitive for Apple. It will simply cost to much support.
Secondly for the same reason, downgrading the firmware is unlikely: beside all the technical problem, it is too risky.
Thirdly, even if the bootloader is updated the war is far for being over. The baseband code is way more large than the bootloader and until now no vulnerability have been discover in it. However it is a really good candidate.
I hope that this post have interested you. Feel free to comment it or share it. Next post will be on the notion of attack surface.


The best article about iPhone unlocking I have ever read during searching and reading many articles, posts, etc over the WWW for couple of weeks.
The problem of most posts and articles about unlocking the iPhone is that they only describe step by step the procedure without explaining the technique behind these steps. Most of them even do not mention the Bootloader, nor the Baseband and also do not take into account the different versions of all three important components.
At least this article gives a view behind the activating and unlocking procedure, with which it’s possible to work further…
One interessting point you mentioned in this article, the bootloader has been updated to 3.9 during the upgrade of the firmware from 1.0.2 to 1.1.1. So it is possible to enter and flash the bootloader with software, instead of replacing the chip, how it has been done by Apple with the new >45-week iPhones with 1.1.2 OTB (Out-of-the-Box).
When downgrading an 1.1.2 OTB down to 1.0.2 what happens with the Bootloader? Will the version 4.6 remain or will it be replaced with the former Bootloader, which came with the firmware 1.0.2?
Thanks for the comment. I guess that many people have already try to
downgrade to 1.0.2 a 1.1.2 phone. I believe it does not work because and will only downgrade the firmware since the restoring procedure is for firmware only. I dont see why the bootloader will also be downgraded. However I can’t tell for sure since I haven’t try it myself.
Anyway bootloader 4.6 phones should be unlockable (remember that they are already jaibreakable), in a couple of weeks.
So for an idiot like me, what you’re saying in the artical is that the best you can do (for the moment) to an iPhone with bootloader 4.6 is turn it into a very expensive iPod Touch until firmware 1.1.3 comes out, correct?
The BEST! article I have come across, explaining the technical complexities of the Iphone firmware/software…!
Thanks for the insight!
P.S. revisting reflashing the “bootloader” to 3.9, if it can be done…uhmmmm
Djmk: thanks for the comment. I truly believe that downgrading the firmware is unlikely.
Ben: For now, yes you are correct you can’t unlock it. I will make an other post when there is news
This is a great article. Question: There is no way to downgrade bootloader 4.6?
P.S. Good job!
Most informative site. Well done. I’ve just got a iphone with OTB bootloader 4.6. Its going to be a long couple of weeks. Hopefully before Christmas. Big thank you to all those working on the solution!
Ismail: Thanks for the comment, No there is no way to do so. A new idea that have arise these days is to try to brute force the nck. In other word the idea is to try to find legitimate unlock code. Currently the search space is to large. But if a pattern is found I might be possible to compute unlock code
Daniel: Hope you will enjoy your iphone and thanks for the comment.
my imi # 01136*****
my bootloader 4.6_m3s2
how is this possible?
the guy from ebay said its not refurbished and it came unopened
I’ve had an iPhone for a couple of months now and have upgraded/downgraded/upgraded etc, jailbreaked, unlocked…and it’s only now, after reading this, that I understand what I was doing.
Thank you! I’ve done a lot of searching the web and I’ve never come across an article as comprehensive as this.
It would be really really good if it was updated to current state of iPhone affairs
Iain,
Thanks for the comment. I will probably, make an update post when the SDK will be released, because the next firmware will carry Apple response to the 4.6 unlocking. So it will allows us to see the “big picture”
[...] if you are not sure about the difference please read my previous post about iphone [...]
excellent article! i’ve been reading a lot about the iphone since i jailkbroke mine but as someone said earlier the blogs only take you step by step without the full view of what you’re doing. This article should be the intro for every one of them. Thank you!