Keystore
Last updated
Last updated
Android keystore is a container within the android system to securely store cryptographic keys for any applications. These keys are used by applications for various encryption/decryption process within their application.
Keychain offers system-wide credentials and flexibility for user to select which key the application can use across different applications. Keystore only lets credentials be accessed within the application it has rights to. Having a secure container would help prevent key leaking to other similar privileged applications that may have malicious functions. User do not need to select credentials for applications that uses keystore.
System process takes in data from the application and make use of the stored key and given parameters to perform cryptographic operations. Furthermore, stored keys are bounded to Android or Secure Element (SE) which prevents key extraction even if device is compromise. However, it does not prevent usage of stored keys if application is compromised (e.g. Frida hooks)
Android 9 and above have that contains its own set of hardware modules and resources not used by standard Android OS and kernel. It offers mechanisms to prevent tampering of data within the keystore and secure storage to prevent unauthorised access. Unfortunately, not every android device supports StrongBox. List of supported devices:
Feature for applications to only authorise specific tasks to make use of the cryptographic keys. Temporal validity interval can be implemented to allow specified time range to use the cryptograhpic keys and/or user authentication via biometric or lock screen checks. Both features could still be bypassed with the combination of Frida hooking to reset the time as well as disabling user's lock screen credentials.
Android developer documentation states that keystore helps reduce risk of authorised use of cryptographic key outside and within the android device. As mentioned previously, the main issue is still security of android application.
This is a guide to monitor encryption process within the application:
Frida script to extract keystore via hooking of application:
A whole suite of documentation about Android Keystore Security, bypass and mitigations:
Could you explain the difference between android keystore and keychain?
What are the security features of using android keystore?
Are there any methods to bypass android keystore?
Furthermore, if the device is rooted, keystore is no longer secure and can be accessed with privileged rights:
🍞