strings

manifest analyzing

we have two activity to analyze:

  • the main activity

  • Activity2 that expects a deep link


1) Main activity code analysis

📌java code

only the the ui updates the text view using a string from the native function

and we have this weird function

KLOW is supposed to store the current date in SharedPreferences under the key "UUU0133" in an xml file called DAD4.xml .

it is weird because it is never called i made sure using androguard call graph

it only calls one function and it is never called,so i think we have keep this note for now.

📌Native code

it creates a text view loaded using a native function

  1. loading

    the shared object file name is libchallenge.so

  2. definition

    takes no args and returns a string

  3. calling

the string returned from the native function is then displayed on the activity text view like this

take a look at jni trace and we have the return value

Native lib reverse engineering

anyways i don’t think this function is interesting, but let’s use ghidra to reverse it

now we get the libchallenge.so from the path lib/<abi> and import it in ghidra and view stringFromJNI() function

manually returning the code closer to the original form

looking at the native method we will realize it just returns a static string value “Hello from C++”


2)Activity2 code analysis

📌java code

in the oncreate method we have 4 if statement we should satisfy to get the flag:

1- checks if the intent action is android.intent.action.VIEW and

📌native lib reverse engineering

it is obufuscated


📌exploitation

my strategy for now is :

1- pass all the if conditions to make the native function get called

2- search the memory for the flag that starts with MHL

Bypassing if statements

frida script to run the klow function

now if we send an intent with a view action we will pass the first if statement

2- if we send a data uri with the write scheme and host we will pass the second check

3- the last segment of the uri has to be in b64 and has to be not null

4- the decoded b64 value has to equal the following string value

to decrypt we need this info

1- cipher text bqGrDKdQ8zo26HflRsGvVA==

2- IV is retrieved from Activity2Kt.fixedIV1234567890123456

3- secret key your_secret_key_1234567890123456

our secret is mhl_secret_1337

now lets send it in base 64 bWhsX3NlY3JldF8xMzM3 as the last path in the data uri with the intent

we get success now we know we passed all the if statements and the native function been called

now we want to search the memory for the flag

Last updated