Tag Archive for 'ipod'

Dec 05

Iphone protection scheme analysis

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

  1. Enforcing mobile contract subscription
  2. 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:

  1. The firmware
  2. The Baseband
  3. 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:

  1. The activation
  2. The jail
  3. 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

activation

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 :

  1. The Operating system file system is mounted as read only: you can’t write on it.
  2. 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).

installpic2

 

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.

iphone-summerboard-touchthemeimg9000oh6

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:

ibrick Jailbreak-Official

 

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.

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.

sim

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.

Turbo sim1 300

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.

anysim-iphone

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:

  1. Install the oktoprep software that will maintain the jailbreak during the upgrade process (not totally accurate here but it give you the idea)
  2. Upgrade the firmware to 1.1.2 with iTune
  3. Use jailbreaker 1.1.2 to re-activate and re-jaibreak the iphone thanks to the oktorep software
  4. 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.
  5. 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.

Nov 09

Firmware 1.1.2 for Iphone and Itouch released and already jailbroken

With the upcoming release of the iphone in England and Germany, Apple have issue a new firmware (1.1.2) that patch the current jailbreak method based on the tiff exploit. A twin firmware for ipod touch was release also. It does not seems to appear that the new apple firmware introduce new features to the iphone. It however according to mac rumor the long time waited functionnaly to add an event in the calendar was added to the touch.

It seem’s that the 1.1.2 firmwae is already broken and the ipod touch is jaibreaked (see the screenshot ) and read this post to know more. Since the new firmware patch the tiff exploit (see endgadget screenshot below) I wonder want exploit is used. Since the jailbreak was so fast it is likely that the team had the exploit ready for many weeks and keep it secret. Thus my bet is it work even on old firemware.