SSL Pinning Bypass

Xposed

Xposed is a framework for Android that lets you change how apps and the system behave without modifying the APKs or flashing a custom ROM.

Frida

Frida is a dynamic instrumentation framework that allows you to hook and change the mobile app's logic at runtime. Frida is so powerful that it "requires its own ultimate" guide to list all its features.

xz -d frida-server-17.2.15-android-arm64.xz
mv frida-server-17.2.15-android-arm64 frida-server
adb push frida-server /data/local/tmp/
adb shell
cd /data/local/tmp
chmod 755 frida-server
./frida-server &
frida-ps -Uia | grep -i pinning
frida --codeshare akabe1/frida-multiple-unpinning -U -f <appname>
frida -U -N org.secuso.privacyfriendlydicer
## hook the pplication before running 
frida -U -f org.secuso.privacyfriendlydicer -l hook.js
frida -U -f org.secuso.privacyfriendlydicer -l hook.js --no-pause

Objection

pip3 install objection
objection patchapk -s package.apk
objection explore --startup-command 'android sslpinning disable'

Frida Gadget

You can automate this by using the above Objection command:

objection patchapk -s package.apk

Else, you can follow the manual way of patching the apk described in this guide.

Once the APK is patched, install Frida tools on the attacker machine using pip3 install frida-tools. After installing, you will see programs like frida, frida-ps, frida-Is-devices on your system.

Install the patched APK on an Android device and open it. The app waits till Frida connects to the Frida gadget. The output of

APKLAB

Android SSL Trustkiller

Inspeckage

Flutter Application

  • ProxyDroid for global tunneling

  • Frida scripts to bypass SSL pinning

  • reFlutter

  • Modify APK

  • Diable TLS Verification -> A Frida script that disables Flutter's TLS verification -> Read Here

Code to Add in “main.dart”

class MyHttpOverrides extends HttpOverrides {
  @override
  HttpClient createHttpClient(SecurityContext? context) {
    if (Platform.isAndroid) {
      return super.createHttpClient(context)..badCertificateCallback = (X509Certificate cert, String host, int port) => true;
    }

    return super.createHttpClient(context)
      ..findProxy = (uri) {
        return "PROXY IP:PORT";
      }
      ..badCertificateCallback = (X509Certificate cert, String host, int port) => true;
  }
}

Modifying “main()":

HttpOverrides.global = MyHttpOverrides();

With this setup, I could run ProxyDroid and intercept the application’s traffic without needing an SSL pinning bypass.

Last updated

Was this helpful?