SSL Pinning Bypass

Sukesh Goud

Sukesh Goud

Dec 22, 2022

3 Min

TABLE OF CONTENTS

  1. What is SSL?
  2. What Is Certificate Pinning?
  3. SSL pinning bypass?
  4. What is FRIDA?
  5. Requirements
  6. References

What is SSL?

Secure Socket Layer (SSL) and Transport Layer Security (TLS) ensure encrypted

Communication over the internet – specified as HTTPS. The security factors of SSL are based on the security certificates’ “Chain of Trust.” When a sender sent a message, the client checks the Server’s SSL certificate to confirm whether the certificate is issued by Trusted CA.

What Is Certificate Pinning?

Certificate pinning forces your client app to validate the server’s certificate against a known copy. After pinning your server’s certificate inside your client app, your client should check the basic validity of the cert from the list above, as well as verify that the server’s certificate matches the pinned certificate.

SSL pinning bypass?

SSL pinning bypass is a major step that needs to be done when we even start the dynamic analysis of HTTP requests for most of the mobile application nowadays as organizations are more concern about data privacy and secure transfer of data over the network from threads like Man-in-The-Middle (MiTM) attacks.

What is FRIDA?

Frida is a framework that injects scripts to native apps to manipulate application’s logic in runtime which is a more dynamic approach for pentesting mobile applications.

Requirements

  1. Rooted device/emulator:

    I’m using genymotion for this one. Genymotion is easy to set-up and use and can download it from below.

    Click on this URL

    Python frida packages and adb installation:

    python -m pip install Frida
    python -m pip install objection
    python -m pip install frida-tools

    OR

    pip install Frida
    pip install objection
    pip install frida-tools
    apt install adb

     
  2. Setup and installation
    1. Connect device to adb:

      If you do not enable- first goto settings >> Developer options and enable debugging mode in device so that adb can communicate with the device.
       

    2. Install SSl pinning apk in device

      Step:1 Download apk – go to directory open terminal

      adb install -r twitter_9.69.0_androidapksbox.apk


      Step:2 Twitter installed in emulator


      Step:3 Open the application and Observe that the application is a SSL Pinning
       

    3. Frida Server Setup:

      Download latest frida server:

      Step:1 Click on this URL

      frida-server-12.4.7-android-x86

      frida-server-12.4.7-android-x86_64.xz

      Step:2 Now we need to push our frida-server file into the device. Extract and Copy “frida-server-12.4.7-android-x86” file in adb folder rename file as “frida-server”


      Step:3 following command → adb push frida-server /data/local/tmp/
      q3.jpg

      Step:4 Pushed this /data/local/tmp

      q4.jpg
       

      Step:5 Give permissions to frida-server → adb shell chmod 777 /data/local/tmp/frida-server
      a5.jpg

      Step:6 Push the certificate into the device and into the same location as the frida-server, name it cert-der.crt

      q6.jpg

      Step:7 Pushed this /data/local/tmp

      q7.jpg

      Step:8 Click on this URL, You can save this code as fridascript.js in the same folder as adb → adb push fridascript.js /data/local/tmp/ 
      q8.jpg


      Step:9 Pushed this /data/local/tmp

      q9.jpg

      Step:10 Check and run frida server in device → adb shell /data/local/tmp/frida-server &

      q10.jpg


      Step:11 Following command → frida-ps -Uai 
      q11.jpg


      Step:12 Find your application’s package name

      q12.jpg

      Step:13 Following command → frida -U -f  com.twitter.android   -l fridascript.js –no-paus

      q13.jpg

      Step:14 Your command to inject the fridascript.js script into the native application 

      q14.jpg



      Step:15 BOOM Bypassed!!. We are intercepting traffic into BurpSuite

      q15.jpg

That’s all for this blog, I hope you enjoyed reading this. In future, I will right one more blog that will include some other techniques.

References

Click here to see the reference

Sukesh Goud
Sukesh GoudSecurity Consultant
linkedin

Sukesh Goud, Certbar’s Security Consultant, leads Mobile R&D with 4 years’ expertise, excelling in red teaming and mentoring. Distinguished by a robust Mobile and Web App Security research background.

Share

Share to Microsoft Teams
Header Logo

Attack. Defend. Comply. Privacy.

InstagramTwitterLinkedinFacebook

Register with:

Linkedin
Copyright © 2019 - 2024 Certbar Security Pvt. Ltd. All rights reserved.