Strings
Hello everyone , In this blog post , I will try to explain my solution steps for Strings challenge from Mobile Hacking Lab Platform . i hope it will be useful for you
Let's install our app then open the application . we found that "Hello from c++" message appears on the home page. let’s analysis the app using Jadx tool
During Analysis the AndroidManifest.xml file we found 2 important Activity :

image.png The First activity is
com.mobilehackinglab.challenge.MainActivityLet’s analysis it’s codeit have a native Library
challengeKLOW() function: This code saves the current date in a SharedPreferences file namedDAD4using the keyUUU0133.
The Second Activity is a
com.mobilehackinglab.challenge.Activity2, Exported and contain Schema Let’s analysis it’s code , and this contain many things :first thing the app Reads the value associated with the key
UUU0133stored in SharedPreferences.Second is Compares the stored value (
u_1) with some value returned by the methodm144cd()then Checks if the URI in the intent uses the
mhlscheme andlabshost the app extracts a base64-encoded value, decodes, and attempts to decrypt it using AES and If the decrypted value matches the secret key, the app loads the "flag" library, and call thegetflag(), and displays the flag via a toast.

in this step we will
Decrypt the secretwe have :String :
bqGrDKdQ8zo26HflRsGvVA==Key. :
your_secret_key_1234567890123456IV :
1234567890123456retrieved fromActivity2K
i use this python script to decrypt the secret and this is the result
mhl_secret_1337from base64 import b64decode from Cryptodome.Cipher import AES from Cryptodome.Util.Padding import unpad # Inputs secret = "bqGrDKdQ8zo26HflRsGvVA==" # Encrypted string (Base64 encoded) key = b"your_secret_key_1234567890123456" # 32-byte key iv = b"1234567890123456" # 16-byte IV # Decode the Base64 encoded secret cipher_text = b64decode(secret) # Decrypt using AES CBC mode cipher = AES.new(key, AES.MODE_CBC, iv) decrypted = unpad(cipher.decrypt(cipher_text), AES.block_size) # Print the result print("Decrypted Text:", decrypted.decode('utf-8'))Then let’s create Frida script do this :
call
KLOW()from the Main activity ⇒ to save the secretcall
m144cdfrom the Activity2 ⇒ to return the today’s date as string with dd/mm/yyyy formatuse this command with frida script :
frida -U -f com.mobilehackinglab.challenge -l frida.jsJava.perform(function () { setTimeout(function () { Java.choose("com.mobilehackinglab.challenge.MainActivity" , { onMatch : function(instance){ console.log("Found instance: "+instance); console.log("call KLOW func: " + instance.KLOW()); }, onComplete:function(){} }); }, 1000); setTimeout(function () { Java.choose("com.mobilehackinglab.challenge.Activity2" , { onMatch : function(instance){ console.log("Found instance: "+instance); console.log("cd func: " + instance.cd()); console.log("native func: " + instance.getflag()); }, onComplete:function(){} }); }, 10000); });

call
Activity2and passandroid.intent.action.VIEWas action andmhl://labs/secret-encoded-valueas data to the activity.we get Success message in the application but flag doesn’t return !!

Lets search for our flag inside the memory

we have a lot of files let’s try to extract by reading all strings from all files and then filter for the start with MHL
MHL{IN_THE_MEMORY}
Last updated