Authored by Fernando Ruiz
McAfee Cellular Analysis Staff recognized an Android backdoor applied with Xamarin, an open-source framework that permits constructing Android and iOS apps with .NET and C#. Dubbed Android/Xamalicious it tries to realize accessibility privileges with social engineering after which it communicates with the command-and-control server to guage whether or not or to not obtain a second-stage payload that’s dynamically injected as an meeting DLL at runtime degree to take full management of the gadget and probably carry out fraudulent actions reminiscent of clicking on advertisements, putting in apps amongst different actions financially motivated with out person consent.
The second stage payload can take full management of the contaminated gadget as a result of highly effective accessibility providers that have been already granted in the course of the first stage which additionally comprises features to self-update the primary APK which signifies that it has the potential to carry out any sort of exercise like a spyware and adware or banking trojan with out person interplay. Nonetheless, we recognized a hyperlink between Xamalicious and the ad-fraud app “Money Magnet” which routinely clicks advertisements, installs apps, and different actions to fraudulently generate income whereas customers that put in it might earn factors which are purported to be redeemable as a retail present card. Which means the builders behind these threats are financially motivated and drive ad-fraud subsequently this is perhaps one of many most important payloads of Xamalicious.
The utilization of the Xamarin framework allowed malware authors to remain lively and with out detection for a very long time, profiting from the construct course of for APK information that labored as a packer to cover the malicious code. As well as, malware authors additionally applied totally different obfuscation methods and customized encryption to exfiltrate knowledge and talk with the command-and-control server.
We’ve recognized about 25 totally different malicious apps that carry this menace. Some variants have been distributed on Google Play since mid-2020. The apps recognized on this report have been proactively eliminated by Google from Google Play forward of our reporting. McAfee is a member of the App Protection Alliance and an lively accomplice within the malware mitigation program, which goals to rapidly discover Doubtlessly Dangerous Purposes (PHAs) and cease them earlier than they ever make it onto Google Play. Android customers are protected by Google Play Shield, which may warn customers of recognized malicious apps on Android gadgets. McAfee Cellular Safety detects this menace as Android/Xamalicious.
Primarily based on the variety of installations these apps might have compromised not less than 327,000 gadgets from Google Play plus the installations coming from third-party markets that regularly produce new infections based mostly on the detection telemetry of McAfee purchasers world wide. This menace stays very lively.
Determine 1. “Depend Straightforward Calorie Calculator” was out there on Google Play on August 2022 and carries Android/Xamalicious
Android/Xamalicious trojans are apps associated to well being, video games, horoscope, and productiveness. Most of those apps are nonetheless out there for obtain in third-party marketplaces.
Beforehand we detected malware abusing Xamarin framework such because the open-sourced AndroSpy and forked variations of it, however Xamalicious is applied in another way. Technical particulars about Xamarin structure are effectively documented and element how .NET code is interpreted by Android utilizing Mono.
Acquiring Accessibility Companies
Let’s use the app “Numerology: Private horoscope & Quantity predictions” for instance. As soon as began it instantly requests the sufferer to allow accessibility providers for “right work” and gives instructions to activate this permission:
Determine 2. Tricking customers into granting accessibility providers permission
Customers must manually activate the accessibility providers after a number of OS warnings reminiscent of the next on the accessibility choices:
Determine 3. Accessibility providers configuration immediate highlights the dangers of this permission.
The place is the malicious code?
This isn’t the normal Java code or native ELF Android utility, the malware module was written initially in .NET and compiled right into a dynamic hyperlink library (DLL). Then it’s LZ4 compressed, and it is perhaps embedded right into a BLOB file, or straight out there within the /assemblies listing on the APK construction. This code is loaded then by a local library (ELF) or by the DEX file at runtime degree. In easy phrases, which means in some samples the reversing of the DLL assemblies is simple whereas in others it requires further steps to unpack them.
The malicious code is often out there in two totally different meeting information within the /assemblies listing on the apk. Normally, file names are core.dll and a <package-specific>.dll.
Some malware variants has obfuscated the DLL assemblies to keep away from evaluation and reversing of the malicious code whereas others hold the unique code out there.
Determine 4. Core.dll and GoogleService.dll include malicious code.
Communication with the command-and-control server
As soon as accessibility permissions are granted the malware initiates communication with the malicious server to dynamically load a second-stage payload.
Determine 5. App execution and communication with the malicious server
Gather Gadget Info
Android/Xamalicious collects a number of gadget knowledge together with the listing of put in purposes obtained through system instructions to find out if the contaminated sufferer is an efficient goal for the second stage payload. The malware can accumulate location, provider, and community info amongst gadget rooting standing, adb connectivity configuration, as an illustration, if the gadget is linked through ADB or is rooted, the C2 is not going to present a second-stage payload DLL for obtain.
Technique/Command | Description |
DevInfo | {Hardware} and gadget info that features:
|
GeoInfo | Location of the gadget based mostly on IP handle, the malware contacts providers reminiscent of api.myip.com to confirm the gadget location and ISP knowledge.
FraudScore: Self-protection to establish if the gadget isn’t an actual person |
EmuInfo | It lists all adbProperties that in an actual gadget are round 640 properties. This listing is encoded as a string param in URL encoded format.
This knowledge could also be used to determinate if the affected consumer is an actual gadget or emulator because it comprises params reminiscent of:
|
RootInfo | After attempting to establish if the gadget is rooted or not with a number of methods the output is consolidated on this command |
Packages | It makes use of the system instructions “pm listing packages -s” and “pm listing packages -3” to listing system and put in apps on the gadget. |
Accessibility | It gives the standing if accessibility providers permissions are granted or not |
GetURL | This command solely gives the Android Id and it’s a request for the second-stage payload. The C2 evaluates the supplied consumer request and returns a standing and an encrypted meeting DLL. |
Information Encryption in JWT
To evade evaluation and detection, malware authors encrypted all communication and knowledge transmitted between the C2 and the contaminated gadget, not solely protected by HTTPS, it’s encrypted as a JSON Internet Encryption (JWE) token utilizing RSA-OAEP with a 128CBC-HS256 algorithm nonetheless the RSA key values utilized by the Xamalicious are hardcoded within the decompiled malicious DLL so decryption of transmitted info is feasible if C2 infrastructure is on the market in the course of the evaluation.
Within the Ship() operate Android/Xamalicious first prepares the acquired object, often a JSON construction calling the operate encrypt() which creates the JWT utilizing a hardcoded RSA key. So the info is exfiltrated totally encrypted to the malware host pointing to the trail “/Updater” through HTTP POST technique.
Then it waits for the C2 response and passes it to the decrypt() operate which has a hardcoded RSA personal key to correctly decrypt the acquired command which could include a second stage payload for the “getURL” command.
Encrypt Technique:
Determine 6. Encrypt operate with hardcoded RSA Key values as XML string
The decryption technique can be hardcoded into malware which allowed the analysis group to intercept and decrypt the communication from the C2 utilizing the RSA key values supplied as XML string it’s doable to construct a certificates with the parameters to decrypt the JWE tokens content material.
C2 analysis
Collected knowledge is transmitted to the C&C to find out if the gadget is a correct goal to obtain a second-stage payload. The self-protection mechanism of the malware authors goes past conventional emulation detection and nation code operator limitations as a result of on this case, the command-and-control server is not going to ship the second stage payload if the gadget is rooted or linked as ADB through USB or doesn’t have a SIM card amongst a number of different surroundings validations.
DLL Customized Encryption
With the getURL command, the contaminated consumer requests the malicious payload, if the C&C Server determines that the gadget is “Okay” to obtain the malicious library it can encrypt a DLL with Superior encryption commonplace (AES) in Cipher block chaining (CBC) utilizing a customized key for the consumer that requested it based mostly on the gadget id and different parameters defined under to decrypt the code because it’s a symmetric encryption technique, the identical key works for encryption and decryption of the payload.
Delivers the Payload in JWT
The encrypted DLL is inserted as a part of the HTTP response within the encrypted JSON Internet Token “JWT”. Then the consumer will obtain the token, decrypt it, after which decrypt the ‘url’ parm with AES CBC and a customized key.
The AES key used to decrypt the meeting is exclusive per contaminated gadget and its string of 32 chars of size comprises appended the gadget ID, model, mannequin, and a hardcoded padding of “1” as much as 32 chars of size.
As an example, if the gadget ID is 0123456ABCDEF010 and the affected gadget is a Pixel 5, then the AES secret’s: “0123456ABCDEF010googlePixel 5111”
Which means the DLL has a number of layers of encryption.
- It’s a HTTPS protected.
- It’s encrypted as a JWE Token utilizing RSA-OAEP with a 128CBC-HS256 algorithm.
- URL parameter that comprises the DLL is encrypted with AES and encoded as base64
All these efforts are associated to hiding the payload and attempting to remain underneath the radar the place this menace had relative success since some variants may need been lively years in the past with out AV detections.
DLL Injected
Xamalicious will title this DLL “cache.bin” and retailer it within the native system to lastly dynamically load it utilizing the Meeting.Load technique.
As soon as the second stage payload has been loaded the gadget will be totally compromised as a result of as soon as accessibility permissions are granted, it will probably obverse and work together with any exercise opening a backdoor to any sort of malicious exercise.
In the course of the evaluation, the downloaded second stage payload contained a DLL with the category “MegaSDKXE” which was obfuscated and incomplete most likely as a result of the C2 didn’t obtain the anticipated params to supply the whole malicious second stage that is perhaps restricted to a particular provider, language, app put in, location, time zone or unknown situations of the affected gadget, nonetheless, we will guarantee that it is a high-risk backdoor that leaves the chance to dynamically execute any command on the affected gadget not restricted to spying, impersonation or as a financially motivated malware.
Money Magnet Advert-Fraud and Xamalicious
One of many Xamalicious samples detected by McAfee Cellular generic signatures was “LetterLink” (com.regaliusgames.llinkgame) which was out there on Google Play on the finish of 2020, with a e-book icon. It was poorly described as a hidden model of “Money Magnet”: An app that performs ad-fraud with automated clicker exercise, apps downloads, and different duties that result in monetization for affiliate marketing online. This utility provides customers factors which are purported to be redeemable by retail present playing cards or cryptocurrency.
Determine 8a. LetterLink login web page after operating the app for the primary time.
Determine 8b. LetterLink settlement for Money Magnet
Initially printed in 2019 on Google Play, “Money Magnet” (com.uicashmagnet) was described as a passive revenue utility providing customers to earn as much as $30 USD monthly operating automated advertisements. Because it was eliminated by Google the authors then infiltrated LetterLink and extra just lately “Dots: One Line Connector” (com.orlovst.dots) that are hidden variations of the identical ad-fraud scheme.
Determine 9. LetterLink Icon that hides Money Magnet
“LetterLink” performs a number of Xamalicious actions because it comprises the “core.dll” library, it connects to the identical C2 server, and it makes use of the identical hardcoded personal RSA certificates to construct the JWE encrypted tokens which give a non-repudiation proof that the builders of Money Magnet are behind Xamalicious.
Determine 10. Money Magnet infiltrated the app as a Recreation, out there till the tip of 2023
“Dots: One Line Connector” app isn’t a recreation, the screenshot printed by Google Play doesn’t correspond to the applying habits as a result of as soon as it’s began it simply asks for authentication credentials with none emblem or reference to Money Magnet. “Dots” doesn’t include the identical DLLs as its predecessor, nonetheless the communication with the C2 is analogous utilizing the identical RSA key parameters. We reported this app to Google and so they promptly eliminated it from Google Play.
Affected Customers
Primarily based on our telemetry we noticed that extra affected customers are within the American continent with probably the most exercise within the USA, Brazil, and Argentina. In Europe, purchasers additionally reported the an infection, particularly within the UK, Spain, and Germany.
Determine 11. McAfee detections Android/Xamalicious world wide
Conclusion
Android purposes written in non-java code with frameworks reminiscent of Flutter, react native and Xamarin can present an extra layer of obfuscation to malware authors that deliberately choose these instruments to keep away from detection and attempt to keep underneath the radar of safety distributors and hold their presence on apps markets.
Keep away from utilizing apps that require accessibility providers until there’s a real want to be used. If a brand new app tries to persuade you to activate accessibility providers claiming that it’s required with no actual and affordable purpose and requesting to disregard the operative system warning, then it’s a crimson flag.
The second stage payload would possibly take management of the gadget as a result of accessibility permissions are granted so every other permission or motion can then be carried out by the malware if these directions are supplied within the injected code.
As a result of it’s tough for customers to actively cope with all these threats, we strongly suggest that customers set up safety software program on their gadgets and all the time hold updated. By utilizing McAfee Cellular Safety merchandise, customers can additional safeguard their gadgets and mitigate the dangers linked with these sorts of malware, offering a safer and safer expertise.
Android/Xamalicious Samples Distributed on Google Play:
Package deal Identify | App Identify | Installs |
com.anomenforyou.essentialhoroscope | Important Horoscope for Android | 100,000 |
com.littleray.skineditorforpeminecraft | 3D Pores and skin Editor for PE Minecraft | 100,000 |
com.vyblystudio.dotslinkpuzzles | Brand Maker Professional | 100,000 |
com.autoclickrepeater.free | Auto Click on Repeater | 10,000 |
com.lakhinstudio.counteasycaloriecalculator | Depend Straightforward Calorie Calculator | 10,000 |
com.muranogames.easyworkoutsathome | Sound Quantity Extender | 5,000 |
com.regaliusgames.llinkgame | LetterLink | 1,000 |
com.Ushak.NPHOROSCOPENUMBER | NUMEROLOGY: PERSONAL HOROSCOPE &NUMBER PREDICTIONS | 1,000 |
com.browgames.stepkeepereasymeter | Step Keeper: Straightforward Pedometer | 500 |
com.shvetsStudio.trackYourSleep | Observe Your Sleep | 500 |
com.devapps.soundvolumebooster | Sound Quantity Booster | 100 |
com.Osinko.HoroscopeTaro | Astrological Navigator: Each day Horoscope & Tarot | 100 |
com.Potap64.universalcalculator | Common Calculator | 100 |
Indicators of Compromise
SHA256 | Package deal Identify |
63cb930ab83afe80d40ba620a0f2ed5e8a55cceec23bdad919bf9dfa3d8c6e5b | com.android.accessibility.service |
7149acb072fe3dcf4dcc6524be68bd76a9a2896e125ff2dddefb32a4357f47f6 | com.android.accessibility.service |
a5de2dc4e6005e75450a0df0ea83816996092261f7dac30b5cf909bf6daaced0 | com.android.accessibility.service |
22803693c21ee17667d764dd226177160bfc2a5d315e66dc355b7366b01df89b | com.android.callllogbacup |
efbb63f9fa17802f3f9b3a0f4236df268787e3d8b7d2409d1584d316dabc0cf9 | com.android.dreammusic |
e801844333031b7fd4bd7bb56d9fb095f0d89eb89d5a3cc594a4bed24f837351 | com.android.statementsandservices |
6316edebe5995fc3e2715a44b78dcb2ec4f0409234851ee5dbb20c0fb60d1bf0 | com.android.tvresources |
d3833f608e476ed24382bf3991cec503ebc7124481758bdb5e46390b367c1210 | com.android.ui.clock |
5fffb10487e718634924552b46e717bbcbb6a4f9b1fed02483a6517f9acd2f61 | com.android.ui.clock |
81a9a6c86b5343a7170ae5abd15f9d2370c8282a4ed54d8d28a3e1ab7c8ae88e | com.android.ui.clock |
ac9bb11cf71b11d3d50620660b56f1612e10e4ee9f7fc5637c0c281a688ef978 | com.android.venting |
9c646516dd189cab1b6ced59bf98ade42e19c56fc075e42b85d597449bc9708b | com.android.model.shared |
a4e7279daf2261d74e108be9ea46373777adb209de06d229cee1f77f7196bfdf | com.android.model.shared |
177ff9e281f96bf08ff9724e0c92cecc7538692cadc217cc2770c668b451f2dc | com.android.model.shared |
488942923780887114471dd0114ffb144deb8054773351b2b2aac3c974c569d8 | com.android.wall.lifetick |
dfdca848aecb3439b8c93fd83f1fd4036fc671e3a2dcae9875b4648fd26f1d63 | com.anomenforyou.essentialhoroscope |
e7ffcf1db4fb13b5cb1e9939b3a966c4a5a894f7b1c1978ce6235886776c961e | com.autoclickrepeater.free |
8927ff14529f03cbb2ebf617c298f291c2d69be44a8efa4e0406dea16e53e6f9 | com.autoclickrepeater.free |
117fded1dc51eff3788f1a3ec2b941058ce32760acf61a35152be6307f6e2052 | com.browgames.stepkeepereasymeter |
28a4ae5c699a7d96e963ca5ceec304aa9c4e55bc661e16c194bdba9a8ad847b7 | com.devapps.soundvolumebooster |
b0b9a8e9ec3d0857b70464617c09ffffce55671b227a9fdbb178be3dbfebe8ed | com.kolomia.mineskineditor |
899b0f186c20fdbfe445b4722f4741a5481cd3cbcb44e107b8e01367cccfdda3 | com.lakhinstudio.counteasycaloriecalculator |
e52b65fdcb77ed4f5989a69d57f1f53ead58af43fa4623021a12bc11cebe29ce | com.lakhinstudio.counteasycaloriecalculator |
e694f9f7289677adaf2c2e93ba0ac24ae38ab9879a34b86c613dd3c60a56992d | com.littleray.skineditorforpeminecraft |
19ffe895b0d1be65847e01d0e3064805732c2867ce485dfccc604432faadc443 | com.muranogames.easyworkoutsathome |
6a3455ff881338e9337a75c9f2857c33814b7eb4060c06c72839b641b347ed36 | com.Osinko.HoroscopeTaro |
e6668c32b04d48209d5c71ea96cb45a9641e87fb075c8a7697a0ae28929913a6 | com.Potap64.universalcalculator |
6953ba04233f5cf15ab538ae191a66cb36e9e0753fcaeeb388e3c03260a64483 | com.regaliusgames.llinkgame |
f52917321b1010c0b145f699531947c84b26d63e91a5a67bf5131ba8904e1326 | com.shvetsstudio.newmapsforminecraftpe |
cb8d4ae27b64c56831a4e9bb5f1d53a3a72eaea369ab7b40851009ed577d2b14 | com.shvetsStudio.trackYourSleep |
01c56911c7843098777ec375bb5b0029379b0457a9675f149f339b7db823e996 | com.shvetsStudio.trackYourSleep |
f42e79c4dc6b1573731610a1135cb0a71152e869c598215f0db09958f2d761f5 | com.skladainc.phonedetectiveclaptofind |
e55408ef4f10715e7a521e95df038114a75f865f5b2ac3c1dcfee2261724b5df | com.skladainc.phonedetectiveclaptofind |
cc439631c09763003b92b80bbea2ff0f5d764694575ed7a9be155fbc420753db | com.skladainc.phonedetectiveclaptofind |
3201785a7de8e37e5d12e8499377cfa3a5b0fead6667e6d9079d8e99304ce815 | com.turovskyi.magicofnumbers |
acb5de2ed2c064e46f8d42ee82feabe380364a6ef0fbfeb73cf01ffc5e0ded6b | com.Ushak.NPHOROSCOPENUMBER |
9b4dc1e80a4f4c798d0d87a52f52e28700b5b38b38a532994f70830f24f867ba | com.Ushak.NPHOROSCOPENUMBER |
1bfc02c985478b21c6713311ca9108f6c432052ea568458c8bd7582f0a825a48 | com.vyblystudio.dotslinkpuzzles |