How2rev

Rise, O Tarnished. Embark upon the sacred Path of reverse engineering through the CTF trials.

Recommended Resources:

Structure of an Android App Binary (.apk)

An .apk file is an Android binary. APK stands for Android Package Kit (also Android Application Package) and is the file format Android uses to distribute and install Android apps. It contains all the elements an app needs to function correctly on your device.

About .apk files

Android applications are bundled in a single file type called APK (Android Package Kit). They come with an .apk suffix but are just ZIP files. If you modify the suffix, you can extract their contents. To be more precise, an APK is a type of JAR (Java ARchive), which is a type of ZIP.

The contents of the .apk file always fit a specific structure:

Picture1-768x812

In addition, as part of the fusion process, some assets may be added to store information related to Fusion and the selected policy.

More info about supported ABI’s can be found here.

JNI : The principle of dynamic registration

JNI allows us to provide a function mapping table and register it with the JVM, so that the JVM can use the function mapping table to call the corresponding function without having to look up the relevant function by function name.

static jstring nativeDynamicRegFromJni(JNIEnv *env, jobject obj)
{
    return (*env) -> NewStringUTF(env, "dynamic call suceed");
}

JNINativeMethod nativeMethod[] = dynamicRegFromJni;

JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved)
{
    JNIEnv *env;
    
    jclass clz = (*env) -> FindClass(env, "com/example/helloWorld/MainActivity");

    (*env) -> RegisterNatives(env, clz, nativeMethod, sizeof(nativeMethod) / sizeof(nativeMethod[0]));

    return 0;
}

JNI_OnLoad()

When Java loads the JNI dynamic library via System.loadLibrary, it calls the JNI_OnLoad function.

C04 - 01 : Android Rev V01 (Easy–)

In this challenge, the goal is to reverse engineer an Android application that stores its password hardcoded in the main app. Right now, the secret data is quite easy to get, for now…

flag format is LRCTF{ascii}

C04-01: android01.apk

flag md5sum : f4ee1d60976b10a656727a97c6d2be0b

C04 - 02 : Android Rev V02 (Easy+)

We fired the old developer who stored a password in the source code like this. Now, the new developer has stored the password encrypted in a secure context!

flag format is LRCTF{ascii}

C04-02: android02.apk

flag md5sum : f4320c7baf988de61c6fe67dbe1b9aec

C04 - 03 : MobicrackNDK (Easy++)

This challenge come from past CTF

How does this calc work

No flag format, password is Ascii

C04-03 : MobicrackNDK