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 storageimage.png Letβs Exam the
Androidmanifest.xml
:here we have a MainActivity : itβs an exported activity : with an intent filter with a
View action
and have 3 schemas :file , http , https
& with a category :Browsable
& allowing users toload and save YAML
files.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-1471
its 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
LegacyCommandUtil
this class provides a way to run arbitrary shell commands from within an Android app or Java programwe can exploit this vulnerability to pass a malicious argument to
LegacyCommandUtil
and achieve RCEExploitation Strategy :
Craft a Malicious YAML File: that, when opened by this app, could trigger remote code execution (RCE). create an
exploit.yml
file 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
adb
command to load theyml
file 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