write-ups-challenges-2024-2025/oats2/SOLUTION.md
2024-11-25 22:31:09 +01:00

1.3 KiB

Difficulty

Easy

Category

Reverse Engineering

How To Solve

When you run the app on an android device/emulator, you see that you are not a nice person. You will need to reverse engineer the APK to discover the flag.

This time, you can use JADX to analyze the APK. After performing jadx oats2.apk, you will be able to navigate to a file named MainActivityKt.java located somewhere under sources/. The following function provides you with the flag when you are nice:

public static final void Greeting$showFlag(MutableState<String> mutableState, boolean isNice) {
    if (isNice) {
        int num2 = 42 + 58;
        int num3 = (num2 * 42) + num2;
        String[] array = {"zefiluhfz", "nelsqefvon", "maqzpeiuvfbqddela", "vcnbdqiyfub", "camw33pus", "woohvfdowinoo", "oiuyqecqer", "lusg9876hdfskj", "igc", "tf"};
        String fContent = array[8] + array[9] + '{' + array[num3 % array.length] + array[(num3 * num2) % array.length];
        String flag = fContent + '}';
        mutableState.setValue(flag);
        return;
    }
    mutableState.setValue("NOPE");
}

In order to obtain the flag, you can either modify and recompile entire source code, or simply copy, compile and execute only the function itself.

Flag

igctf{zefiluhfzzefiluhfz}