Config Editor
install the app and open it i found that app has an input field to write on it and the save it as
yaml file,, the sec feature is load file from the storage
image.png Let’s Exam the
Androidmanifest.xml:here we have a MainActivity : it’s an exported activity : with an intent filter with a
View actionand have 3 schemas :file , http , https& with a category :Browsable& allowing users toload and save YAMLfiles.
after some analysis of Main Activity i found an interested Functions :
loadYaml(): it used to open the file with the given URI and then Read the file as an input stream , then parse the YAML content file into an objectsaveYaml(): take the input we put and then Convert to Bytes: It converts the text content into a byte and writes it to a YAML file at the specified URI.intent Handling(): handle Intent processes intents that contain a URI to load a file, which it passes to load Yaml if valid.
after i have search about SnakeYAML library , it has a
CVE-2022-1471its a deserialization vulnerability, with versions before 2.0 allowing remote code execution when used to parse untrusted input
SnakeYAML allows the instantiation of arbitrary Java classes from untrusted YAML sources. This "insecure by default”
We have a class name called
LegacyCommandUtilthis class provides a way to run arbitrary shell commands from within an Android app or Java program
we can exploit this vulnerability to pass a malicious argument to
LegacyCommandUtiland achieve RCEExploitation Strategy :
Craft a Malicious YAML File: that, when opened by this app, could trigger remote code execution (RCE). create an
exploit.ymlfile that contain this payloadRCE by kero: !!com.mobilehackinglab.configeditor.LegacyCommandUtil ["touch /data/data/com.mobilehackinglab.configeditor/kero.txt"]push this yaml file to the external storage
then used the below
adbcommand to load theymlfile from the external storage (/sdcard/Download)adb shell am start -n com.mobilehackinglab.configeditor/.MainActivity -a android.intent.action.VIEW -d "file:///sdcard/Download/exploit.yml"and here we done


Last updated