This script disables SSL certificate validation in a Flutter application by modifying the APK file and injecting a Frida hook. This can be useful for testing purposes where you need to bypass SSL pinning.
apktool: Tool to decompile and recompile APK files.strings: Command to extract printable strings from a binary.objdump: Command to display information from object files.adb: Android Debug Bridge, a versatile command-line tool for interacting with Android devices.frida: Dynamic instrumentation toolkit for developers, reverse-engineers, and security researchers.
APK_PATH: Path to the APK file to be decompiled and modified.APKTOOL_PATH: Path to theapktoolJAR file.APP_PACKAGE_NAME: Package name of the application to be tested.
./flutter_ssl_pinning_bypass.sh /path/to/app.apk /path/to/apktool.jar com.example.app-
Setup and Variables:
- The script sets the options
-e(exit on error) and-x(print commands). - Variables are initialized for paths and filenames.
- The script sets the options
-
Decompile the APK:
- Uses
apktoolto decompile the APK to a temporary directory.
- Uses
-
Find SSL Client and Server Addresses:
- Extracts SSL client and server addresses from the
libflutter.sofile usingstrings.
- Extracts SSL client and server addresses from the
-
Disassemble the Shared Library:
- Disassembles the
libflutter.sofile to a text file.
- Disassembles the
-
Calculate SSL Function Offset:
- Extracts the offset of the SSL function start address and converts it to a hexadecimal format.
- Calculates the offset between the SSL function and the
JNI_OnLoadfunction.
-
Generate Frida Script:
- Creates a Frida script (
script.js) to hook and disable SSL certificate validation.
- Creates a Frida script (
-
Download and Setup Frida Server:
- Downloads the Frida server for Android and sets it up on the device.
-
Run Frida with the Script:
- Uses Frida to inject the script into the specified application.
- Ensure your Android device is connected and ADB is set up properly.
- Running this script requires root access on the Android device.
- This script is intended for testing and educational purposes only. Use responsibly.