write-ups-challenges-2024-2025/oats2/SOLUTION.md

25 lines
1.3 KiB
Markdown
Raw Normal View History

2024-11-25 21:31:09 +00:00
## 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](https://github.com/skylot/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:
```java
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}`