Frida Tutorial

Bug bounty tip: sign up for Intigriti, a premium bug bounty platform created by hackers, for hackers! Join us at https://go.intigriti.com/hacktricks today, and start earning bounties up to $100,000!

Installation

Install frida tools:

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:

Check if it is working:

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 more Awesome Frida scripts here: https://codeshare.frida.re/

Quick Examples

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:

Other Frida tutorials

Bug bounty tip: sign up for Intigriti, a premium bug bounty platform created by hackers, for hackers! Join us at https://go.intigriti.com/hacktricks today, and start earning bounties up to $100,000!

Last updated