I am looking for the best way to protect sensitive data in Android devices, e.g. secret or private keys, and found Android Keystore System. Based on the documentation, key material may be bound to secure hardware (e.g., Trusted Execution Environment (TEE), Secure Element (SE)) of Android device. It implies that not all of the Android devices support this. Some articles named this method as hardware-backed storage. If the device does not support secure hardware, it is stored in internal storage, some articles named this as software-backed storage.

Based on this article, software-backed store is placed in /data/misc/keystore/user_0 which means it is exposed in rooted devices. Is there any PoC that this is not secure for rooted device? Specifically, how to extract secrets in these software-backed secure storage?

  • 7
    Any software based solution is going to be vulnerable to a rooted device - by definition, the root user can read anything on the main storage area. Hardware based storage avoids this by only allowing access to data in it through specific methods - the root user can't make a request to get the raw data for offline decryption since there isn't a method to do that. If the key to access this area is stored in main storage, the root user could access that, then use the specific methods provided by the hardware store though - one reason hardware store is sometimes blocked on rooted devices.
    – Matthew
    Jun 1, 2016 at 8:45
  • 7
    What's the purpose of the above comment?
    – Krypton
    Sep 14, 2017 at 4:06
  • I think what @fikr4n is asking is if there are any known vulnerabilities that allow extracting information from the Android Keystore System, this article explains the whole thing labs.f-secure.com/blog/…
    – Purefan
    Jul 17, 2020 at 9:07

1 Answer 1


Strong box, hardware backed keystore and software backed keystore cannot protect sensitive data from getting compromised by root user. Keystore saves cryptographic blobs of apps for encryption, signing, attestation and authentication. Any app with root privileges can impersonate other apps and have their sensitive data decrypted or signed by the keystore by issuing a legitimate request on behalf of other apps and system.

It doesn't matter how sensitive data is secured, it has to be loaded in memory in order to be used by the app. A code injection by root user can dump anything in memory which is supposed to be secured. What hardware backed keystore and strong box can do is to securely verify device integrity such as whether chain of trust is custom, whether bootloader is unlocked, hash of OEM public key, hash of /vbmeta image, etc. Then they can certify this information using their private key and send it to the web service. Root cannot tamper with TEE signed data without knowing its private key or without Google certified public key.

If the device integrity is broken, web service can refuse service to the client. Software backed keystore cannot verify device integrity as its private key is not secured in tamper-resistant isolated storage. Software backed keystore keys can be found in /data/misc/keystore/user_0/. The keys are encrypted with the screen lock pin/pattern/password but if you remove this lock the keys are decrypted. Software backed keystore is deprecated from android 7+.

Not the answer you're looking for? Browse other questions tagged or ask your own question.