2

I have done an Android Application using an ECC Key pair. When I have developed it last year, I wanted to create the ECC key in the Android Keystore. Unfortunately, this ECC key is used to generate a session key thanks to ECDH, and ECDH is not supported by Android Keystore (this is what I have been said here: ECDH with key in Android Key Store )

I have followed the recommendations: I have created an AES key in the Android KeyStore and I have used it to encrypt the ECC key before storing it in the SharedPreferences. Android KeyStore ensures that the AES key cannot be extracted and that only my application can use it to decrypt the ECC key.

I now have a concern for which I would like your advices:

What if someone install my application on a rooted phone, gets the APK, uncompile and modify it to print the ECC key after that has been read and decrypted? I don’t have this skill but I guess that some hackers do. If that’s feasible, it means that the protection that I have used is not efficient.

Using ECDH is non-negotiable in my case so what solution do I have to secure my ECC key pair?

Thanks

OlivierGrenoble
  • 2,463
  • 2
  • 11
  • 24
  • In the first place you generated an ECC key pair (random, unique to every app installation), why do you now add a fixed key to your app instead of generating a new one (outside of the AndroidKeyStore) as you did before? – Robert Feb 20 '19 at 19:15
  • 1
    This is getting dangerously close to DRM territory. If you cannot control the hardware / runtime environment then, in the end, a hacker can do anything. I think your solution space could be empty. – Maarten Bodewes Feb 20 '19 at 22:49

1 Answers1

2

There is no way to ensure that the key is non-extractable unless it's backed by secure hardware.

And for the rooted phone case, attacker doesn't need to modify and reinstall your APK in order to use your key. Any app on that device with the root permission can hook into your app and behaves like it. Even in trusted environment they can use your hardware backed key. Only thing they can't do is, extracting the key from the device.

You may want to read the relatively old paper about TEE and AndroidKeyStore: http://www.cs.ru.nl/~joeri/papers/spsm14.pdf . Especially "Overview of the results for Device-binding"

In order to reduce attack surface, you can:

Tolga Okur
  • 5,293
  • 2
  • 17
  • 17