ios security
play

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


  1. iOS Security Data protection January 17, Tokyo iOS Meetup

  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

  3. Architecture iOS Security October 2014 https://www.apple.com/privacy/docs/iOS_Security_Guide_Oct_2014.pdf

  4. Data Protection classes

  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

  6. Data Protection classes NSFileProtectionComplete

  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.

  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.

  9. Data Protection classes NSFileProtectionCompleteUnlessOpen

  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.

  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.

  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.

  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. Why? Uses ECDH.

  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. Why? Higher security ( more security per bit ) Uses ECDH. Less resources

  15. Data Protection classes NSFileProtectionCompleteUntilFirstUserAuthentication

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

  17. Data Protection classes NSFileProtectionNone The class key is protected only with the UID.

  18. How it works?

  19. How it works? ● Hierarchy of cryptographic keys

  20. How it works? - Why a hierarchy?

  21. How it works? - Why a hierarchy? Flexibility and performance

  22. How it works? - Why a hierarchy? Flexibility and performance ● Changing the passcode just rewraps the classes keys

  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

  24. How it works? - Why a hierarchy?

  25. How it works? ● Hierarchy of cryptographic keys ● File system support

  26. How it works? ● Hierarchy of cryptographic keys ● File system support ● AES engine (hardware)

  27. How it works? - Creating a file File encrypt (file, perFileKey) AES engine perFilekey File encrypted

  28. How it works? - Creating a file File encrypt (file, perFileKey) Class key AES engine File encrypted

  29. How it works? - Creating a file File Metadata encrypt (file, perFileKey) Class key AES engine File encrypted

  30. How it works? - Creating a file File File encrypted Metadata encrypt (file, perFileKey) Class key AES engine File encrypted

  31. How it works? - Reading a file File encrypted Metadata Class key

  32. How it works? - Reading a file File encrypted Metadata Class key System key

  33. How it works? - Reading a file File encrypted Metadata Metadata Class key Class key System key

  34. How it works? - Reading a file File encrypted Metadata decrypt (file, perFileKey) Metadata AES engine Class key Class key System key

  35. How it works? - Reading a file File encrypted Metadata decrypt (file, perFileKey) Metadata AES engine Class key Class key System key File

  36. Keychain and Data Protection

  37. Keychain and Data Protection The keychain is implemented as a SQLite database stored on the file system.

  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.

  39. Keychain and Data Protection

  40. Keychain and Data Protection The default is kSecAttrAccessibleAfterFirstUnlock .

  41. Keychain and Data Protection The default is kSecAttrAccessibleAfterFirstUnlock . I recommend using kSecAttrAccessibleWhenUnlocked as default and only if necessary changing it for individual keys that are need in the background.

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

  43. What if data protection is not used? Install the Gmail app.

  44. What if data protection is not used? Install the Gmail app. Read some emails.

  45. What if data protection is not used? Install the Gmail app. Read some emails. Lock the device (non-jailbroken) .

  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).

  47. What if data protection is not used?

  48. How to enable Data Protection in our apps?

  49. How to enable Data Protection in our apps? S i m p l e !

  50. How to enable Data Protection in our apps? - Xcode

  51. How to enable Data Protection in our apps? project.pbxproj 9C201A441827FB6F60CC6872 = { DevelopmentTeam = 9XFDAR3CTM; SystemCapabilities = { com.apple.DataProtection = { enabled = 1; }; }; };

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

  53. Sum up

  54. Sum up ● What is data protection

  55. Sum up ● What is data protection ● How it works

  56. Sum up ● What is data protection ● How it works ● What is the keychain?

  57. Sum up ● What is data protection ● How it works ● What is the keychain? ● What if data protection is not used?

  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

  59. Q&A, Discussion

  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/

Recommend


More recommend