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
All security-related issues, concerns, and problems must be reported via email to: security@capgo.app.
However I received the following response:
421 security@capgo.app is not yet configured with its email service provider
I look forward to hearing from you 🙂
Summary
The cap-go/capacitor-native-biometric library was found to be subject to an authentication bypass as the current implementation of the onAuthenticationSucceeded() does not appear to handle a CryptoObject12 as seen in the following code block starting from line 88 in AuthActivity.java:
As the current implementation only checks whether onAuthenticationSucceeded() was called and does not handle a CryptoObject the biometric authentication can be bypassed by hooking the onAuthenticationSucceeded() function.
PoC Video:
PoC.-.720p.mov
Environment:
The following steps were taken to create and deploy a Capacitor application using the cap-go/capacitor-native-biometric library for the purpose of verifying this finding. Note at the time of writing the npx create-react-app command broke, so I have provided two ways of creating and deploying the testing environment. Apparently React updated to version 19 caused a dependency issue as seen here. If it is not fixed by the time you look at this PoC please use the yarn alternatives.
Create a new Capacitor app by opening your terminal and run the following commands to create a new Capacitor app. For the sake of the disclosure I'll be using the name capgo-poc:
Implement Biometric Authentication, here is some basic code to use the biometric authentication feature. Modify the TSX file called App.tsx in src/ and import the following code:
importReact,{useState}from'react';import{NativeBiometric}from'@capgo/capacitor-native-biometric';constApp=()=>{// State to hold authentication statusconst[authStatus,setAuthStatus]=useState<string|null>(null);// Function to authenticate the userconstauthenticateUser=async()=>{try{constresult=awaitNativeBiometric.verifyIdentity({reason: 'For an application access',title: 'Log in',subtitle: '',description: 'Verify yourself by biometrics',useFallback: true,maxAttempts: 3,}).then(()=>true).catch(()=>false);if(!result){setAuthStatus('failed');}else{setAuthStatus('success');}}catch(error){console.error('Error during biometric verification:',error);setAuthStatus('error');}};return(<div><h1>CAP-GO Capacitor Native Biometric Authentication</h1><buttononClick={authenticateUser}>Authenticate with Biometrics</button>{/* Conditionally render based on authentication status */}{authStatus==='success'&&<h2>CAP-GO Capacitor Native Biometric Authentication Success</h2>}{authStatus==='failed'&&<h2>CAP-GO Capacitor Native Biometric Authentication Failed</h2>}{authStatus==='error'&&<h2>Error during authentication</h2>}</div>);};exportdefaultApp;
Build the React project, synchronise it with the Android platform, and open the native Android project in Android Studio by running the following commands:
npm run build
npx cap sync android
npx cap open android
Yarn alternative:
yarn build
npx cap sync android
npx cap open android
Exploitation:
For the purpose of demonstrating the vulnerability we will be using frida and a rooted emulator from android studio. Frida is a dynamic instrumentation toolkit used as part of pentesting mobile applications 3.
Note that a rooted emulator is not necessary, but is being used for simplicity to demonstrate the vulnerability.
Copy the below frida script to a JavaScript file and run it to hook the onAuthenticationSucceeded() function, abusing the null CryptoObject. This can be done by running the following command:
Intro:
Hi there, I wanted to disclose a potential issue with the cap-go/capacitor-native-biometric library. I attempted to email this issue inline with the security.md:
However I received the following response:
I look forward to hearing from you 🙂
Summary
The cap-go/capacitor-native-biometric library was found to be subject to an authentication bypass as the current implementation of the
onAuthenticationSucceeded()does not appear to handle aCryptoObject1 2 as seen in the following code block starting from line 88 in AuthActivity.java:As the current implementation only checks whether
onAuthenticationSucceeded()was called and does not handle aCryptoObjectthe biometric authentication can be bypassed by hooking theonAuthenticationSucceeded()function.PoC Video:
PoC.-.720p.mov
Environment:
The following steps were taken to create and deploy a Capacitor application using the
cap-go/capacitor-native-biometric libraryfor the purpose of verifying this finding. Note at the time of writing thenpx create-react-appcommand broke, so I have provided two ways of creating and deploying the testing environment. Apparently React updated to version 19 caused a dependency issue as seen here. If it is not fixed by the time you look at this PoC please use the yarn alternatives.capgo-poc:Yarn Alternative:
cd capgo-poc npm install @capacitor/core npm install @capacitor/cli npm install @capacitor/android npm install @capgo/capacitor-native-biometric npm install reactYarn Alternative:
cd capgo-poc yarn add @capacitor/core yarn add @capacitor/cli yarn add @capacitor/android yarn add @capgo/capacitor-native-biometric yarn add reactcapgo-pocandcom.capgo.poc, and add the android platform by running the following commands:android/app/src/main/AndroidManifest.xmlfile and add the necessary permissions:App.tsxinsrc/and import the following code:Yarn alternative:
Exploitation:
For the purpose of demonstrating the vulnerability we will be using frida and a rooted emulator from android studio. Frida is a dynamic instrumentation toolkit used as part of pentesting mobile applications 3.
Note that a rooted emulator is not necessary, but is being used for simplicity to demonstrate the vulnerability.
onAuthenticationSucceeded()function, abusing thenull CryptoObject. This can be done by running the following command:Payload
Footnotes
https://book.hacktricks.xyz/mobile-pentesting/android-app-pentesting/bypass-biometric-authentication-android#method-1-bypassing-with-no-crypto-object-usage ↩
https://www.kayssel.com/post/android-8/ ↩
https://frida.re/ ↩