Access Control (DAC) for application sandboxing (UID,GID) • Provides Mandatory Access Control (MAC) over all processes at kernel level • Allows to define fine-grained security policies • Main security features: ◦ Better system service restriction and protection ◦ Improved access control to application data and system logs ◦ Reduce effects of malicious software ◦ User protection from potential flaws in mobile application SELinux DroidCon IT 2015 - Android Lollipop For Enterprise 7 Security-Enhanced Linux in Android "This new layer provides additional protection against potential security vulnerabilities by reducing exposure of system functionality to applications" Google Report Android Security 2014 Year in Review
actions on objects (processes or groups of processes referred as domains) ◦ Action: The operation to perform ◦ Object: OS-level resources managed by the kernel (file, socket) • Processes, Sockets and Files have a label or security context: ◦ username:role:type:mls_level ▪ username is always u ▪ role is r for domains, object_r for objects ▪ type refers to the domain or to the object logic type ▪ mls_level is always s0 DroidCon IT 2015 - Android Lollipop For Enterprise 8 Concepts
r for domains, object_r for objects ◦ type refers to the domain or to the object logical type ◦ mls_level is always s0 DroidCon IT 2015 - Android Lollipop For Enterprise 9 Concepts SUBJECT OBJECT
are logged but not enforced ◦ Enforcing: permission denials are both logged and enforced DroidCon IT 2015 - Android Lollipop For Enterprise 10 Android 4.3 Permissive Android 4.4 Partial Enforcing Android 5.x Full Enforcing ... limited set of crucial domains (installd, netd, vold and zygote)... ...to everything (more than 60 domains)...
Based on Trust Agent: ◦ "A service that notifies the system about whether it believes the environment of the device to be trusted" ◦ Requires signatureOrSystem permission ◦ Can be disabled by Device Administrator [KEYGUARD_DISABLE_TRUST_AGENTS] DroidCon IT 2015 - Android Lollipop For Enterprise 12 Trust Agent http://nelenkov. blogspot. it/2014/12/dissecting -lollipops-smart- lock.html lollipop/frameworks/base/core/res/AndroidManifest.xml
• Device Unlocked methods: ◦ Trusted bluetooth connected devices ◦ Trusted places ◦ Trusted face ◦ On Body Detection • Temporary unlock is disabled: ◦ After 4 hours of inactivity ◦ Device Reboot/Shutdown DroidCon IT 2015 - Android Lollipop For Enterprise 13 Some Details
prevent other people from using it if it's been reset to factory settings without your permission" • Introduced in Android 5.1 • Actually works only on Nexus 6 and Nexus 9 • Requires: ◦ Screen Lock enabled ◦ Default Google account ◦ "OEM Unlocking" disabled in Settings -> Developer Options • Needs to wait 72 hours after changing password to reset the device DroidCon IT 2015 - Android Lollipop For Enterprise 15 "Kill Switch" Factory Reset
device security settings • Cannot be uninstalled if active • Could be controlled by a remote server (agent) • Several device admin applications can be enabled on a device (strictest policy among all applications is active) DroidCon IT 2015 - Android Lollipop For Enterprise 19 Device Admin Application
Enterprise 20 Main Features API 8 API 9 API 11 API 14 API 17 API 21 API 22 Enforce Password Policy Watch User Login Reset Password Lock and Wipe Device Set Max Failed Password For Wipe Set Max Time To Lock Device Wipe SDCard Force Device Encryption Disable Camera Disable Keyguard Managed Profile Global Settings NFC Provisioning Wipe Factory Protection
2015 - Android Lollipop For Enterprise 22 DeviceAdminReceiver Required to ensure that only the system can interact with the receiver Primary ACTION that the receiver must handle Policy Declaration
the additional ability to: ◦ Add/Remove User ◦ Modify Global settings ◦ Set Application Restrictions ◦ Wipe Factory Protection • Typically used for company device • Introduced in Android Lollipop (API 21) • Only one device owner can be active at a time • Cannot be disabled or removed • Requires Device Encryption • Deployed and activated via NFC DroidCon IT 2015 - Android Lollipop For Enterprise 27 Device Owner
Type MIME_TYPE_PROVISIONING_NFC and with properties: DroidCon IT 2015 - Android Lollipop For Enterprise 28 Device Owner Deploy REQUIRED CHECKSUM A String extra holding the SHA-1 checksum of the file at download location specified in EXTRA_PROVISIONING_DEVICE_ADMIN_PA CKAGE_DOWNLOAD_LOCATION. If this doesn't match the file at the download location an error will be shown to the user and the user will be asked to factory reset the device. cat app-debug.apk | openssl dgst -binary -sha1 | openssl base64 | tr '+/' '-_' | tr -d '='
• Available since Android Lollipop (API 21) • Using managed profile the enterprise could define a controlled domain on the user's device to run controlled application • The application inside the new managed profile can be configured with policy to interact or not with other apps on device • Samsung KNOX functionality has been integrated into Android DroidCon IT 2015 - Android Lollipop For Enterprise 31 Introduction
and ◦ Personal Privacy • Google and Samsung has designed the new Enterprise API around three major concepts: ◦ Device and data security ◦ Support for IT policies and restrictions ◦ Mobile application management • It has been introduced into Android Lollipop DroidCon IT 2015 - Android Lollipop For Enterprise 32 KNOX Framework
receiver that extends “DeviceAdminReceiver” • AndroidManifest with a receiver: ◦ The BIND_DEVICE_ADMIN permission ◦ Respond, by intent-filetr, to the ACTION_DEVICE_ADMIN_ENABLED intent ◦ A declaration of security policies used in metadata • An intent to start the managed profile provisioning process: ◦ ACTION_PROVISION_MANAGED_PROFILE action ◦ An extra with the application package • Override onProfileProvisioningComplete callback method to verify all is OK • Enable the new managed profile DroidCon IT 2015 - Android Lollipop For Enterprise 33 Have to use...
Lollipop For Enterprise 34 Broadcast Receiver BroadcastReceiver of our provisioner application Callback method will be called when the system send ACTION_DEVICE_ADMI N_ENABLED. The new profile is installed but not yet enabled
Lollipop For Enterprise 35 AndroidManifest To avoid abuse by other applications Intercepted when the Managed Profile has successfully installed Policy declaration
36 Activation Intent to start the setup (Defined in the DevicePolicyManager.java) • Start the Managed Profile provisioning The Application package name as additional information Verify there is an activity that resolves intent (ManagedProvisonActivity) Start activity by intent
38 Managed profile activated • New Accounts associated to the new managed profile (Settings->Accounts) • The admin profile (Work) for the new Managed Profile (Settings->Security- >Device administrators) • The applications into new Managed Profile are badged
40 Enable Application • Add new application into Managed Profile Add the application by package name via DevicePolicyManager Get info about app Get reference at packageManager and DevicePolicyManager
41 Hide Application • During the life of Managed Profile the application could be hidden specyfing the app package name ◦ Only if the application is already installed we can hide application true to hide and false to un-hide
account and managed profile DroidCon IT 2015 - Android Lollipop For Enterprise 42 Cross Intent Enable with and disable intent between profiles Share some content
and declare it into Manifest file DroidCon IT 2015 - Android Lollipop For Enterprise 45 Define App Restrictions • Defines the restriction item into app_restriction.xml file Declare external resource for restrictions restriction element with key and type of value
- Android Lollipop For Enterprise 46 Check app restrictions get current restrictions get reference to RestrictionManager search restriction by key to take the appropriate action
2015 - Android Lollipop For Enterprise 47 Set app restrictions Builds a bundle with value for restriction Apply application restriction with method setApplicationRestrictions
data on an Android device using an encrypted key • New feature on Android 5.0: ◦ Fast encryption (only used blocks are encrypted on data partition) ◦ forceencrypt flag to encrypt on first boot (Mandatory encryption at first boot) ◦ Support for encryption without password ◦ Hardware-backed storage of encryption key using Trusted Execution Environment • Android introduced Disk encryption in Android version 3.0 and it has been available in all subsequent versions • New key derivation function scrypt DroidCon IT 2015 - Android Lollipop For Enterprise 49 Some info
(also used in Linux) • Use a randomly 128-bit key with AES in CBC mode ◦ CBC requires an inizialization vector IV ◦ Android uses the encrypted salt-sector initialization vector (ESSIV) method with the SHA-256 hash algorithm (ESSIV: SHA256) ◦ SHA256 is used to derive a key s from disk encryption key K called salt ◦ Use the salt as encryption key to encrypt sector number SN of each sector to produce a per-sector IV ◦ IV(SN)=AES-s(SN) where s=SHA256(K) DroidCon IT 2015 - Android Lollipop For Enterprise 50 How works
AES • In Android 5.0 release, four encryption states: ◦ default,PIN,Password,Pattern • Upon first boot the device creates a randomly generated 128-bit master key and then hashes it with a default password and stored salt (default_password) • The hash is signed through a TEE, that uses hash to encrypt the master key • When the user sets the PIN/pass or password on the device, only the 128-bit key is re-encrypted and stored DroidCon IT 2015 - Android Lollipop For Enterprise 51 How works