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

Czech Republic accuses China’s APT31 of a cyberattack on its Foreign Ministry

The Czech government condemned China after linking cyber espionage group APT31 to a cyberattack on…

11 hours ago

New PumaBot targets Linux IoT surveillance devices

PumaBot targets Linux IoT devices, using SSH brute-force attacks to steal credentials, spread malware, and…

15 hours ago

App Store Security: Apple stops $2B in fraud in 2024 alone, $9B over 5 years

Apple blocked over $9B in fraud in 5 years, including $2B in 2024, stopping scams…

16 hours ago

Crooks use a fake antivirus site to spread Venom RAT and a mix of malware

Researchers found a fake Bitdefender site spreading the Venom RAT by tricking users into downloading…

20 hours ago

Iranian Man pleaded guilty to role in Robbinhood Ransomware attacks<gwmw style="display:none;"></gwmw>

Iranian man pleads guilty to role in Baltimore ransomware attack tied to Robbinhood, admitting to…

21 hours ago

DragonForce operator chained SimpleHelp flaws to target an MSP and its customers

Sophos warns that a DragonForce ransomware operator chained three vulnerabilities in SimpleHelp to target a…

1 day ago