New technique allows attackers to hide stealthy Android malware in images

The attack could be used to distribute malware through applications that appear harmless, researchers said

A new technique that allows attackers to hide encrypted malicious Android applications inside images could be used to evade detection by antivirus products and possibly Google Play's own malware scanner.

The attack was developed by Axelle Apvrille, a researcher at Fortinet, and reverse engineer Ange Albertini, who presented their proof-of-concept at the Black Hat Europe security conference in Amsterdam Thursday.

It's based on a technique devised by Albertini dubbed AngeCryption that allows controlling both the input and the output of a file encryption operation using the Advanced Encryption Standard (AES) by taking advantage of the properties of some file formats that allow files to remain valid despite having junk data appended to them.

AngeCryption, which was implemented as a Python script available for download on Google Code, allows the user to choose an input and an output file and makes the necessary modifications so that when the input file is encrypted with a specified key using AES in cipher-block chaining (CBC) mode, it produces the desired output file.

Apvrille and Albertini took the idea further and applied it to APK (Android application package) files. They created a proof-of-concept wrapping application that simply displays a PNG image of Star Wars character Anakin Skywalker. However, the app can also decrypt the image with a particular key in order to produce a second APK file that it can then install.

In the researchers' demonstration, the APK hidden inside the image was designed to display a picture of Darth Vader, but a real attacker could use a malicious application instead to steal text messages, photos, contacts, or other data.

During the demonstration, Android displayed a permission request when the wrapper application tried to install the decrypted APK file, but this can be bypassed using a method called DexClassLoader so that the user doesn't see anything, Apvrille said. The image wouldn't even have to be included in the wrapper application and could be downloaded from a remote server after installation, she said.

In order for the attack to work, some data needs to be appended at the end of the original application, but the APK format, which is derived from ZIP, does not allow appended data after a marker called the End of Central Directory (EOCD), which signals the end of the file.

However, the researchers found that adding a second EOCD after the appended data tricks Android into accepting the file as valid. According to Apvrille, this should not happen and is the result of an error in Android's APK parser.

The attack works on Android 4.4.2, the latest version of the OS, but the Android security team has been notified and is developing a fix, Apvrille said.

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 situation with the distribution of Android security updates is better than it was three years ago, but this vulnerability will probably remain active on many phones for one or two years, Apvrille said.

The researchers released their proof-of-concept code on Github following their presentation Thursday and will also publish a paper.

Join the CSO newsletter!

Error: Please check your email address.

Tags FortinetGooglesecuritymobile securityencryptionExploits / vulnerabilitiesmalware

More about AdvancedAdvanced Encryption StandardCBCFortinetGoogle

Show Comments

Featured Whitepapers

Editor's Recommendations

Solution Centres

Stories by Lucian Constantin

Latest Videos

  • 150x50

    CSO Webinar: Will your data protection strategy be enough when disaster strikes?

    Speakers: - Paul O’Connor, Engagement leader - Performance Audit Group, Victorian Auditor-General’s Office (VAGO) - Nigel Phair, Managing Director, Centre for Internet Safety - Joshua Stenhouse, Technical Evangelist, Zerto - Anthony Caruana, CSO MC & Moderator

    Play Video

  • 150x50

    CSO Webinar: The Human Factor - Your people are your biggest security weakness

    ​Speakers: David Lacey, Researcher and former CISO Royal Mail David Turner - Global Risk Management Expert Mark Guntrip - Group Manager, Email Protection, Proofpoint

    Play Video

  • 150x50

    CSO Webinar: Current ransomware defences are failing – but machine learning can drive a more proactive solution

    Speakers • Ty Miller, Director, Threat Intelligence • Mark Gregory, Leader, Network Engineering Research Group, RMIT • Jeff Lanza, Retired FBI Agent (USA) • Andy Solterbeck, VP Asia Pacific, Cylance • David Braue, CSO MC/Moderator What to expect: ​Hear from industry experts on the local and global ransomware threat landscape. Explore a new approach to dealing with ransomware using machine-learning techniques and by thinking about the problem in a fundamentally different way. Apply techniques for gathering insight into ransomware behaviour and find out what elements must go into a truly effective ransomware defence. Get a first-hand look at how ransomware actually works in practice, and how machine-learning techniques can pick up on its activities long before your employees do.

    Play Video

  • 150x50

    CSO Webinar: Get real about metadata to avoid a false sense of security

    Speakers: • Anthony Caruana – CSO MC and moderator • Ian Farquhar, Worldwide Virtual Security Team Lead, Gigamon • John Lindsay, Former CTO, iiNet • Skeeve Stevens, Futurist, Future Sumo • David Vaile - Vice chair of APF, Co-Convenor of the Cyberspace Law And Policy Community, UNSW Law Faculty This webinar covers: - A 101 on metadata - what it is and how to use it - Insight into a typical attack, what happens and what we would find when looking into the metadata - How to collect metadata, use this to detect attacks and get greater insight into how you can use this to protect your organisation - Learn how much raw data and metadata to retain and how long for - Get a reality check on how you're using your metadata and if this is enough to secure your organisation

    Play Video

  • 150x50

    CSO Webinar: How banking trojans work and how you can stop them

    CSO Webinar: How banking trojans work and how you can stop them Featuring: • John Baird, Director of Global Technology Production, Deutsche Bank • Samantha Macleod, GM Cyber Security, ME Bank • Sherrod DeGrippo, Director of Emerging Threats, Proofpoint (USA)

    Play Video

More videos

Blog Posts

Market Place