Trend Micro Discovers Vulnerability That Renders Android Devices Silent

We have discovered a vulnerability in Android that can render a phone apparently dead – silent, unable to make calls, with a lifeless screen. This vulnerability is present from Android 4.3 (Jelly Bean) up to the current version, Android 5.1.1 (Lollipop). Combined, these versions account for more than half of Android devices in use today. No patch has been issued in the Android Open Source Project (AOSP) code by the Android Engineering Team to fix this vulnerability since we reported it in late May.

This vulnerability can be exploited in two ways: either via a malicious app installed on the device, or through a specially-crafted web site. The first technique can cause long-term effects to the device: an app with an embedded MKV file that registers itself to auto-start whenever the device boots would case the OS to crash every time it is turned on.

In some ways, this vulnerability is similar to the recently discovered Stagefright vulnerability. Both vulnerabilities are triggered when Android handles media files, although the way these files reach the user differs.

Vulnerability Description

The vulnerability lies in the mediaserver service, which is used by Android to index media files that are located on the Android device. This service cannot correctly process a malformed video file using the Matroska container (usually with the .mkv extension). When the process opens a malformed MKV file, the service may crash (and with it, the rest of the operating system).

The vulnerability is caused by an integer overflow when the mediaserver service parses an MKV file. It reads memory out of buffer or writes data to NULL address when parsing audio data. The source code below – found in the frameworks/av/media/libstagefright/matroska/MatroskaExtractor.cpp file – shows the vulnerability in detail:

865 size_t offset = 1;
866 size_t len1 = 0;
867 while (offset < codecPrivateSize && codecPrivate[offset] == 0xff) {//codecPrivate is controlled by the mkv file
868 len1 += 0xff;
869 ++offset;
870 }
871 if (offset >= codecPrivateSize) {
873 }
874 len1 += codecPrivate[offset++];
876 size_t len2 = 0;
877 while (offset < codecPrivateSize && codecPrivate[offset] == 0xff) {
878 len2 += 0xff;
879 ++offset;
880 }
881 if (offset >= codecPrivateSize) {
883 }
884 len2 += codecPrivate[offset++];
886 if (codecPrivateSize < offset + len1 + len2) {//len1 or len2 maybe 0xffffffff, then integer overflow happened
888 }
890 if (codecPrivate[offset] != 0x01) {
892 }
893 meta->setData(kKeyVorbisInfo, 0, &codecPrivate[offset], len1);//crash in here

Proof Of Concept

We created a proof-of-concept app that includes a malformed MKV file (res/raw/crash.mkv) to demonstrate how this attack functions. Once the app is started, the mediaserver service will keep crashing.

Figure 1. The mediaserver service continuously restarting after the exploit is triggered

This wil cause the device to become totally silent and non-responsive. This means that:

  • No ring tone, text tone, or notification sounds can be heard. The user will have have no idea of an incoming call/message, and cannot even accept a call. Neither party will hear each other.
  • The UI may become very slow to respond, or completely non-responsive. If the phone is locked, it cannot be unlocked.

Figure 2. Unresponsive phone

The video below demonstrates the exploitation through a malicious app.

As for exploitation through the specially-crafted URL, we’ve created a test website with the same MKV file embedded into an HTML page. When this site is loaded using the Chrome browser, we see the same effect:

Figure 3. HTML code of test page

What’s more, although mobile Chrome disables preload and autoplay of videos, the malformed MKV still causes the Chrome to read more than 16MB until mediaserver crashes. It appears to have bypassed the limitation.

Potential threat scenarios

As we mentioned above, there are two ways that this attack can be exploited: the user can either visit a malicious site or download a malicious app.

There are many common techniques that could be used to lure a user to a malicious site. We’ve discussed in the past how repackaged apps pose a problem for users who may have a hard time differentiating legitimate apps from repackaged ones.

Whatever means is used to lure in users, the likely payload is the same. Ransomware is likely to use this vulnerability as a new “threat” for users: in addition to encrypting on the device being encrypted, the device itself would be locked out and unable to be used. This would increase the problems the user faces and make them more likely to pay any ransom.

Further research into Android – especially the mediaserver service – may find other vulnerabilities that could have more serious consequences to users, including remote code execution.

We reported this vulnerability privately to Google and received responses on the following dates:

  • May 15 – Trend Micro reported the vulnerability to Google
  • May 20 – Google acknowledged the report as a low priority vulnerability identified it as ANDROID-21296336

Read more: Trend Micro Discovers Vulnerability That Renders Android Devices Silent

Story added 29. July 2015, content source with full text you can find at link above.