This repository contains scripts and tools to bypass SSL pinning in Android applications. SSL pinning is a security mechanism used by apps to prevent man-in-the-middle (MitM) attacks by ensuring that the app communicates only with a server using a specific SSL certificate. However, during security testing or reverse engineering, it might be necessary to bypass SSL pinning to intercept and analyze network traffic.
- Introduction
- How SSL Pinning Works
- Bypass Techniques
- Requirements
- Setup and Usage
- Troubleshooting
- Contributing
- License
SSL pinning is a technique used by mobile apps to enhance security by ensuring they only accept a specific certificate or public key. However, during penetration testing, it is often necessary to bypass SSL pinning to inspect the network traffic between the app and the server. This repository provides methods and tools to bypass SSL pinning in Android applications, allowing testers to carry out a more thorough security assessment.
In SSL pinning, an app is configured to only accept connections to a server that provides a certificate matching a pinned certificate or public key embedded within the app. This prevents the app from being tricked into connecting to a malicious server, even if the attacker can present a valid SSL certificate issued by a trusted certificate authority (CA).
Frida is a dynamic instrumentation toolkit for developers, reverse-engineers, and security researchers. It allows you to inject JavaScript into native apps on Windows, macOS, Linux, iOS, Android, and QNX.
- Advantages: Does not require root access, versatile and can be used on-the-fly.
- Script Example: A Frida script can be used to bypass SSL pinning by hooking specific methods in the app that perform certificate validation.
The Xposed Framework allows you to modify the behavior of the system and apps without touching any APKs. It is useful for bypassing SSL pinning by modifying the way an app verifies certificates.
- Advantages: Powerful and persistent, works well for rooted devices.
- Module Example: There are several Xposed modules like "JustTrustMe" that can disable SSL pinning in many apps.
Another method to bypass SSL pinning is to install a custom certificate authority (CA) on the device and modify the app to accept this CA.
- Advantages: Simple and effective for certain types of apps, especially those that use standard HTTP libraries.
- Disadvantages: Requires root access, and may not work with apps that enforce strict pinning.
- Android device or emulator
- Frida
- Xposed Framework
- Root access (for Xposed or custom certificate methods)
- adb (Android Debug Bridge)
-
Install Frida:
- Install Frida on your computer and Android device. Follow the instructions on the Frida website.
-
Start Frida Server:
- Run the Frida server on your Android device:
adb push frida-server /data/local/tmp/ adb shell "chmod 755 /data/local/tmp/frida-server" adb shell "/data/local/tmp/frida-server &"
- Run the Frida server on your Android device:
-
Run the Frida Script:
- Use a Frida script to hook into the app and bypass SSL pinning:
frida -U -f com.example.app -l ssl-pinning-bypass.js --no-pause
- Use a Frida script to hook into the app and bypass SSL pinning:
-
Install Xposed Framework:
- Install the Xposed Framework on your rooted Android device.
-
Install a SSL Pinning Bypass Module:
- Install a module like "JustTrustMe" from the Xposed Module Repository.
-
Activate the Module:
- Activate the module in the Xposed Installer and reboot your device.
-
Test the Application:
- Run the application on your Android device. The SSL pinning should now be bypassed.
- Frida Not Hooking: Ensure Frida server is running correctly on your Android device and that your device is properly connected to your computer.
- Xposed Module Not Working: Verify that the module is compatible with the version of Android and Xposed you are using.
This repository provides a step-by-step guide on how to bypass SSL pinning in Android applications using the Objection tool. SSL pinning is a security feature used by mobile apps to prevent man-in-the-middle (MitM) attacks by verifying the server's certificate. However, during penetration testing, it is often necessary to bypass SSL pinning to inspect the app's network traffic.
- Introduction
- Why Bypass SSL Pinning?
- Prerequisites
- Installation
- Using Objection to Bypass SSL Pinning
- Troubleshooting
- Contributing
- License
Objection is a powerful runtime mobile exploration toolkit, powered by Frida, that allows you to perform various security assessments on Android applications without needing root access. One of its key features is the ability to bypass SSL pinning, which is crucial for inspecting HTTPS traffic between the app and the server during penetration testing.
Before you begin, ensure you have the following:
- Android Device or Emulator: A physical device or Android emulator where the target app is installed.
- Objection: Installed on your system (see the installation instructions below).
- Frida: Installed on both your computer and Android device.
- ADB (Android Debug Bridge): Used for connecting to the Android device or emulator.
Ensure Python 3.x and pip are installed on your system. If not, install them:
- On Ubuntu/Debian:
sudo apt-get install python3 python3-pip
- On macOS (using Homebrew):
brew install python3
Install Frida using pip:
pip install frida-tools
Install Objection via pip:
pip install objection
Ensure Objection is correctly installed by running:
objection --help
First, connect your Android device to your computer using ADB:
adb devices
Ensure your device is listed. If not, troubleshoot your ADB connection.
Identify the package name of the app you want to test. You can list all installed packages with:
adb shell pm list packages
Alternatively, if you know the app's name, you can filter the results:
adb shell pm list packages | grep <app-name>
Launch Objection with the target app:
objection -g <app_package_name> explore
Replace <app_package_name>
with the actual package name of the target app.
Once inside the Objection interactive shell, run the following command to disable SSL pinning:
android sslpinning disable
This command hooks into the app’s SSL pinning logic and disables it, allowing you to intercept the app’s HTTPS traffic using tools like Burp Suite.
With SSL pinning disabled, you can now use a proxy tool (e.g., Burp Suite) to inspect the network traffic between the app and its server.
-
Objection Not Hooking Properly:
- Ensure Frida is correctly installed and the Frida server is running on your Android device.
- Verify that your device is properly connected via ADB.
-
SSL Pinning Still Active:
- Some apps may use more advanced SSL pinning techniques that Objection cannot bypass by default. In such cases, you may need to write custom Frida scripts.
Contributions are welcome! If you have improvements or additional methods to bypass SSL pinning, feel free to fork this repository, make your changes, and submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
This README provides a clear, organized guide on using the repository to bypass SSL pinning in Android applications, making it accessible to developers and security professionals alike. Adjustments can be made based on the specific tools or methods included in your project.