I recently had the chance to look into Apple’s iPhone  security model specifically for the 3G and 3GS version. As the iPhone acts as a small computing device my concerns are related to the integrity of the device, communication and the security of data stored locally. Apple provides an “iPhone Security Overview”  which is a good start to find out more about:
Apple iPhone mobile device security features:
Apple Enterprise Management and Security:
- Supports standards-based servers for mail, calendar and contacts integration. Syncing with IMAP mail servers and search the mail server from the iPhone.
- CalDAV-compliant calendar servers like iCal Server, Oracle Beehive, Kerio and Zimbra.
- iPhone 3GS protects data through encryption of information in transmission, at rest on the device, and when backed up to iTunes.
- Provides secure methods to prevent unauthorised use of the device through passcode policies and restrictions.
- In the event of a lost or stolen iPhone, you can even clear all data and settings by issuing a remote wipe command from Microsoft Exchange.
- Network communications stay secure with Cisco IPSec VPN, WPA2 Enterprise Wi-Fi and SSL/TLS on iPhone.
- Microsoft Exchange users can enforce complex passcodes, camera restrictions and other policies on iPhone to protect corporate data.
- Certificate-based authentication enables iPhone to connect with corporate servers via Exchange as well as VPN On Demand, making network communications seamless and secure.
Security Configuration Profiles:
- Establish corporate passcode policies and settings with configuration profiles created and distributed via USB or over the air.
- With configuration profiles, you can remotely configure your company’s VPN, email and wireless network settings, ensuring that each iPhone is secure and ready for business.
- For users, installing a configuration profile is as easy as tapping a secure web link or receiving an email with the configuration profile attached. Configuration profiles can be signed and encrypted – and once installed, individual users can be restricted from removing these profiles from their iPhones.
This is the outcome of the overview and more research on various details matched against the security requirements which I would like to see implemented, so an iPhone can become a reasonable secure mobile network device:
- Platform Protection
- OS Patch Management
- Antivirus Protection
- Network Traffic Filtering
- Application Security
- Data Storage Protection
- Communication Encryption
- Wireless Security
- Manageability of Acceptable Use
||– Runtime Protection (Sandboxing)
– Mandatory Code signing
|Separates local Data stored by applications and the code itself from each other and protects from third-party applications. Code signing binds your application framework to Apple).
|OS Patch Management
||Build in update feature for
|Similar to OS X the phone can fetch automatic updates when connected to a network.
||None built in.
||Apple claims no need for this. Jailbreaking  would make a need for it.
|Manageability of Acceptable Use
||– Password Management and Enforcement
– Remote and local wipe
– Restriction management of:
iTunes Store medias, Use of Safari, Use of YouTube, Use of App Store, Installations of Applications, Use of the camera
|This is mostly to restrict the use of the device through a policy. Most of the sync profile updates can only be synced automatically using a Microsoft Exchange server. However profiles can also be manually applied via email attachment or through a download from a website.
|Network Traffic Filtering
||A built in firewall is not claimed
||A host based firewall solution is not available through Apples App store.
||– Common Crypto APIs
|Solid SSL/TLS support promised.
||– Cisco IPSec
|Solid VPN support promised but I am missing the OpenVPN standard.
||– Password (MSCHAPv2)
– x.509 Digital Certificates
– Shared Secret
– X.509 certificates with RSA keys
|Common Authentication schemas are supported RSASecureID capability can make the phone becoming a one time security token for 2 and more factor authentication.
– WPA2 shared key
– WPA2 Enterprise mode
|Solid Authentication and Encryption support for 802.11 b/g wireless networks.
||– Encrypted configuration
– Encrypted i-Tunes backup
|Encrypted profiles can be only read by an Admin.
Broken authentication model 
||– Hardware based Full DIsk Encryption (FDE).
||Iphone3GS offers hardware-based- encryption and uses AES 256 bit encoding to try to protect all data on the device. Encryption is always enabled and cannot be disabled by users.
However the encryption renders pointless by the FDE key implementation flaw 
||Local passwords and logins are stored in an encrypted local safe.
Mobile computing and storage devices are easily lost or stolen, presenting a high risk for unauthorized access and introduction of malicious software to a network .
These risks should be mitigated to acceptable levels. A portable -computing device and -electronic storage media that contains confidential, personal, or sensitive information should use encryption or equally strong measures to protect the data while they are in transit or stored.
The Apple iPhone can’t fully satisfy the requirements. People should understand that the iPhone 3GS fails to provide full disk encryption (FDE) which renders useless by how the phone manages the protection of the encryption key  and that the authentication model for the FDE is also broken.[see recent update]. Most of automatic sync and update features are built around Microsofts Exchange Server however important security profile management and updates can be achieved by manual interaction of the user without using Exchange.
The iPhone’s operating system is designed to only run software that has an Apple-approved cryptographic signature. This should protect from malicious third-party applications but it certainly leaves authority and actual security management fully in the hand of Apple. There is no open Source code involved and applications can only be chosen from Apples apps store. Apples recent removal of random content and apps  makes users wonder if the trust in Apple is justifiable.
Restrictions can be overcome by “jailbreaking” the device , which involves replacing the iPhone’s firmware with a slightly modified version that does not enforce the signature check. Jailbroken phones are at risk for an iPhone worm and system compromise through malicious applications.
By the time writing there is no way to directly encrypt or sign your email and although there are some more (non security related) caveats like: Java and Flash aren’t supported and the fact Apple iTunes software latest version is only running on Windows and Apple platforms, the iPhone still can be used in an efficient way if people understand that there is no secure FDE available and a appropriate policy is in place to cover these facts.
Having this said, iPhone security really only applies with having a sensible trust in Apples business model, being the gatekeeper for your own security needs, and when user’s attitude takes into account that the iPhones Hard Disk encryption and Authentication model is useless towards storage protection.
Update 17/05/2010: Apple’s iPhone 3GS broken authentication model:
I uncovered a data protection vulnerability , which I could reproduce on 3 other non jail broken 3GS iPhones (MC 131B, MC132B) with different iPhone OS versions installed (3.1.3-7E18 modem firmware 05.12.01 and version 3.1.2 -7D11, modem 05.11.07) , all passcode (4 digits) protected which means the vulnerability bypasses authentication for various data where people most likely rely on data protection through encryption and do not expect that authentication is not in place.
To clarify, the given file access is read and write !
This is what you get via an auto mount without any PIN (passcode 4 digits) request:
The unprotected iPhone 3GS mounting is “limited” to the DCIM folder under Ubuntu < 10.04 LTS, Apple Macintosh, Windows 2000 SP2 and Windows 7. The way Ubuntu Lucid Lynx handles the iPhone 3GS [6,7,8] allows to get more content (please do make sure that the native Ubuntu system is fully up to date, e.g. “apt-get update, “apt-get upgrade” – any virtualization based solution will not work as described). I used the Alternate CD with x86 and AMD64 on different hardware.
The “Libimobiledevice”  developers probably done just their best to make some content available under Linux but nevertheless I would still expect that the iPhone 3GS takes ownership and requests an authentication challenge when in the process to be mounted.
Copied contents file structure:
|bernd@isopiece:~/Desktop/phonecontents$ ls -R
ApplicationArchives com.apple.itunes.lock_sync Downloads Photos PublicStaging Recordings
com.apple.itdbprep.postprocess.lock DCIM iTunes_Control Podcasts Purchases Safari
IMG_0433.JPG IMG_0435.JPG IMG_0436.JPG IMG_0437.JPG IMG_0438.JPG IMG_0439.JPG img_1974.jpg
Artwork Device iTunes Music Ringtones
ArtworkDB F3001_1.ithmb F3002_1.ithmb F3003_1.ithmb F3005_1.ithmb F3006_1.ithmb F3007_1.ithmb F3012_1.ithmb
HashInfo SysInfoExtended Trainer
bests.plist calibration.xml lastWorkout.xml latest preferences.xml settings.plist
2010-04-19 18;07;04.xml 2010-04-20 17;50;49.xml 2010-04-20 18;02;57.xml 2010-04-21 18;01;51.xml
IC-Info.sidb iTunesApplicationIDs iTunesControl iTunes Library.itlp iTunesMovies iTunesPrefs Rentals.plist VoiceMemos.plist
IC-Info.sidv iTunesCDB iTunesDB iTunesMoviePlaylists iTunesPlaylists iTunesPrefs.plist Ringtones.plist
DBTemp Dynamic.itdb Extras.itdb Genius.itdb Library.itdb Locations.itdb Locations.itdb.cbk
./iTunes_Control/iTunes/iTunes Library.itlp/DBTemp/Backup/iTunes_Control/iTunes/iTunes Library.itlp:
Dynamic.itdb Extras.itdb Library.itdb Locations.itdb Locations.itdb.cbk
F00 F02 F04 F06 F08 F10 F12 F14 F16 F18 F20 F22 F24 F26 F28 F30 F32 F34 F36 F38 F40 F42 F44 F46 F48
F01 F03 F05 F07 F09 F11 F13 F15 F17 F19 F21 F23 F25 F27 F29 F31 F33 F35 F37 F39 F41 F43 F45 F47 F49
AUXM.mp3 BPGL.mp3 CMKZ.mp3 DXEC.mp3 FWQN.mp3 IGUA.mp3 KHDB.mp3 MTCN.mp3 OOZM.mp3 OVLK.mp3 RIDE.mp3 SOAU.mp3 TWFV.mp3 UJHE.mp3 YBIW.mp3
BLXF.mp3 CDIN.mp3 DICJ.mp3 EXLN.mp3 GAZI.mp3 JEXQ.mp3 KYKH.mp3 NEUC.mp3 ORHK.mp3 QWGA.mp3 SNIN.mp3 TAPC.mp3 TZIF.mp3 VTCR.mp3
ACPV.mp3 BZVB.mp3 DNTQ.mp3 FDZE.mp3 GECU.mp3 IMPV.mp3 KJCP.mp3 KWFT.mp3 LKJF.mp3 MSPV.mp3 NQVB.mp3 TOJU.mp3 WKQU.mp3 XBTL.mp3 YNYH.mp3
BZPH.mp3 CBSB.mp3 EEWN.mp3 GDYD.mp3 GXSW.mp3 JHUJ.mp3 KPSS.mp3 LDKQ.mp3 MLZI.mp3 NKQK.mp3 PHDL.mp3 TVVO.mp3 WYCW.mp3 YLIT.mp3
20100517 111440.m4a 20100517 111501.m4a 20100519 122148.m4a Recordings.db
Contents list of disk usage:
|bernd@isopiece:~/Desktop/phonecontents$ du -h
4.5M ./iTunes_Control/iTunes/iTunes Library.itlp/DBTemp/Backup/iTunes_Control/iTunes/iTunes Library.itlp
4.5M ./iTunes_Control/iTunes/iTunes Library.itlp/DBTemp/Backup/iTunes_Control/iTunes
4.5M ./iTunes_Control/iTunes/iTunes Library.itlp/DBTemp/Backup/iTunes_Control
4.5M ./iTunes_Control/iTunes/iTunes Library.itlp/DBTemp/Backup
4.5M ./iTunes_Control/iTunes/iTunes Library.itlp/DBTemp
9.0M ./iTunes_Control/iTunes/iTunes Library.itlp
This data protection flaw exposes music, photos, videos, podcasts, voice recordings, Google safe browsing database, game contents… by in my opinion the quickest compromising read/write access discovered so far, without leaving any track record by the attacker. It’s about to imagine how many enterprises (e.g. Fortune 100) actually do rely on the expectation that their iPhone 3GS’s whole content is protected by encryption with a passcode based authentication in place to unlock it.
The contents sample have been collected off a non jail broken iPhone 3GS (with latest iPhone OS installed, all apps fully up to date and immediately “PIN lock” (passcode, 4 digits) enabled, by simply connecting it powered off via USB to a Linux Lucid Lynx PC (10.04) and then switched back on – being automatically mounted with given insecurity and never been attached to the PC before.
Other exposed contents and OS behavior has to be further investigated. The allowed write access could also lead into triggering a buffer overflow.
We already know that iPhone 3GS encryption is broken by the way the encryption key is handled .
The newly uncovered vulnerability shows that the Apple’s iPhone 3GS authentication model is somehow or other broken. The iPhone vulnerability was covered in SANS webcast “iPhone Insecurity” by Jim Herbeck : Webcast audio excerpt of iPhone vulnerability.
Apple iPhone Security Overview :
Protecting data stored on iPhone is important for any environment with a high level of sensitive corporate or customer information. In addition to encrypting data in trans-mission, iPhone 3GS provides hardware encryption for data stored on the device.
iPhone 3GS offers hardware-based encryption. iPhone 3GS hardware encryption uses AES 256 bit encoding to protect all data on the device. Encryption is always enabled, and cannot be disabled by users.
Apple’s product security team (case 105700225) still can’t reproduce described auto mounting and believes it could be a “race condition” or “a pairing issue” but is trying to get to the bottom of this issue and I am more than happy to assist, given a total 33.75 million of iPhones have been sold at Q4 2009 .
Apple could reproduce the as described serious issue and believes to understand why this can happen but cannot provide timing or further details on the release of a fix.
To clarify: This is a iPhone vulnerability and not an Ubuntu/Linux/libimobiledevice specific issue. Please see also “News” under . In other words, Ubuntu Lucid Lynx just helped me to uncover the flaw easier.
The reason behind the issue that some people are not able to reproduce the time-of-check-to-time-of-use (TOCTTOU) bug  lies in the implementation of the iPhone authentication model, not the OS you tested with. So, this has nothing to do with the OS you used, but with the iPhone itself, and nothing else. People are best of luck to reproduce the flaw in getting the long boot cycle by powering off the iPhone from the non locked state.
heise Security did manage to access a full backup of the iPhone by connecting the device to iTunes under Windows, using the flaw I uncovered recently. They could read notes, SMS-messages and even passwords in plaintext.
More info (in German):
The H Security explains their associates findings from heise Security in English:
“While with Linux only a few selected folders on the iPhone were displayed, Windows allowed full system access. For instance, it was no problem to create a complete backup using iTunes, including items such as notes, text messages and even plain text passwords.”
Please follow the uncertain workaround but take it as an intermediate advice:
Shutdown your iPhone only in the locked state and keep it in locked state when not in use.
Please do also use the “encryption” feature with iTunes for your Backup .
Apple will release iOS 4 which might fix the massive security vulnerability for the iPhone 3G and iPhone 3GS. Please update asap. According to Apple the release date will be on the 21st of June 2010.
Apple released today a newer version of the iPhone software (version 4.0 8A293). If you want to update the phone please make sure to get iTunes also updated to the latest version 126.96.36.199 before attempting the software update.
After the first tests done, please bear in mind that I need further investigations followed to provide a more reliable conclusion. So far it turns out that the time-of-check-to-time-of-use (TOCTTOU) bug (race condition)  seems to be patched in iOS4. The flaw is no longer reproducible for me in the way described above.
However, I would not call the issue as cleared off for the time being:
Apple security release notes can be found here and Apple is not mentioning anything about the security improvements towards better authentication and/or encryption.
If you read the installation notes during the software update very carefully you will note:
“* Better data protection using the device passcode as an encryption key* (Requires full restore)”
What this means is that unless you go through the Full restore process you will not gain any data protection improvement promised by Apple.
Although Apple hasn’t pointed this out so far I would recommend following update procedure for iOS4:
Upgrading your iPhone to the latest version is the normal procedure, however if you read the installation notes during the software update very carefully you will note as mentioned:
Apple: * Better data protection using the device passcode as an encryption key* (Requires full restore)
What this means is that unless you go through the “Full Restore” process you will not gain any data protection improvement promised by Apple.
Please follow this procedure:
1.) Make sure your PC system is connected to a reliable power source.
2.) Get iTunes up to date, use the built in update function (Help -> Check for Updates)
3.) Make a backup of your iPhone data: Connect your iPhone to the computer system and open iTunes. Under ‘Devices’ on the left hand side of the window, right-click on the name you assigned your iPhone and first select ‘Sync’. Once this has been completed follow the same procedure, only this time select ‘Back Up’. Again, once this is finished right click on your iPhone and finally select ‘Transfer Purchases’. Once this has been done your iPhone would be fully backed up onto iTunes locally.
4.) iPhone iOS4 installation Phase 1:
Once you have fully backed up your iPhone go onto ‘Summary’ and select ‘Check for Updates’. The option to update to the latest version (4.0) will appear, select the update option and leave the iPhone to run its system update. The iPhone will require restarting.
5.) iPhone iOS4 installation Phase 2:
Note: If a Backup is available you should not lose any data at all.
Once the iPhone has completed its updates, select ‘Restore’ in the ‘Summary’ section of iTunes. If you have already backed up your iPhone with all the latest changes you’ve made to it (New songs, pictures etc) you won’t need to update the iPhone again, just allow it to run its System Restore, this will reset the iPhone back to its factory settings. Once the process is completed the device will restart and the Apple logo will appear on the screen. After the restore, the iPhone displays the “Connect to iTunes” screen. Keep your device connected until the “Connect to iTunes” screen goes away or you see “iPhone is activated.” If iTunes does not have an Internet connection, you cannot complete this step.
Finally, to restore your device from the previous backup you should be able to see a set of options in iTunes, stating that “An iPhone has been previously synced with this computer” with a list of synced devices, select the backup from which you want to restore your settings and select the continue button to complete the devices restoration.
Apple iOS 4 update is disabling your security settings: After the update Apple iOS4 leaves you with no passcode protection and “Erase Data” feature disabled even when you have set this up before the update.
After the iOS4 update make sure under Settings – General – Passcode Lock On:
– Require Passcode is set to “Immediately”
– Simple Passcode is set to “OFF” , I recommend at least 6 characters (numbers and or letters with at least one special character included). This is very important as the passcode will be used to generate your encryption key during the full restore procedure .
– Erase Data is set to “ON”
If you had to change from Simple Passcode “ON” to a more complex passcode follow again the “iPhone iOS4 installation Phase 2” described above. This will generate a new stronger encryption key.
To make it easier, I summarized the iOS4 iPhone update.
 iPhone Security Overview:
http://images.apple.com/iphone/business/docs/iPhone_Security_Overview.pdf or http://tinyurl.com/n6md76
http://www.en.wikipedia.org/wiki/Jailbreaking or http://tinyurl.com/36fxcxc
 University of Central Florida: http://tiny.cc/uo86u
 Wired: Encryption key threat:
 The Register about verboten iPhone Apps:
http://www.theregister.co.uk/2010/03/04/wifi_stumbling_iphone/ or http://tinyurl.com/ye67z3c
iPhone support in Ubuntu 10.04:
 http://www.libimobiledevice.org/ or http://tinyurl.com/yc56msh
 http://www.osnews.com/story/22942/Ubuntu_10_04_To_Support_iPhone_iPod_Touch_ or http://tinyurl.com/ylcfwhr
 http://www.webupd8.org/2010/02/confirmed-ubuntu-1004-supports-iphone.html or http://tinyurl.com/ybybd8g
 Full disclosure:
http://seclists.org/fulldisclosure/2010/May/215 or http://tinyurl.com/3ywwee8
 SANS “iPhone Insecurity” Webcast:
https://www.sans.org/webcasts/iphone-insecurity-93463 or http://tinyurl.com/2vxzyyr
Audio excerpt of the webcast covering the new vulnerability:
Jim Herbeck’s Research for the webcast:
PDF slides of the webcast:
http://nouvelstrategies.com/E/Research/Entries/2010/5/18_iPhone_Insecurity_files/iPhone-Insecurity.Handout.pdf or http://tinyurl.com/32n7sqf
 Wikipedia: iPhone:
http://en.wikipedia.org/wiki/IPhone or http://tinyurl.com/yxmg67
 Time-of-check-to-time-of-use, race condition:
http://en.wikipedia.org/wiki/Time-of-check-to-time-of-use or http://tinyurl.com/d7ect2
 iTunes Backup:
http://support.apple.com/kb/HT1766 or http://tinyurl.com/6ybv4r