software:frida
Table of Contents
Frida
Frida is an amazing piece of software. My favourite use is mitm proxy “attack” to have an in-depth API investigation of apps that I use frequently. This setup will allow you to easily bypass any SSL certificate pinning.
Quick setup
Execute these steps in 3 different shells
mtim
- Create docker volume for mitm
$ docker volume create mitmproxy
- Start the container
$ docker run --rm -it -v mitmproxy:/home/mitmproxy/.mitmproxy -p 4817:8080 -p 4818:8081 mitmproxy/mitmproxy mitmweb --web-host 0.0.0.0 --ignore-hosts gateway.icloud.com
- Set your browser to use the HTTP proxy you just created
- Navigate with your browser to mitm.it and download the certificate to ~/Downloads/YOUR_MITM_CERT
- You will also conveniently see all the HTTP(S) requests here
- TIP: disable the proxy in the browser to limit the noise
Frida
- Create a Python VENV
$ python3 -m venv frida-venv
- Activate the environment
$ source frida-venv/bin/activate
- Install Frida
(frida-venv) $ python3 -m pip install Frida (frida-venv) $ python3 -m pip install objection (frida-venv) $ python3 -m pip install frida-tools
- Download the Android side binary
(frida-venv) $ version=$(frida --version) && curl -Lo ~/Downloads/frida-server.xz https://github.com/frida/frida/releases/download/$version/frida-server-$version-android-x86_64.xz
- Unpack the Android side binary
(frida-venv) $ xz -d ~/Downloads/frida-server.xz
Android Studio
- Install Android Studio
$ snap install --classic android-studio
- Set the right variables in your environment
$ export ANDROID_HOME=$HOME/Android/Sdk $ export PATH=$PATH:$ANDROID_HOME/emulator $ export PATH=$PATH:$ANDROID_HOME/tools $ export PATH=$PATH:$ANDROID_HOME/tools/bin $ export PATH=$PATH:$ANDROID_HOME/platform-tools $ export PATH=~/Android/Sdk/cmdline-tools/latest/bin:$PATH
- Open Android Studio, click on “More Actions”>“SDK Manager” and tick “Show Package Details”.
- Select the “SDK Platforms” you want to emulate
- In the “SDK Tools”, select the respective “Android SDK Build-Tools” and the latest “Android SDK Command-line Tools”
- Finally click “Apply”
- Prepare your emulator
$ avdmanager create avd --force --name pixel-android-api-29 --package "system-images;android-29;google_apis;x86_64" --device "pixel"
- Launch your emulator
$ emulator -avd pixel-android-api-29 -writable-system &> /dev/null &
- Using the emulator UI, click the three dots on the side menu, Settings, Proxy and set the mitm proxy address and port
- Get root access
$ adb root
- Upload mitm CA certificate
$ adb push ~/Downloads/YOUR_MITM_CERT.cer /data/local/tmp/cert-der.crt
- Upload Frida
$ adb push ~/Downloads/frida-server /data/local/tmp
- Fix permissions
$ adb shell "chmod +x /data/local/tmp/frida-server"
- Start Frida
$ adb shell "/data/local/tmp/frida-server&" &
- Get your APK from a phone or apkmirror
- Install the APK
$ adb install YOUR_APK.apk &
Usage
Great, you are ready to go!
- Go back to the shell that's currently running in the Frida Python VENV
- Start your app (assuming it's com.google.com)
(frida-venv) $ frida --codeshare akabe1/frida-multiple-unpinning -U -f com.google.com
- Observe the magic happening in your browser :)
software/frida.txt · Last modified: by Michele Porelli
