Frida Tutorial

Installation

Install frida tools:

pip install frida-tools
pip install frida

Download and install in the android the frida server (Download the latest release). One-liner to restart adb in root mode, connect to it, upload frida-server, give exec permissions and run it in backgroud:

adb root; adb connect localhost:6000; sleep 1; adb push frida-server /data/local/tmp/; adb shell "chmod 755 /data/local/tmp/frida-server"; adb shell "/data/local/tmp/frida-server &"

Check if it is working:

frida-ps -U #List packages and processes
frida-ps -U | grep -i <part_of_the_package_name> #Get all the package name

Tutorials

From: https://medium.com/infosec-adventures/introduction-to-frida-5a3f51595ca1 APK: https://github.com/t0thkr1s/frida-demo/releases Source Code: https://github.com/t0thkr1s/frida-demo

Follow the link to read it.

From: https://11x256.github.io/Frida-hooking-android-part-2/ (Parts 2, 3 & 4) APKs and Source code: https://github.com/11x256/frida-android-examples

Follow the link to read it.

From: https://joshspicer.com/android-frida-1 APK: https://github.com/OWASP/owasp-mstg/blob/master/Crackmes/Android/Level_01/UnCrackable-Level1.apk

Follow the link to read it. You can find some Awesome Frida scripts here: https://codeshare.frida.re/****

Fast Examples

Here you can find the more basic and interesting functionalities of Frida to make a quick script:

Calling Frida from command line

Basic Python Script

Hooking functions without parameters

Hook the function a() of the class sg.vantagepoint.a.c

Hook java exit()

Hook MainActivity .onStart() & .onCreate()

Hook android .onCreate()

Hooking functions with parameters and retrieving the value

Hooking a decryption function. Print the input, call the original function decrypt the input and finally, print the plain data:

Hooking functions and calling them with our input

Hook a function that receives a string and call it with other string (from here)

Getting an already created object of a class

If you want to extract some attribute of a created object you can use this.

In this example you are going to see how to get the object of the class my_activity and how to call the function .secret() that will print a private attribute of the object:

Last updated