Potential DoS Vulnerability with Android System
I had reported a potential flaw in the Android system that could be used to perform DOS (Denial-of-Service) on an Android Phone. The issue was caused by a poor programming assumption which could have been avoided with a good programming 101 course.
I had developed a tool called c-ray to help me with quick and dirty pentest and analysis of android applications and system. I stumbled on the issue while playing around with android core system and c-ray application.
The issue was caused by an input validation error caused by assumption of the developer. An intent to "android.accounts.GrantCredentialsPermission" class of android core system results in system crash and reboot of the system. Further analysis and reasons below.
For the normal user - Steps to reproduce the problem:
(Advanced users with knowledge of Android SDK and platform proceed to next section.)
- Launch C-Ray
- type "android" in the text box
- Choose "Package Name" radio button
- Click "Manual Scan"
Manual Scan feature lists all activities, services and receivers associated with an application - in this case the android core system.
Click the "android.accounts.GrantCredentialsPermission" from the manual scan list and continue with default action.
CLick "Yes". The system will freeze for a moment and then reboot with your usual boot screen image/logo.
For Advanced Users:
An input validation error was uncovered in the "android.accounts.
GrantCredentialsPermissionActi vity" activity of android system. The "android.accounts. GrantCredentialsPermissionActi vity" activity is an unprotected public component of the android system and can be initiated by sending an intent with appropriate input data (a.k.a intent extras). However it was observed that the "android.accounts.GrantCredentialsPermissionActivity" does not validate incoming intents to check if the intent has extras.
A malicious app can send an intent to the activity as shown below and cause the android system to crash with NullPointerException:
Intent i = new Intent();
This forces the system to reboot.
A malicious app can incorporate this vulnerability along with an SMSReceiver and BootReceiver Broadcast receivers to trigger a system reboot and force the system to keep rebooting. I was able to write a POC app which starts the reboot cycle upon receipt of an sms and force the system to reboot continuously, every time it comes back up.
The time duration between reboots is quite small (depending on device used) and does not allow the user to uninstall the application from settings. On a production device with stock/non-rooted build the only way to stop the reboot process would ideally be restoring the device to factory settings and wiping data partition.
GrantCredentialsPermissionActi vity implementation to check whether extras retrieved from the intent is NULL or not:
final Bundle extras = getIntent().getExtras(); mAccount = extras.getParcelable(EXTRAS_
This issue was reported first in Android core system running on 2.3.4. Google had responded immediately and informed me that they have fixed the issue. At the time of writing this blog,the issue was still at large even on Nexus S running 2.3.6 & 2.3.7.
The real question is: How long before this issue will be fixed on multiple fragmented releases by multiple vendors.