Bypass SSL Pinning in Android Phones — Part 2 (2024)

Bypass SSL Pinning in Android Phones — Part 2 (1)

Published in

InfoSec Write-ups

·

6 min read

·

Jan 31, 2023

--

This is a continuation of the blog on Bypass SSL Pinning in Android Phones — Part 1. Please go through the Part 1 blog to understand the basics of SSL Pinning and how it works.

In part 2, you can also refer to my youtube video on bypassing SSL pinning using Frida by clicking here. https://youtu.be/2aCAbrAkPbg I will be showcasing to you how to bypass SSL pinning from the android applications using Frida.

Bypass SSL Pinning in Android Phones — Part 2 (3)

According to its official website says “It’s Greasemonkey for native apps, or, put in more technical terms, it’s a dynamic code instrumentation toolkit. It lets you inject snippets of JavaScript or your own library into native apps on Windows, macOS, GNU/Linux, iOS, watchOS, tvOS, Android, FreeBSD, and QNX. Frida also provides you with some simple tools built on top of the Frida API.”

Frida is a powerful and extensible instrumentation toolkit — among its many strengths, it is ideally suited to testing and evaluating native Android apps. Frida allows you to intercept data received and sent by apps and inject your own code into the process.

1. Rooted Device or Emulator

we will be needing a rooted device or the emulator because of all the scripts we inject. It will store in the device’s tmp directory. For the demo purpose, I’ll be using Genymotion and you can download it from here.

It is a complete Android emulator for Windows. It’s very powerful and easy to use even for casual users, who shouldn’t have any problem navigating and controlling the program.

after the installation, set up an android device of your choice according to your machine capacity give 3GB of ram and 2 processors, and install it.

2. Android Debug Bridge(ADB) Platform-Tools

Now we will be needing ADB for that we install Platform-tools from here.

Android SDK Platform-Tools is a component for the Android SDK. It includes tools that interface with the Android platform, primarily ADB and fastboot. Although ADB is required for Android app development, app developers will normally just use the copy Studio installs.

Bypass SSL Pinning in Android Phones — Part 2 (4)

3. Frida Packages

For Frida, we need to install some packages or libraries. it can be installed directly through the terminal.

$ pip3 install Frida 
$ pip3 install frida-tools

4. Scripts for injection

we will download or copy the “Universal Android SSL Pinning Bypass with Frida” script from here. this we will be using in our targeted android application.

5. Proxy Tools (Burp Suite)

Last but not least the Burpsuite intercepts the HTTP Request and Response of the target application.

with this, we have all our tools ready to bypass pinning.

Now Let's Bypass SSL Pinning!!!

First, we need to start our genymotion emulator, or if you are using your phone we have to make sure that debugging mode is on. To do this go to setting -> developer option and turn on the debugging mode on either of the devices so that adb can communicate with the device.

Bypass SSL Pinning in Android Phones — Part 2 (5)

Now go to the platform-tools folder and open the command prompt or the terminal in which we can connect it with ADB.

If our devices are connected properly this will reflect in the ADB. we can check this by using the below commands

adb devices
Bypass SSL Pinning in Android Phones — Part 2 (6)

The emulator is running on IP 192.168.56.104 and port 5555

Genymotion is detected in adb now let's connect to this device.

adb connect <DeviceIP:Port>
adb connect 192.168.1.102:5555
Bypass SSL Pinning in Android Phones — Part 2 (7)

adb is already connected to the mobile emulator

Now we will download the Frida server from the GitHub repository for our android emulator according to its architecture version.

adb shell getprop ro.product.cpu.abi

the above command will tell you the architecture version used

Bypass SSL Pinning in Android Phones — Part 2 (8)

I have installed frida-server-16.0.8-android-x86.xz according to my device architecture.

Now we need to push the Frida server into the tmp directory of the device

adb push <path_of_frida_server_folder> /data/local/tmp 
adb push "/home/rapso/Desktop/tools/mobtest/frida-server-x86" /data/local/tmp

above-mentioned command will push the Frida server into the tmp directory.

now we will provide the executable permission to this server.

adb shell chmod 777 /data/local/tmp/frida-server-x86
Bypass SSL Pinning in Android Phones — Part 2 (9)

the second command shows us that now we have the read, write and execute permission on the Frida-server binary.

let's start this Frida server

adb shell /data/local/tmp/frida-server-x86 &
Bypass SSL Pinning in Android Phones — Part 2 (10)

our Frida server is up and running.

Now let’s check if it is working or not, the below command will list all the installed applications in the device along with their process if they are running.

Frida-ps -Uai
Bypass SSL Pinning in Android Phones — Part 2 (11)

Now we will also inject the SSL bypass script into the same tmp directory as well as the burp’s certificate. I have already saved this script named sslbypass.js in my local directory.

Bypass SSL Pinning in Android Phones — Part 2 (12)
Bypass SSL Pinning in Android Phones — Part 2 (13)

Our sslbypass.js script uses the burp’s certificate so that it can intercept the requests.

Now it's time to inject the uploaded script into the application to test I have installed (Country Delight application) whose package name is “app.mycountrydelight.in.countrydelight”

frida -U -f <application_package_name> -l <path_to_sslbypass.js_script> 
frida -U -f app.mycountrydelight.in.countrydelight -l "sslbypass.js"
Bypass SSL Pinning in Android Phones — Part 2 (14)

now this is up and running with this we will now capture this request in the burp as long as we are using the proxy. as shown below.

Bypass SSL Pinning in Android Phones — Part 2 (15)

the above image shows that we have successfully bypassed the SSL Pinning of the Country Delight application and with the help of the burp suite, we are able to intercept the HTTP request and HTTP Responses.

You can also refer to my youtube video on bypassing SSL pinning using Frida by clicking here. https://youtu.be/2aCAbrAkPbg

Thanks for reading the write-up! Any feedback is appreciated.

Check out Part-1 of this blog: Bypass SSL Pinning in Android Phones — Part 1.

References

Bypass SSL Pinning in Android Phones — Part 2 (2024)

FAQs

How to disable SSL pinning on Android programmatically? ›

  1. 9 Different Ways To Bypass SSL Pinning In Android. ...
  2. SSL Pinning Bypass via IPtables Traffic Forwarding (Flutter & Xamarin application) ...
  3. SSL Pinning Bypass Via Replacing Hard-Coded Sha 256 Hash. ...
  4. SSL Pinning Bypass via Android Manifest modification. ...
  5. SSL Pinning Bypass via Reflutter. ...
  6. Bypassing SSL Pinning via MITM.
Feb 29, 2024

What is SSL pinning bypass in Android? ›

SSL Pinning Bypass tries to overcome SSL pinning by using dynamic instrumentation toolkits such as Frida. The bypass is based on a technique that replaces the certificate TrustManager used by the app, thus making the app trust any server certificate used by an attacker during an MitM attack.

How to disable certificate in Android? ›

Remove custom certificates

Open your device's Settings app. Encryption & credentials. Under "Credential storage": To clear all certificates: Tap Clear credentials.

Is SSL pinning applicable to Android? ›

SSL Pinning mitigates these risks by ensuring that the app communicates only with a server presenting the pinned certificate or public key. In this article, we will explore how to implement SSL Pinning in your Android applications using two popular networking libraries: OkHttp and Retrofit.

How to fix SSL on Android? ›

7 Ways to Solve Your Android SSL Connection Error
  1. Correct the Date & Time on Your Device. ...
  2. Clear Browsing Data of Google Chrome. ...
  3. Reset Your Network Settings. ...
  4. Deactivate Your Antivirus App. ...
  5. Update Your App/Browser. ...
  6. Visit Website in an Incognito/Private Mode. ...
  7. Reset Your Device.

What is SSL bypass? ›

SSL forward proxy bypass takes the first match found and intercepts a URL if it is found on an intercept list or bypasses a URL if it is found on a bypass list. If no match exists, SSL forward proxy bypass applies the default action to the URL.

Can certificate pinning be bypassed? ›

For most applications, certificate pinning can be bypassed within seconds, but only if the app uses the API functions that are covered by these tools. If the app is implementing SSL Pinning with a custom framework or library, the SSL Pinning must be manually patched and deactivated, which can be time-consuming.

What is alternative to SSL pinning? ›

Certificate Transparency & monitoring

By logging certificates in publicly accessible CT logs, organizations are able to monitor, detect, and respond to misissued certificates at the time they are issued. Cloudflare customers can set up CT Monitoring to receive notifications when certificates are issued in their domain.

How to test SSL pinning in Android? ›

Under 'Security Analysis' tab, click on File Analysis. Wherein, If you find "Certificate/Key Files Hard-coded inside the App" or "Hardcoded Keystore Found" keywords, it means application has SSL pinning. Since key files and . bks files are prerequisite component to have SSL pining implemented on an android application.

How do I remove certificate authority from my phone? ›

Instructions for Android
  1. Open the Settings application, and select the Security option.
  2. Navigate to the Trusted Credentials.
  3. Tap on the certificate that you would like to delete.
  4. Tap Disable.

What happens if I remove all certificates from my phone? ›

If you accidentally remove legitimate certificates, you compromise secure connectivity to services and websites. This exposes your Android device to potential security risks. Your device might start popping up security warnings every time you try to access some websites, especially those that are SSL encrypted.

What is SSL unpinning? ›

The SSLUnpinning through Xposed Framework, makes several hooks in SSL classes to bypass the certificate verifications for one specific app, then you can intercept all your traffic.

Where is SSL certificate stored in Android? ›

Under device security, locate the Encryption & Credentials tab and click on it. Under credentials storage, click on Trusted credentials. A list of all certificates will appear. You can click on a specific certificate to see more details about the CA.

What is a CA certificate on Android? ›

A CA signs a server certificate using its private key. The client can then check that the server has a platform-known CA certificate. Trusted CAs are usually listed on the host platform. Android 8.0 (API level 26) includes over 100 CAs that are updated in each version and don't change between devices.

How to disable SSL certificate validation in Android? ›

Four Ways to Bypass Android SSL Verification and Certificate...
  1. Adding a custom CA to the trusted certificate store.
  2. Overwriting a packaged CA cert with a custom CA cert.
  3. Using Frida to hook and bypass SSL certificate checks.
  4. Reversing custom certificate code.
Jan 9, 2018

How do I know if SSL pinning is enabled in APK? ›

Under 'Security Analysis' tab, click on File Analysis. Wherein, If you find "Certificate/Key Files Hard-coded inside the App" or "Hardcoded Keystore Found" keywords, it means application has SSL pinning. Since key files and . bks files are prerequisite component to have SSL pining implemented on an android application.

How do I turn off SSL mode? ›

Disable Universal SSL certificate
  1. Log in to the Cloudflare dashboard and select your account.
  2. Select your domain.
  3. Go to SSL/TLS > Edge Certificates.
  4. For Disable Universal SSL, select Disable Universal SSL.
  5. Read the warnings in the Acknowledgement.
  6. Select I Understand and select Confirm.

How to disable SSL from command line? ›

The curl command provides the -k or –insecure option to disable SSL certificate verification. This allows curl to perform “insecure” SSL connections and transfers without checking the authenticity of the SSL certificate presented by the server.

Top Articles
IBAN vs Routing Number | Find Routing Number From IBAN
What Are Routing Numbers And How Do You Find Them? | MoneyTransfers.com
Ghosted Imdb Parents Guide
Couchtuner The Office
Otterbrook Goldens
Northern Whooping Crane Festival highlights conservation and collaboration in Fort Smith, N.W.T. | CBC News
Arrests reported by Yuba County Sheriff
Moviesda Dubbed Tamil Movies
2021 Tesla Model 3 Standard Range Pl electric for sale - Portland, OR - craigslist
B67 Bus Time
[2024] How to watch Sound of Freedom on Hulu
Tiger Island Hunting Club
Craigslist/Phx
Craigslist Pets Longview Tx
Walmart Double Point Days 2022
Conscious Cloud Dispensary Photos
Rachel Griffin Bikini
Byui Calendar Fall 2023
VERHUURD: Barentszstraat 12 in 'S-Gravenhage 2518 XG: Woonhuis.
Hermitcraft Texture Pack
What Is Vioc On Credit Card Statement
Busted News Bowie County
Academy Sports Meridian Ms
Jobs Hiring Near Me Part Time For 15 Year Olds
Riversweeps Admin Login
Dei Ebill
Marokko houdt honderden mensen tegen die illegaal grens met Spaanse stad Ceuta wilden oversteken
Phoenixdabarbie
How rich were the McCallisters in 'Home Alone'? Family's income unveiled
Busch Gardens Wait Times
Inmate Search Disclaimer – Sheriff
October 19 Sunset
Jambus - Definition, Beispiele, Merkmale, Wirkung
Most popular Indian web series of 2022 (so far) as per IMDb: Rocket Boys, Panchayat, Mai in top 10
Upstate Ny Craigslist Pets
Lake Dunson Robertson Funeral Home Lagrange Georgia Obituary
Oreillys Federal And Evans
Polk County Released Inmates
Thelemagick Library - The New Comment to Liber AL vel Legis
Fwpd Activity Log
Danielle Ranslow Obituary
Energy Management and Control System Expert (f/m/d) for Battery Storage Systems | StudySmarter - Talents
Ethan Cutkosky co*ck
Citibank Branch Locations In North Carolina
Darkglass Electronics The Exponent 500 Test
What is 'Breaking Bad' star Aaron Paul's Net Worth?
Deezy Jamaican Food
Amy Zais Obituary
Enjoy Piggie Pie Crossword Clue
Here’s What Goes on at a Gentlemen’s Club – Crafternoon Cabaret Club
Publix Store 840
Bomgas Cams
Latest Posts
Article information

Author: Kieth Sipes

Last Updated:

Views: 6484

Rating: 4.7 / 5 (67 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Kieth Sipes

Birthday: 2001-04-14

Address: Suite 492 62479 Champlin Loop, South Catrice, MS 57271

Phone: +9663362133320

Job: District Sales Analyst

Hobby: Digital arts, Dance, Ghost hunting, Worldbuilding, Kayaking, Table tennis, 3D printing

Introduction: My name is Kieth Sipes, I am a zany, rich, courageous, powerful, faithful, jolly, excited person who loves writing and wants to share my knowledge and understanding with you.