iOS Security Data protection January 17, Tokyo iOS Meetup What is? - - PowerPoint PPT Presentation

ios security
SMART_READER_LITE
LIVE PREVIEW

iOS Security Data protection January 17, Tokyo iOS Meetup What is? - - PowerPoint PPT Presentation

iOS Security Data protection January 17, Tokyo iOS Meetup What is? It is a feature to protect data at rest and to make offline attacks difficult. iOS 4 DATA PROTECTION 101


slide-1
SLIDE 1

iOS Security

Data protection

January 17, Tokyo iOS Meetup

slide-2
SLIDE 2

What is?

It is a feature to protect data “at rest” and to make offline attacks difficult.

iOS 4 DATA PROTECTION 101

https://media.blackhat.com/bh-us-11/Belenko/BH_US_11_Belenko_iOS_Forensics_WP.pdf

slide-3
SLIDE 3

Architecture

iOS Security October 2014

https://www.apple.com/privacy/docs/iOS_Security_Guide_Oct_2014.pdf

slide-4
SLIDE 4

Data Protection classes

slide-5
SLIDE 5

Data Protection classes

Class keys Are encryption keys used to encrypt files and keychains elements depending on their protection class.

Hacking and Securing iOS Applications Stealing Data, Hijacking Software, and How to Prevent It By Jonathan Zdziarski

slide-6
SLIDE 6

Data Protection classes

NSFileProtectionComplete

slide-7
SLIDE 7

Data Protection classes

NSFileProtectionComplete The class key is protected with a key derived from the user passcode and the device UID. Shortly after the device is locked, the decrypted class key is discarded, rendering all data in this class inaccessible until the device is unlocked.

slide-8
SLIDE 8

Data Protection classes

NSFileProtectionComplete The class key is protected with a key derived from the user passcode and the device UID. Shortly after the device is locked, the decrypted class key is discarded, rendering all data in this class inaccessible until the device is unlocked.

An AES 256-bit key fused into the application processor during manufacturing. Is unique to each device and is not recorded by Apple or any of its suppliers.

slide-9
SLIDE 9

Data Protection classes

NSFileProtectionCompleteUnlessOpen

slide-10
SLIDE 10

Data Protection classes

NSFileProtectionCompleteUnlessOpen The per-file key is accessible while it is open, as soon as the file is closed, the per-file key is discarded.

slide-11
SLIDE 11

Data Protection classes

NSFileProtectionCompleteUnlessOpen The per-file key is accessible while it is open, as soon as the file is closed, the per-file key is discarded. Used to write files while the device is locked, e.g., downloading a file in the background.

slide-12
SLIDE 12

Data Protection classes

NSFileProtectionCompleteUnlessOpen The per-file key is accessible while it is open, as soon as the file is closed, the per-file key is discarded. Used to write files while the device is locked, e.g., downloading a file in the background. Uses ECDH.

slide-13
SLIDE 13

Data Protection classes

NSFileProtectionCompleteUnlessOpen The per-file key is accessible while it is open, as soon as the file is closed, the per-file key is discarded. Used to write files while the device is locked, e.g., downloading a file in the background. Uses ECDH.

Why?

slide-14
SLIDE 14

Data Protection classes

NSFileProtectionCompleteUnlessOpen The per-file key is accessible while it is open, as soon as the file is closed, the per-file key is discarded. Used to write files while the device is locked, e.g., downloading a file in the background. Uses ECDH.

Why? Higher security (more security per bit) Less resources

slide-15
SLIDE 15

Data Protection classes

NSFileProtectionCompleteUntilFirstUserAuthentication

slide-16
SLIDE 16

Data Protection classes

NSFileProtectionCompleteUntilFirstUserAuthentication Same as NSFileProtectionComplete but the key remains in memory after the device has been locked.

slide-17
SLIDE 17

Data Protection classes

NSFileProtectionNone The class key is protected only with the UID.

slide-18
SLIDE 18

How it works?

slide-19
SLIDE 19

How it works?

  • Hierarchy of cryptographic keys
slide-20
SLIDE 20

How it works? - Why a hierarchy?

slide-21
SLIDE 21

How it works? - Why a hierarchy?

Flexibility and performance

slide-22
SLIDE 22

How it works? - Why a hierarchy?

Flexibility and performance

  • Changing the passcode just rewraps the classes keys
slide-23
SLIDE 23

How it works? - Why a hierarchy?

Flexibility and performance

  • Changing the passcode just rewraps the classes keys
  • Wiping the device is just deleting the system key
slide-24
SLIDE 24

How it works? - Why a hierarchy?

slide-25
SLIDE 25

How it works?

  • Hierarchy of cryptographic keys
  • File system support
slide-26
SLIDE 26

How it works?

  • Hierarchy of cryptographic keys
  • File system support
  • AES engine (hardware)
slide-27
SLIDE 27

How it works? - Creating a file

encrypt (file, perFileKey)

AES engine

File File

encrypted

perFilekey

slide-28
SLIDE 28

How it works? - Creating a file

encrypt (file, perFileKey)

AES engine

File File

encrypted

Class key

slide-29
SLIDE 29

How it works? - Creating a file

encrypt (file, perFileKey)

AES engine

File File

encrypted

Metadata Class key

slide-30
SLIDE 30

How it works? - Creating a file

encrypt (file, perFileKey)

AES engine

File File

encrypted

File

encrypted

Metadata Class key

slide-31
SLIDE 31

How it works? - Reading a file

File

encrypted

Metadata

Class key

slide-32
SLIDE 32

How it works? - Reading a file

File

encrypted

Metadata

Class key

System key

slide-33
SLIDE 33

How it works? - Reading a file

File

encrypted

Metadata

Class key

System key Metadata Class key

slide-34
SLIDE 34

How it works? - Reading a file

File

encrypted

Metadata

Class key

System key Metadata Class key decrypt (file, perFileKey)

AES engine

slide-35
SLIDE 35

How it works? - Reading a file

File

encrypted

Metadata

Class key

System key Metadata Class key decrypt (file, perFileKey)

AES engine

File

slide-36
SLIDE 36

Keychain and Data Protection

slide-37
SLIDE 37

Keychain and Data Protection

The keychain is implemented as a SQLite database stored on the file system.

slide-38
SLIDE 38

Keychain and Data Protection

The keychain is implemented as a SQLite database stored on the file system. There is only one database; the security daemon determines which keychain items each process or app can access.

slide-39
SLIDE 39

Keychain and Data Protection

slide-40
SLIDE 40

Keychain and Data Protection

The default is kSecAttrAccessibleAfterFirstUnlock .

slide-41
SLIDE 41

Keychain and Data Protection

The default is kSecAttrAccessibleAfterFirstUnlock . I recommend using kSecAttrAccessibleWhenUnlocked as default and

  • nly if necessary changing it for individual keys that are

need in the background.

slide-42
SLIDE 42

Keychain and Data Protection

NSMutableDictionary *attributes = [[NSMutableDictionary alloc] init]; //... [attributes setObject:(__bridge id)kSecAttrAccessibleWhenUnlocked forKey:(__bridge id)kSecAttrAccessible];

slide-43
SLIDE 43

What if data protection is not used?

Install the Gmail app.

slide-44
SLIDE 44

What if data protection is not used?

Install the Gmail app. Read some emails.

slide-45
SLIDE 45

What if data protection is not used?

Install the Gmail app. Read some emails. Lock the device (non-jailbroken).

slide-46
SLIDE 46

What if data protection is not used?

Install the Gmail app. Read some emails. Lock the device (non-jailbroken). Browse the device (iFunBox, Xcode).

slide-47
SLIDE 47

What if data protection is not used?

slide-48
SLIDE 48

How to enable Data Protection in our apps?

slide-49
SLIDE 49

How to enable Data Protection in our apps?

S i m p l e !

slide-50
SLIDE 50

How to enable Data Protection in our apps? - Xcode

slide-51
SLIDE 51

How to enable Data Protection in our apps?

project.pbxproj 9C201A441827FB6F60CC6872 = { DevelopmentTeam = 9XFDAR3CTM; SystemCapabilities = { com.apple.DataProtection = { enabled = 1; }; }; };

slide-52
SLIDE 52

How to enable Data Protection in our apps? - App ID

slide-53
SLIDE 53

Sum up

slide-54
SLIDE 54

Sum up

  • What is data protection
slide-55
SLIDE 55

Sum up

  • What is data protection
  • How it works
slide-56
SLIDE 56

Sum up

  • What is data protection
  • How it works
  • What is the keychain?
slide-57
SLIDE 57

Sum up

  • What is data protection
  • How it works
  • What is the keychain?
  • What if data protection is not used?
slide-58
SLIDE 58

Sum up

  • What is data protection
  • How it works
  • What is the keychain?
  • What if data protection is not used?
  • How to enable it in our apps
slide-59
SLIDE 59

Q&A, Discussion

slide-60
SLIDE 60

Further reading

  • iOS Security https://www.apple.com/privacy/docs/iOS_Security_Guide_Oct_2014.pdf
  • iOS 4 DATA PROTECTION 101 https://media.blackhat.com/bh-us-11/Belenko/BH_US_11_Belenko_iOS_Forensics_WP.pdf
  • Hacking and Securing iOS Applications Stealing Data, Hijacking Software,

and How to Prevent it http://www.amazon.co.jp/Hacking-Securing-iOS-Applications-Hijacking/dp/1449318746/ref=sr_1_1?

ie=UTF8&qid=1420987300&sr=8-1&tag=tabisty-22&keywords=Hacking+and+Securing+iOS+Applications+Stealing+Data%2C+Hijacking+Software% 2C+and+How+to+Prevent+It

  • Diffie-Hellman key exchange http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange
  • A (Relatively Easy To Understand) Primer on Elliptic Curve Cryptography

http://blog.cloudflare.com/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/