APP Tracing with Frida

01. Introduction

Frida is a dynamic code instrumentation toolkit. It lets you inject your script into black-box processes(No source code needed). It allows you to inject your own code and to programmatically and interactively inspect and change running processes.

Frida, on the other hand, allows you to interact with the Android APK so you can inject code to bypass many of the techniques developers use to secure the apps.

Goal of this exercise is to trace the CrackmeSimple application with frida and find a way to decode the password.

APK File:

02. Install Frida

If you haven't setup frida you can install it with the following commands:

pipenv –python 3 shell
pip install frida
pip install frida-tools

git clone https://github.com/Hamz-a/frida-android-helper.git
cd frida-android-helper
python3 setup.py install

In Android Studio I'll setup a Nexus 5 Device with Android 9.0 running on it. This version works much more stable and faster in my virtual environment than other Android Images I’ve tested before.

Install the APK File on the device:

adb install CrackmeSimple.apk

03. Tracing the app

First we must push the frida server on the device

python fah.py server update

Starting the frida server as root on the device:

adb shell
su 
cd /data/local/temp 
./frida-server &

List running processes with frida:

frida-ps -U

List running applications with frida:

frida-ps -Ua

List installed applications with frida:

frida-ps -Uai

I try to hook all imported classes with the following command:

frida-trace -U -j 'org.bfe*!*' 'CrackMe*' 

Frida catched 39 classes. Let's see what we get when I type a wrong password:

Let's have a closer look on the return values:

<= [72,76,123,82,51,118,51,114,115,105,110,103,46,70,85,78,125]

04. Decoding with Cyberchef

I'll use Cyberchef to decode the values:

Last updated