Search K
Appearance
Appearance
The focus here is on the onAuthenticationSucceeded callback, which is crucial in the authentication process. Researchers at WithSecure developed a Frida script, enabling the bypass of the NULL CryptoObject in onAuthenticationSucceeded(...). The script forces an automatic bypass of the fingerprint authentication upon the method's invocation. Below is a simplified snippet demonstrating the bypass in an Android Fingerprint context, with the full application available on GitHub.
biometricPrompt = new BiometricPrompt(this, executor, new BiometricPrompt.AuthenticationCallback() {
@Override
public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) {
Toast.makeText(MainActivity.this,"Success",Toast.LENGTH_LONG).show();
}
});
Command to run the Frida script:
frida -U -f com.generic.insecurebankingfingerprint --no-pause -l fingerprint-bypass.js
Another Frida script by WithSecure addresses bypassing insecure crypto object usage. The script invokes onAuthenticationSucceeded with a CryptoObject that hasn't been authorized by a fingerprint. If the application tries to use a different cipher object, it will trigger an exception. The script prepares to invoke onAuthenticationSucceeded and handle the javax.crypto.IllegalBlockSizeException in the Cipher class, ensuring subsequent objects used by the application are encrypted with the new key.
Command to run the Frida script:
frida -U -f com.generic.insecurebankingfingerprint --no-pause -l fingerprint-bypass-via-exception-handling.js
Upon reaching the fingerprint screen and the initiation of authenticate()
, type `bypass()`` in the Frida console to activate the bypass:
Spawning com.generic.insecurebankingfingerprint...
[Android Emulator 5554::com.generic.insecurebankingfingerprint]-> Hooking BiometricPrompt.authenticate()...
Hooking BiometricPrompt.authenticate2()...
Hooking FingerprintManager.authenticate()...
[Android Emulator 5554::com.generic.insecurebankingfingerprint]-> bypass()
Instrumentation frameworks like Xposed or Frida can be used to hook into application methods at runtime. For fingerprint authentication, these frameworks can:
onAuthenticationSucceeded
, onAuthenticationFailed
, or onAuthenticationError
methods of the BiometricPrompt.AuthenticationCallback
, you can control the outcome of the fingerprint authentication process.Example command for Frida:
frida -U -l script-to-bypass-authentication.js --no-pause -f com.generic.in
Reverse engineering tools like APKTool
, dex2jar
, and JD-GUI
can be used to decompile an Android application, read its source code, and understand its authentication mechanism. The steps generally include:
There are specialized tools and scripts designed to test and bypass authentication mechanisms. For instance: