Description
Dynamic analysis needed for droids3.apk. Use Frida to instrument the app at runtime.
Setup
Download the APK and set up an Android emulator with Frida.
wget <url>/droids3.apkpip3 install frida-toolsSolution
Walk me through it- Step 1Decompile and identify the target methodDecompile with jadx. Find the password check method in MainActivity. Note the class name and method name - you will hook this with Frida to intercept the expected password.bash
jadx droids3.apk -d droids3_java/bashcat droids3_java/sources/com/example/droids3/MainActivity.javaLearn more
Frida is a dynamic instrumentation toolkit that lets you inject JavaScript into running Android (and iOS, Linux, Windows) processes. You can hook Java methods, read their arguments and return values, and even replace their implementation.
- Step 2Set up Frida on the Android emulatorStart an Android emulator (e.g., from Android Studio AVD), push frida-server to it, and run it. Then install the APK.bash
# Download frida-server for Android x86bashadb push frida-server /data/local/tmp/bashadb shell chmod 755 /data/local/tmp/frida-serverbashadb shell /data/local/tmp/frida-server &bashadb install droids3.apkLearn more
frida-server runs on the Android device and exposes a Frida RPC interface. The frida Python tools on your desktop communicate with it over ADB to inject scripts into target processes.
- Step 3Write and run a Frida hook scriptWrite a Frida script to hook the password check method. When the method is called, print both the user-supplied input and the expected password argument.js
cat << 'EOF' > hook.js Java.perform(function() { var MainActivity = Java.use('com.example.droids3.MainActivity'); MainActivity.check.implementation = function(input) { console.log('[*] check() called with: ' + input); var result = this.check(input); console.log('[*] Result: ' + result); return result; }; }); EOF frida -U -f com.example.droids3 -l hook.js --no-pauseLearn more
Frida's Java API lets you intercept any Java method by class name and method name. The
implementationproperty replaces the method body. Callingthis.method(args)inside the replacement invokes the original method.You can also force the check to return true by replacing the implementation with
return true;, bypassing the password validation entirely.
Flag
picoCTF{...}
Use Frida to hook the password check method at runtime - log or bypass the check to retrieve the flag.