{"id":119072,"date":"2020-10-08T19:03:57","date_gmt":"2020-10-08T19:03:57","guid":{"rendered":"https:\/\/news.microsoft.com\/?p=439430"},"modified":"2020-10-08T19:03:57","modified_gmt":"2020-10-08T19:03:57","slug":"sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware","status":"publish","type":"post","link":"https:\/\/sickgaming.net\/blog\/2020\/10\/08\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware\/","title":{"rendered":"Sophisticated new Android malware marks the latest evolution of mobile ransomware"},"content":{"rendered":"<p>Attackers are persistent and motivated to continuously evolve \u2013 and no platform is immune. That is why Microsoft has been working to extend its industry-leading endpoint protection capabilities beyond Windows. The addition of <a href=\"https:\/\/techcommunity.microsoft.com\/t5\/microsoft-defender-for-endpoint\/microsoft-defender-for-endpoint-adds-depth-and-breadth-to-threat\/ba-p\/1695824\" target=\"_blank\" rel=\"noopener noreferrer\">mobile threat defense<\/a> into these capabilities means that Microsoft Defender for Endpoint (previously Microsoft Defender Advanced Threat Protection) now delivers protection on all major platforms.<\/p>\n<p>Microsoft\u2019s mobile threat defense capabilities further enrich the visibility that organizations have on threats in their networks, as well as provide more tools to detect and respond to threats across domains and across platforms. Like all of Microsoft\u2019s security solutions, these new capabilities are likewise backed by a global network of threat researchers and security experts whose deep understanding of the threat landscape guide the continuous innovation of security features and ensure that customers are protected from ever-evolving threats.<\/p>\n<p>For example, we found a piece of a particularly sophisticated Android ransomware with novel techniques and behavior, exemplifying the rapid evolution of mobile threats that we have also observed on other platforms. The mobile ransomware is the latest variant of a ransomware family that\u2019s been in the wild for a while but has been evolving non-stop. This ransomware family is known for being hosted on arbitrary websites and circulated on online forums using various social engineering lures, including masquerading as popular apps, cracked games, or video players. The new variant caught our attention because it\u2019s an advanced malware with unmistakable malicious characteristic and behavior and yet manages to evade many available protections, registering a low detection rate against security solutions.<\/p>\n<p>As with most Android ransomware, this new threat doesn\u2019t actually block access to files by encrypting them. Instead, it blocks access to devices by displaying a screen that appears over every other window, such that the user can\u2019t do anything else. The said screen is the ransom note, which contains threats and instructions to pay the ransom.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-92039\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/10\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware.png\" alt=\"Screenshot of mobile ransom note in Russian language\" width=\"400\" height=\"711\"><\/p>\n<p><em>Figure 1. Sample ransom note used by older ransomware variants<\/em><\/p>\n<p>What\u2019s innovative about this ransomware is how it displays its ransom note. In this blog, we\u2019ll detail the innovative ways in which this ransomware surfaces its ransom note using Android features we haven\u2019t seen leveraged by malware before, as well as incorporating an open-source machine learning module designed for context-aware cropping of its ransom note.<\/p>\n<h2>New scheme, same goal<\/h2>\n<p>In the past, Android ransomware used a special permission called \u201cSYSTEM_ALERT_WINDOW\u201d to display their ransom note. Apps that have this permission can draw a window that belongs to the system group and can\u2019t be dismissed. No matter what button is pressed, the window stays on top of all other windows. The notification was intended to be used for system alerts or errors, but Android threats misused it to force the attacker-controlled UI to fully occupy the screen, blocking access to the device. Attackers create this scenario to persuade users to pay the ransom so they can gain back access to the device.<\/p>\n<p>To catch these threats, security solutions used heuristics that focused on detecting this behavior. Google later implemented <a href=\"https:\/\/www.androidpolice.com\/2019\/03\/16\/android-q-steps-up-the-fight-up-against-overlay-based-malware\/\" target=\"_blank\" rel=\"noopener noreferrer\">platform-level changes<\/a> that practically eliminated this attack surface. These changes include:<\/p>\n<ol>\n<li>Removing the SYSTEM_ALERT_WINDOW error and alert window types, and introducing a few other types as replacement<\/li>\n<li>Elevating the permission status of SYSTEM_ALERT_WINDOW to special permission by putting it into the \u201cabove dangerous\u201d category, which means that users have to go through many screens to approve apps that ask for permission, instead of just one click<\/li>\n<li>Introducing an overlay kill switch on Android 8.0 and later that users can activate anytime to deactivate a system alert window<\/li>\n<\/ol>\n<p>To adapt, Android malware evolved to misusing other features, but these aren\u2019t as effective. For example, some strains of ransomware abuse accessibility features, a method that could easily alarm users because accessibility is a special permission that requires users to go through several screens and accept a warning that the app will be able to monitor activity via accessibility services. Other ransomware families use infinite loops of drawing non-system windows, but in between drawing and redrawing, it\u2019s possible for users to go to settings and uninstall the offending app.<\/p>\n<p>The new Android ransomware variant overcomes these barriers by evolving further than any Android malware we\u2019ve seen before. To surface its ransom note, it uses a series of techniques that take advantage of the following components on Android:<\/p>\n<ol>\n<li>The \u201ccall\u201d notification, among several categories of notifications that Android supports, which requires immediate user attention.<\/li>\n<li>The \u201conUserLeaveHint()\u201d callback method of the Android Activity (i.e., the typical GUI screen the user sees) is called as part of the activity lifecycle when the activity is about to go into the background as a result of user choice, for example, when the user presses the Home key.<\/li>\n<\/ol>\n<p>The malware connects the dots and uses these two components to create a special type of notification that triggers the ransom screen via the callback.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-92025\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/10\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware-1.png\" alt=\"Screenshot of malware code\" width=\"902\" height=\"254\"><\/p>\n<p><em>Figure 2. The notification with full intent and set as \u201ccall\u2019 category<\/em><\/p>\n<p>As the code snippet shows, the malware creates a notification builder and then does the following:<\/p>\n<ol>\n<li>setCategory(\u201ccall\u201d) \u2013 This means that the notification is built as a very important notification that needs special privilege.<\/li>\n<li>setFullScreenIntent() \u2013 This API wires the notification to a GUI so that it pops up when the user taps on it. At this stage, half the job is done for the malware. However, the malware wouldn\u2019t want to depend on user interaction to trigger the ransomware screen, so, it adds another functionality of Android callback:<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-92049\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/10\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware-2.png\" alt width=\"900\" height=\"602\"><\/p>\n<p><em>Figure 3. The malware overriding onUserLeaveHint<\/em><\/p>\n<p>As the code snippet shows, the malware overrides the onUserLeaveHint() callback function of Activity class. The function <em>onUserLeaveHint()<\/em> is called whenever the malware screen is pushed to background, causing the in-call Activity to be automatically brought to the foreground. Recall that the malware hooked the <em>RansomActivity<\/em> intent with the notification that was created as a \u201ccall\u201d type notification. This creates a chain of events that triggers the automatic pop-up of the ransomware screen without doing infinite redraw or posing as system window.<\/p>\n<h2>Machine learning module indicates continuous evolution<\/h2>\n<p>As mentioned, this ransomware is the latest variant of a malware family that has undergone several stages of evolution. The knowledge graph below shows the various techniques this ransomware family has been seen using, including abusing the system alert window, abusing accessibility features, and, more recently, abusing notification services.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-92027\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/10\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware-3.png\" alt=\"Knowledge graph showing techniques used by the Android rasomware family\" width=\"1393\" height=\"994\"><\/p>\n<p><em>Figure 4. Knowledge graph of techniques used by ransomware family<\/em><\/p>\n<p>This ransomware family\u2019s long history tells us that its evolution is far from over. We expect it to churn out new variants with even more sophisticated techniques. In fact, recent variants contain code forked from an open-source machine learning module used by developers to automatically resize and crop images based on screen size, a valuable function given the variety of Android devices.<\/p>\n<p>The frozen TinyML model is useful for making sure images fit the screen without distortion. In the case of this ransomware, using the model would ensure that its ransom note\u2014typically fake police notice or explicit images supposedly found on the device\u2014would appear less contrived and more believable, increasing the chances of the user paying for the ransom.<\/p>\n<p>The library that uses tinyML is not yet wired to the malware\u2019s functionalities, but its presence in the malware code indicates the intention to do so in future variants. We will continue to monitor this ransomware family to ensure customers are protected and to share our findings and insights to the community for broad protection against these evolving mobile threats.<\/p>\n<h2>Protecting organizations from threats across domains and platforms<\/h2>\n<p>Mobile threats continue to rapidly evolve, with attackers continuously attempting to sidestep technological barriers and creatively find ways to accomplish their goal, whether financial gain or finding an entry point to broader network compromise.<\/p>\n<p>This new mobile ransomware variant is an important discovery because the malware exhibits behaviors that have not been seen before and could open doors for other malware to follow. It reinforces the need for comprehensive defense powered by broad visibility into attack surfaces as well as domain experts who track the threat landscape and uncover notable threats that might be hiding amidst massive threat data and signals.<\/p>\n<p>Microsoft Defender for Endpoint on Android, now generally available, extends Microsoft\u2019s industry-leading endpoint protection to Android. It detects this ransomware (AndroidOS\/MalLocker.B), as well as other malicious apps and files using cloud-based protection powered by deep learning and heuristics, in addition to content-based detection. It also protects users and organizations from other mobile threats, such as mobile phishing, unsafe network connections, and unauthorized access to sensitive data. Learn more about our <a href=\"https:\/\/techcommunity.microsoft.com\/t5\/microsoft-defender-for-endpoint\/microsoft-defender-for-endpoint-adds-depth-and-breadth-to-threat\/ba-p\/1695824\" target=\"_blank\" rel=\"noopener noreferrer\">mobile threat defense capabilities<\/a> in <a href=\"https:\/\/techcommunity.microsoft.com\/t5\/microsoft-defender-atp\/announcing-microsoft-defender-atp-for-android\/ba-p\/1480787\" target=\"_blank\" rel=\"noopener noreferrer\">Microsoft Defender for Endpoint<\/a> on Android.<\/p>\n<p>Malware, phishing, and other threats detected by <a href=\"https:\/\/www.microsoft.com\/microsoft-365\/windows\/microsoft-defender-atp?rtc=1\" target=\"_blank\" rel=\"noopener noreferrer\">Microsoft Defender for Endpoint<\/a> are reported to the Microsoft Defender Security Center, allowing SecOps to investigate mobile threats along with endpoint signals from Windows and other platforms using Microsoft Defender for Endpoint\u2019s rich set of tools for detection, investigation, and response.<\/p>\n<p>Threat data from endpoints are combined with signals from email and data, identities, and apps in <a href=\"https:\/\/www.microsoft.com\/en-us\/security\/business\/threat-protection\/integrated-threat-protection\" target=\"_blank\" rel=\"noopener noreferrer\">Microsoft 365 Defender<\/a> (previously Microsoft Threat Protection), which orchestrates detection, prevention, investigation, and response across domains, providing coordinated defense. Microsoft Defender for Endpoint on Android further enriches organizations\u2019 visibility into malicious activity, empowering them to comprehensively prevent, detect, and respond to against attack sprawl and cross-domain incidents.<\/p>\n<h2>Technical analysis<\/h2>\n<h3>Obfuscation<\/h3>\n<p>On top of recreating ransomware behavior in ways we haven\u2019t seen before, the Android malware variant uses a new obfuscation technique unique to the Android platform. One of the tell-tale signs of an obfuscated malware is the absence of code that defines the classes declared in the manifest file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-92028\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/10\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware-4.png\" alt=\"Malware code showing manifest file\" width=\"1378\" height=\"592\"><\/p>\n<p><em>Figure 5. Manifest file<\/em><\/p>\n<p>The <em>classes.dex<\/em> has implementation for only two classes:<\/p>\n<ol>\n<li>The main application class <em>gCHotRrgEruDv<\/em>, which is involved when the application opens<\/li>\n<li>A helper class that has definition for custom encryption and decryption<\/li>\n<\/ol>\n<p>This means that there\u2019s no code corresponding to the services declared in the manifest file: <em>Main Activity<\/em>, <em>Broadcast Receivers<\/em>, and<em> Background<\/em>. How does the malware work without code for these key components? As is characteristic for obfuscated threats, the malware has encrypted binary code stored in the <em>Assets<\/em> folder:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-92029\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/10\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware-5.png\" alt=\"Screenshot of Assets folder with encrypted executable code\" width=\"502\" height=\"386\"><\/p>\n<p><em>Figure 6. Encrypted executable code in Assets folder<\/em><\/p>\n<p>When the malware runs for the first time, the static block of the main class is run. The code is heavily obfuscated and made unreadable through name mangling and use of meaningless variable names:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-92047 size-full\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/10\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware-6.png\" alt width=\"1378\" height=\"296\"><\/p>\n<p><em>Figure 7. Static block<\/em><\/p>\n<h3>Decryption with a twist<\/h3>\n<p>The malware uses an interesting decryption routine: the string values passed to the decryption function do not correspond to the decrypted value, they correspond to junk code to simply hinder analysis.<\/p>\n<p>On Android, an Intent is a software mechanism that allows users to coordinate the functions of different <em>Activities<\/em> to achieve a task. It\u2019s a messaging object that can be used to request an action from another app component.<\/p>\n<p>The <em>Intent<\/em> object carries a string value as \u201c<em>action<\/em>\u201d parameter. The malware creates an <em>Intent<\/em> inside the decryption function using the string value passed as the name for the <em>Intent<\/em>. It then decrypts a hardcoded encrypted value and sets the \u201c<em>action<\/em>\u201d parameter of the <em>Intent<\/em> using the <em>setAction<\/em> API. Once this <em>Intent<\/em> object is generated with the action value pointing to the decrypted content, the decryption function returns the <em>Intent<\/em> object to the callee. The callee then invokes the <em>getAction<\/em> method to get the decrypted content.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-92048\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/10\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware-7.png\" alt width=\"1354\" height=\"556\"><\/p>\n<p><em>Figure 8. Decryption function using the Intent object to pass the decrypted value<\/em><\/p>\n<h3>Payload deployment<\/h3>\n<p>Once the static block execution is complete, the Android Lifecycle callback transfers the control to the <em>OnCreate<\/em> method of the main class.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-92032\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/10\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware-8.png\" alt=\"Malware code showing onCreate method\" width=\"1348\" height=\"276\"><\/p>\n<p><em>Figure 9. onCreate method of the main class decrypting the payload<\/em><\/p>\n<p>Next, the malware-defined function <em>decryptAssetToDex<\/em> (a meaningful name we assigned during analysis) receives the string \u201c<em>CuffGmrQRT<\/em>\u201d as the first argument, which is the name of the encrypted file stored in the <em>Assets<\/em> folder.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-92033\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/10\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware-9.png\" alt=\"Malware code showing decryption of assets\" width=\"1378\" height=\"603\"><\/p>\n<p><em>Figure 10. Decrypting the assets<\/em><\/p>\n<p>After being decrypted, the asset turns into the .dex file. This is a notable behavior that is characteristic of this ransomware family.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-92034\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/10\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware-10.png\" alt=\"Comparison of code of Asset file before and after decryption\" width=\"1376\" height=\"572\"><\/p>\n<p><em>Figure 11. Asset file before and after decryption<\/em><\/p>\n<p>Once the encrypted executable is decrypted and dropped in the storage, the malware has the definitions for all the components it declared in the manifest file. It then starts the final detonator function to load the dropped .dex file into memory and triggers the main payload.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-92035\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/10\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware-11.png\" alt=\"Malware code showing loading of decrypted dex file\" width=\"1378\" height=\"451\"><\/p>\n<p><em>Figure 12. Loading the decrypted .dex file into memory and triggering the main payload<\/em><\/p>\n<h3>Main payload<\/h3>\n<p>When the main payload is loaded into memory, the initial detonator hands over the control to the main payload by invoking the method <em>XoqF<\/em> (which we renamed to <em>triggerInfection<\/em> during analysis) from the <em>gvmthHtyN<\/em> class (renamed to <em>PayloadEntry<\/em>).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-92036\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/10\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware-12.png\" alt=\"Malware code showing handover from initial module to main payload\" width=\"1378\" height=\"999\"><\/p>\n<p><em>Figure 13. Handover from initial module to the main payload<\/em><\/p>\n<p>As mentioned, the initial handover component called <em>triggerInfection<\/em> with an instance of <em>appObj<\/em> and a method that returns the value for the variable <em>config<\/em>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-92037\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/10\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware-13.png\" alt=\"Malware code showing definition of populateConfigMap\" width=\"1378\" height=\"384\"><\/p>\n<p><em>Figure 14. Definition of populateConfigMap, which loads the map with values<\/em><\/p>\n<p>Correlating the last two steps, one can observe that the malware payload receives the configuration for the following properties:<\/p>\n<ol>\n<li><em>number<\/em> \u2013 The default number to be send to the server (in case the number is not available from the device)<\/li>\n<li><em>api<\/em> \u2013 The API key<\/li>\n<li><em>url<\/em> \u2013 The URL to be used in WebView to display on the ransom note<\/li>\n<\/ol>\n<p>The malware saves this configuration to the shared preferences of the app data and then it sets up all the <em>Broadcast Receivers<\/em>. This action registers code components to get notified when certain system events happen. This is done in the function <em>initComponents<\/em>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-92038\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/10\/sophisticated-new-android-malware-marks-the-latest-evolution-of-mobile-ransomware-14.png\" alt=\"Malware code showing initializing broadcast receiver \" width=\"1378\" height=\"988\"><\/p>\n<p><em>Figure 15. Initializing the BroadcastReceiver against system events<\/em><\/p>\n<p>From this point on, the malware execution is driven by callback functions that are triggered on system events like connectivity change, unlocking the phone, elapsed time interval, and others.<\/p>\n<p><strong><em>Dinesh Venkatesan<\/em><\/strong><\/p>\n<p><em>Microsoft Defender Research<\/em><\/p>\n<h2><\/h2>\n","protected":false},"excerpt":{"rendered":"<p>Attackers are persistent and motivated to continuously evolve \u2013 and no platform is immune. That is why Microsoft has been working to extend its industry-leading endpoint protection capabilities beyond Windows. The addition of mobile threat defense into these capabilities means that Microsoft Defender for Endpoint (previously Microsoft Defender Advanced Threat Protection) now delivers protection on [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":119073,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[50,52],"class_list":["post-119072","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-news","tag-recent-news","tag-security"],"_links":{"self":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/119072","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/comments?post=119072"}],"version-history":[{"count":0,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/119072\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media\/119073"}],"wp:attachment":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media?parent=119072"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/categories?post=119072"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/tags?post=119072"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}