4

Scenario:
iPhone 5+ with iOS 8+ with system encryption enabled. The phone is on and locked. (the user has authenticated (unlocked phone) at least once since power-up, and then relocked).

What data/apps is not protected (or easily bypassed) with system encryption at this state?
Of special interest is data in native and non-native apps such as

  • photos, videos and audio files
  • calendar entries, SMS and Messenger data
  • e-mail and browsing history

See this previous post for some info. While that questions is similar, this one is about iPhone 5+ with a smaller, more specific scope.
NB: please provide source(s) for your reply.

2 Answers 2

5
+50

By default, most data is protected using the AfterFirstUnlock class key, which certainly would be present on the device; but that's not what you're asking. You want to know what data is accessible, which is a different kettle of fish. In order to access the data, you either have to get the OS give it to you (by finding a lock screen bypass bug; not unheard of) or exfiltrate the class key from device memory somehow. That last bit is hard.

There are many exploits over the years that can give kernel-level code execution on an iOS device, but almost all of them require either unlocked physical access to the device or rebooting, which would clear the AfterFirstUnlock key from memory. The key is not encrypted in RAM, so opening the phone and accessing the RAM chip directly might work, except for the fact that the iPhone uses a package-on-package construction, and the RAM chip would have to be separated physically from the processor first--without destroying the data, so the chip would need power and/or to be frozen the whole time. The NSA might be able to pull this off, but it would take some seriously specialized equipment, and they'd only get one shot.

The USB interface offers many possibilities, as it carries IP traffic (yep, that's IP over USB) to potentially vulnerable applications. However, in iOS8 it's locked until you press "Trust this computer." If the attacker could steal the escrow keybag this creates off your already-trusted local computer, they could attack this way, but they's still need one exploit in a daemon to get code execution, another to break the sandbox, another to elevate to root, and another to patch the kernel.

Jailbreaks are much easier than this, because they can assume the user will help. That means they can use a trusted computer, and they can turn a file placement exploit into a code execution one by having the user tap an icon on their home screen.

Without user cooperation, your best bet is probably the network interface; you'll still require several exploits chained together, and you'll have to steal the password to your router to get the phone to autoconnect to the attacker's network, and then hope you don't have an always-on VPN set up.

Basically, iPhones are very secure. It's a matter of degrees, sure, but I'd still put your locked phone above almost anything but a smart card.

Edit: Source: mainly "iPhone Data Protection In Depth" by Bedrún and Sigwald, but I used to work on iOS security for the DoD. That's not to say we had special knowledge or anything (I wish, to Apple the DoD is a drop in the bucket), but I've certainly spent enough time probing the depths of the Data Protection system!

Edit 2: The biggest vulnerability in this whole system used to be the escrow keybag, which is created when you plug in to a computer and hit "Trust." This contains all the class keys you need to decrypt the phone's data, because iTunes needs to be able to back up the phone. The escrow keybag is encrypted with a random token stored on the phone, so it's normally only useful when transmitted back to the phone, but if you could just exploit something that would let you read that token back from the filesystem, you'd be in business. That said, in the 5S and later, the processor comes with a "secure enclave" that's more-or-less a smartcard built into the chip, which has its own keys. The escrow keybag's decryption key is now stored in an encrypted format, and only the secure element can decrypt it, so this avenue of exploitation has been closed.

8
  • What kind of attack vectors are plausible in the case of connection to attackers network?
    – Manumit
    Sep 18, 2015 at 17:45
  • Your source is amazingly in-depth, shame it's ancient. I will approve this answer (with time) for several useful pointers, if there aren't any better ones.
    – Manumit
    Sep 18, 2015 at 17:53
  • 1
    @Manumit The source is up to date as of iOS 7; I had an Apple engineer who was squeamish answering my questions about Data Protection pull me into an empty bathroom and tell me that research was all precisely correct but he wasn't actually allowed to go into that much detail. Sep 18, 2015 at 18:00
  • 1
    @Manumit Also note that the "big" changes that have happened since then, like Apple announcing that everything would be encrypted by default and pissing off the FBI, just involve changing the default protection class from Always to AfterFirstUnlock. It's super easy to get access to the Always stuff because you don't have to preserve the RAM contents. Sep 18, 2015 at 18:07
  • 1
    @Manumit Basically anything that shows on the lock screen must be accessible AfterFirstUnlock. Additionally, apps can request up to 10 seconds of background execution time (or unlimited time for audio, voip, or gps apps) after they are backgrounded, and that includes when the phone is locked. Apps can't generally handle having data suddenly become suddenly inaccessible, so AfterFirstUnlock it is again. There is another protection class that I don't think is in that source, called CompleteUnlessOpen, that's made specifically for those sorts of situations, but it requires the app support it. Sep 18, 2015 at 18:26
2

There are multiple layers of encryption available on iOS devices which I feel are best explained before saying what can and can't be accessed.

Whole Disk Encryption

For iOS 3 Apple introduced whole disk encryption where the entire hard-drive is encrypted when the device is locked. However the key for this encryption are held within the device so whole disk encryption is easily bypassed if you have physical access to the device as you just need to boot it from an external drive to access the phones file system and retrieve the key.

Data Protection API

From iOS4 onwards apple offers the DataProtection API for developers to use to encrypt their apps. It offers another layer of encryption tied to the users pin. Rather than being held on the device this is held in the users head so getting physical access to the device and booting from an external drive or jailbreaking to access the keys will no longer work.

Developers are given four options they can apply to the whole app or individual files:

  • NSFileProtectionNone - No additional protection
  • NSFileProtectionComplete - Files are encrypted every time the phone is locked
  • NSFileProtectionCompleteUnlessOpen - Files are encrypted unless the file is being used for a background process
  • NSFileProtectionCompleteUntilFirstUserAuthentication - Files are encrypted until the user unlocks their phone for the first time since booting it.

What's secure?

From iOS8 onwards all native apple applications that hold personal information are encrypted using NSFileProtectionCompleteUntilFirstUserAuthentication. This means if the phone is powered off or runs out of battery it's going to be very difficult to access that data where the only publicly known case of this being done has been the FBI case that hit the headlines this year.

As for 3rd party applications the default is still NSFileProtectionNone. It is down to the developer of the app to secure it with one of the four methods above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.