You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Biometric authentication, such as fingerprint recognition, can be used alongside cryptographic keys stored in the Android <code>KeyStore</code> to protect sensitive parts of the application. However,
9
+
when a key generated for this purpose has certain parameters set insecurely, an attacker with physical access can bypass the
10
+
authentication check using application hooking tools such as Frida.
11
+
</p>
12
+
</overview>
13
+
14
+
<recommendation>
15
+
<p>
16
+
When generating a key for use with biometric authentication, ensure that the following parameters of <code>KeyGenParameterSpec.Builder</code> are set:
17
+
</p>
18
+
<ul>
19
+
<li><code>setUserAuthenticationRequired</code> should be set to <code>true</code>; otherwise, the key can be used without user authentication.</li>
20
+
<li><code>setInvalidatedByBiometricEnrollment</code> should be set to <code>true</code> (the default); otherwise, an attacker can use the key by enrolling additional biometrics on the device.</li>
21
+
<li><code>setUserAuthenticationValidityDurationSeconds</code>, if used, should be set to <code>-1</code>; otherwise, non-biometric (less secure) credentials can be used to access the key. We recommend using <code>setUserAuthenticationParameters</code> instead to explicitly set both the timeout and the types of credentials that may be used.</li>
22
+
</ul>
23
+
24
+
</recommendation>
25
+
26
+
<example>
27
+
<p>The following example demonstrates a key that is configured with secure paramaters:</p>
28
+
<samplesrc="AndroidInsecureKeysGood.java"/>
29
+
30
+
<p>In each of the following cases, a parameter is set insecurely:</p>
31
+
<samplesrc="AndroidInsecureKeysBad.java"/>
32
+
</example>
33
+
34
+
<references>
35
+
<li>
36
+
WithSecure: <ahref="https://labs.withsecure.com/publications/how-secure-is-your-android-keystore-authentication">How Secure is your Android Keystore Authentication?</a>.
* @name Insecurely generated keys for local authentication
3
+
* @description Generation of keys with insecure parameters for local biometric authentication can allow attackers with physical access to bypass authentication checks.
0 commit comments