Biometric authentication, such as fingerprint recognition, can be used alongside cryptographic keys stored in the Android KeyStore to protect sensitive parts of the application. However, when a key generated for this purpose has certain parameters set insecurely, an attacker with physical access can bypass the authentication check using application hooking tools such as Frida.

When generating a key for use with biometric authentication, ensure that the following parameters of KeyGenParameterSpec.Builder are set:

The following example demonstrates a key that is configured with secure paramaters:

In each of the following cases, a parameter is set insecurely:

  • WithSecure: How Secure is your Android Keystore Authentication?.
  • Android Developers: KeyGenParameterSpec.Builder.