Categories: MobileSecurity

Hiding a malicious Android APK in images as evasion method

Two researchers at Fortinet have demonstrated during the last Black Hat Europe conference how to hide a malicious Android APK in images.

Mobile devices are continuously under attacks, cyber criminals are improving their technique to attack mobile users and increase the profits.  A new technique recently disclosed, allows attackers to hide encrypted malicious Android applications inside images, the method allows threat actors to evade detection by antivirus products and according the experts potentially also the checks run by Google Play’.

The new attack technique was developed by Axelle Apvrille, a security researcher at Fortinet, in collaboration with reverse engineer Ange Albertini. The researchers presented their proof-of-concept last week during the last Black Hat Europe security conference.

The methods exploit a technique designed by Albertini dubbed AngeCryption, which allow to encrypt anything into whatever we want (apart a few restrictions on input and output formats) using a Python script written by the researcher. The script receives in input the content user wishes to encrypt , the output user wishes to receive and it will calculate a specified key using AES in cipher-block chaining (CBC) mode that produces the expected output file..

The script elaborates the input, “without altering the information it contains, so that the input encrypted with the provided key and a generated initialization vector (IV) turns into the output.”

The two researchers at Fortinet applied the concept to Android application packages (APKs) files, they created a proof-of-concept wrapping application that displays a PNG image of Anakin Skywalker, one of the characters of Star Wars saga. The app they developed is able to decrypt the image with a particular key in order to obtain a second Android APK file that it will install.

During their presentation at the BlackHat, the researcher used an encrypted APK that once extracted by the principal app displays a picture of Darth Vader, in a real attack scenario the hackers could run a malicious application to control the Smartphone or to steal user’s, including SMS messages, photos and contacts.

During the presentation the Android device displayed a permission request when the wrapper application tried to install the decrypted APK file, but as explained by Apvrille this behavior is easy to avoid invoking a method called DexClassLoader.

Another interesting thing is that the malicious APK could be also downloaded from a remote server without triggering any alert due the to the encryption applied.

As explained the researchers there is anyway a condition to satisfy in order to successfully run the attack, some data needs to be appended at the end of the original application, but the APK format does not allow to append any data after a marker called the End of Central Directory (EOCD), which is a sort of end of the file.

The researcher bypassed the limitation, adding a second EOCD after the appended data, this procedure tricks Android into accepting the file as valid. It’s clear that APK parser fails to correctly parse the code provided on input.

The researchers have already reported the security issue to the Android security team that is currently working on a fix. The attack works on the latest version of Android, Android 4.4.2.

Because of fragmentation in the Android ecosystem, especially when it comes to firmware updates, many devices will likely remain vulnerable to this attack for a long time, giving Android malware authors ample time to take advantage of it.

The researchers speculated that the vulnerability will probably remain active for a long time on many devices because the fragmentation in the Android ecosystem and different patch management of various vendors.

The proof-of-concept code used during the presentation is available on Github.

Pierluigi Paganini

(Security Affairs – APK, Android)

Pierluigi Paganini

Pierluigi Paganini is member of the ENISA (European Union Agency for Network and Information Security) Threat Landscape Stakeholder Group and Cyber G7 Group, he is also a Security Evangelist, Security Analyst and Freelance Writer. Editor-in-Chief at "Cyber Defense Magazine", Pierluigi is a cyber security expert with over 20 years experience in the field, he is Certified Ethical Hacker at EC Council in London. The passion for writing and a strong belief that security is founded on sharing and awareness led Pierluigi to find the security blog "Security Affairs" recently named a Top National Security Resource for US. Pierluigi is a member of the "The Hacker News" team and he is a writer for some major publications in the field such as Cyber War Zone, ICTTF, Infosec Island, Infosec Institute, The Hacker News Magazine and for many other Security magazines. Author of the Books "The Deep Dark Web" and “Digital Virtual Currency and Bitcoin”.

Recent Posts

Nation-state actors exploited two zero-days in ASA and FTD firewalls to breach government networks

Nation-state actor UAT4356 has been exploiting two zero-days in ASA and FTD firewalls since November…

4 hours ago

Hackers hijacked the eScan Antivirus update mechanism in malware campaign

A malware campaign has been exploiting the updating mechanism of the eScan antivirus to distribute…

11 hours ago

US offers a $10 million reward for information on four Iranian nationals

The Treasury Department's Office of Foreign Assets Control (OFAC) sanctioned four Iranian nationals for their…

18 hours ago

The street lights in Leicester City cannot be turned off due to a cyber attack

A cyber attack on Leicester City Council resulted in certain street lights remaining illuminated all…

18 hours ago

North Korea-linked APT groups target South Korean defense contractors

The National Police Agency in South Korea warns that North Korea-linked threat actors are targeting…

1 day ago

U.S. Gov imposed Visa restrictions on 13 individuals linked to commercial spyware activity

The U.S. Department of State imposed visa restrictions on 13 individuals allegedly linked to the…

2 days ago

This website uses cookies.