[AOS] Android Frida

FridaLab is an app to study the framework called Frida. Before I knew this app, I kept coming to Crackmeโ€™s Android, but it was difficult because I couldnโ€™t understand exactly how to use the API that Frida pursues. My primary purpose of writing this article is to summarize why Frida was used this way.
Letโ€™s get started ~

โ˜๐Ÿป FridaLab01

Change class challenge_01โ€™s variable โ€˜chall01โ€™ to 1:

    package uk.rossmarks.fridalab;

    /* loaded from: classes.dex */
    public class challenge_01 {
        static int chall01;

    public static int getChall01Int() {
        return chall01;
        }
    }


The first problem is to access the chall01 variable in challenge_01 class and change the value to 1.
There are three things to think about to solve this problem.

  1. How to access the challenge_01 class
  2. How to approach the challenge_01 variable in the class
  3. How to approach a variable and put it into the cycle (change)


Letโ€™s work it out step by step

How to access a class

There are two ways to access a particular method through the class.
First, use Java.use(className) API.
The second is to use the Java.choose(className,callback) API.

[ Please refer to the other blog for each description ] -> blog

To access the method

The approach to the method is the same as in any other programming languages. . You can access the classโ€™ methods using the .

To access a variable

Use the โ€˜valueโ€™ field to get the value.

โœŒ๐Ÿป Code

function sol1() {
  console.log("[>] Start");
  //     Java.perform API๋ฅผ ์ด์šฉํ•˜์—ฌ ๊ฐ€์ƒ๋จธ์‹ ๊ณผ ์—ฐ๊ฒฐ๋˜์–ด์ž‡๋Š”์ง€ ํ™•์ธ

  Java.perform(function () {
    // ํ›„ํ‚นํ•˜๊ณ ์ž ํ•˜๋Š” ๋ณ€์ˆ˜๊ฐ€ static์œผ๋กœ ์„ ์–ธ๋˜์–ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— use
    var className = Java.use("uk.rossmarks.fridalab.challenge_01");

    // ๊ฐ’ ์ ‘๊ทผ์„ ์œ„ํ•ด value ์‚ฌ์šฉ
    className.chall01.value = 1;

    console.log("[>] ์ €์žฅ๋œ ๊ฐ’: " + className.chall01.value);
  });
}

sol1();

Categories:

Updated:

Leave a comment