Update: check the latest version of Comodo’s free mobile security app
Have you ever heard of the old card trick, the Double Lift? Even a novice magician should have this essential card trick mastered. But for those of you don’t know it; the Double Lift consists of presenting two cards in a way in which the audience only sees one card, the second card, while keeping the topmost card behind it. There are many variations of how to do this trick, but they all achieve the same goal – tricking the audience into believing they are looking at the topmost card when in reality, they are actually seeing the second card.
You may be wondering how a card trick is related to the security of your mobile device. Bluebox Labs recently discovered the Android Master Key Vulnerability, a security threat that uses the same method of the Double Lift to affect millions of mobile devices worldwide.
In the simplest terms, if you put two files with the same name into an Android installation package (.APK), Android will verify the digital signature of the first file BUT will install using the second file. In this attack, the first file is a legitimate app but the second file is malware. Android application packages are basically zip files. The operating system verifies the digital signature of each file before installing it. This way, it makes sure that the app is legitimate and not tampered. Verification and installation is handled by different libraries. The first library, implemented in Java, creates a hash map while the second library, written in C, verifies each entry in the hash map. This makes the process vulnerable to specially crafted application packages carrying multiple files with the same name. Thus, malware authors can get a legitimate APK file as well as a system application and inject their malicious file into this package. The result – a user will unknowingly install a malicious file onto their device instead of the original file.
Let’s see an example of an application using this vulnerability. Below you can see an APK file containing multiple files with the same name. There is also another directory named META-INF which contains a special file named MANIFEST.MF. This is the file containing digital signatures of each file in the application package.
Since the MANIFEST.MF file contains the digital signature of the first file, there won’t be any problems verifying the signature of this application. However, when it comes to installation, guess which file will be installed into the mobile device? That’s right, the second (malicious) one! As illustrated, this vulnerability allows malware authors to easily get an APK file, inject their malicious code into it, and distribute it as a legitimate application without anyone noticing it. This technique, which is increasingly being used by malware authors, holds true for system applications which are distributed within your mobile device.
What Can You Do?
Comodo advises you to install and scan your mobile device with Comodo Mobile Security. The latest update, CMS 2.3 includes an Android master key vulnerability detector which successfully detects and removes malicious files, exploiting this vulnerability.
Whether it’s an old card trick or your Android phone, don’t fall for the Double Lift.
This post was created by Emre Tinaztepe, Malware Analysis Team Lead of Comodo Turkey.TEST YOUR EMAIL SECURITY