Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android N Security Overview - Mobile Security S...

Royce Mars
January 07, 2017

Android N Security Overview - Mobile Security Saturday at Ciklum

Royce Mars

January 07, 2017
Tweet

More Decks by Royce Mars

Other Decks in Programming

Transcript

  1. Android N Security Overview Constantine Mars, Sr. Android Developer @

    DataArt, GDG Dnipro Co-Organizer +ConstantineMars @ConstantineMars
  2. UX Guidelines for Permissions (M) • Educate in context for

    secondary • Educate up-front for critical • Receive “yes” in 85% • 15.8% “no” • 3% “never ask again”
  3. Android Keystore lets you store cryptographic keys in a container

    to make it more difficult to extract from the device. Once keys are in the keystore, they can be used for cryptographic operations with the key material remaining non-exportable. The Keystore system is used by the KeyChain API as well as the Android Keystore provider feature that was introduced in Android 4.3 (API level 18).
  4. Android Keystore Key material may be bound to the secure

    hardware (e.g., Trusted Execution Environment (TEE), Secure Element (SE)) of the Android device Supporting wide range of algorithms
  5. Key Attestation (N) Key Attestation gives you more confidence that

    the keys you use in your app are stored in a device's hardware-backed keystore. Key attestation allows you to verify that an RSA or EC key pair has been created and stored in a device’s hardware-backed keystore within the device’s trusted execution environment (TEE).
  6. Best practices • Check KeyguardManager.isDeviceSecure() to identify that device has

    lockscreen or password protection. • Use setUserAuthenticationValidityDurationSeconds during the key generation to set the duration for which authentication is valid:
  7. Best practices If no Fingerprint available - fall back to

    Gatekeeper and KeyguardManager.createConfirmDeviceCredentialIntent:
  8. Debug-overrides • Eliminate debugging-related code in your release build •

    Avoid writing custom code that removes security for debug and shipping it When debugging an app that connects over HTTPS you may want to connect to a local development server, which does not have the SSL certificate for your production server. In order to support this without any modification to your app's code you can specify debug-only CAs that are only trusted when android:debuggable is true by using debug-overrides.
  9. Storage Encryption • Encryption required for all capable devices (M)

    • Backed by hardware and TrustZone (N) • Better UX with DirectBoot (N)
  10. Direct Boot • Boot directly to the lock screen •

    Calls, SMS, TalkBack, alarms work after device reboot before unlock • Per-user disk encryption
  11. DirectBoot • Credential encrypted storage, which is the default storage

    location and only available after the user has unlocked the device. • Device encrypted storage, which is a storage location available both during Direct Boot mode and after the user has unlocked the device.
  12. Verified Boot Verified boot guarantees the integrity of the device

    software starting from a hardware root of trust up to the system partition. During boot, each stage verifies the integrity and authenticity of the next stage before executing it. This capability can be used to warn users of unexpected changes to the software when they acquire a used device, for example.
  13. SafetyNet A SafetyNet compatibility check allows your app to check

    if the device where it is running matches the profile of a device that has passed Android compatibility testing. The compatibility check creates a device profile by gathering information about the device hardware and software characteristics, including the platform build.
  14. Sandboxing • SELinux • Seccomp (N) • Mediaserver hardening •

    ASLR randomness • Library load order randomization • Integrity monitoring
  15. What’s outside N security topic? • Security Assesment Tools (Santoku,

    drozer, etc.) • Eternal secrets of ADB and Manifest, Logs, etc. • Exploits: sniffing network traffic, attacking services, providers • SQL-injections • Man-in-the-middle attacks • Custom permissions protection • ProGuard and DexGuard • Reverse Engineering, DEX, GDB • Cross-compiling native executables • Securing SharedPreferences • SQLCipher • etc...
  16. Links • Adrian Ludwig talk on Google I/O 2016 https://youtu.be/XZzLjllizYs?list=PLOU2XLYxmsILe6_eGvDN3GyiodoV3qNSC

    • FingerprintDialog sample https://github.com/googlesamples/android-FingerprintDialog • Authentication samples for M http://android-developers.blogspot.com/2015/10/new-in-android-samples-authenticating.html • Android Security Essentials by Pagati Ogal Rai https://www.packtpub.com/application-development/android-application-security-essentials • Google Security Blog https://security.googleblog.com/ • Android Security Bulletins https://source.android.com/security/bulletin/ • Annual Security Review https://goo.gl/VpYom1
  17. Thank you :) Constantine Mars, Sr. Android Developer @ DataArt,

    GDG Dnipro Co-Organizer +ConstantineMars @ConstantineMars