# SpyNote – An Android Snooper **[labs.k7computing.com/index.php/spynote-an-android-snooper/](https://labs.k7computing.com/index.php/spynote-an-android-snooper/)** By Baran S August 10, 2022 Threat actors are constantly using new tricks and tactics to target users across the globe. This blog is about SpyNote, an Android RAT targeting Indian Defense personnel. The [initial attack vector information was found on the newindianexpress website.](https://www.newindianexpress.com/cities/delhi/2022/jul/17/security-at-risk-whatsapp-malware-targeting-army-personnel-detected-2477529.html) Let’s now get into the details of how this SpyNote works. This RAT is propagated via WhatsApp with the name “CSO_SO on Deputation DRDO. **apk“.** Once the user falls prey to this RAT and installs this malicious “CSO_SO on Deputation **DRDO. apk”, this app pretends to be the genuine Adobe reader icon in the device app** drawer as shown in Figure 1. ----- Figure 1: Fake Adobe Reader icon of the malware Upon launching, this application opens a Google Drive URL that is hardcoded in the app’s “strings.xml” file and displays the images as shown in Figure 2. Google Drive URL hardcoded in the app’s “strings.xml” file as shown in Figure 3. ----- Figure 2: Images from Google Drive ----- Figure 3: Hardcoded Google Drive URL string ## Technical Analysis Figure 4 shows that this malware refers to services in the AndroidManifest.xml file but not defined in the classes.dex in the APK’s root folder. This indicates that the services’ classes or another dex containing the classes would be loaded in memory at run-time using any one of the dynamic loading techniques. Figure 4: Undefined Class Names in AndroidManifest.xml SpyNote sample which we analyzed employs the technique of using the “base application context” to the class “com.android.protector.ProtectApplication” as shown in Figure 5. Figure 5: AndroidManifest.XML showing base context to “com.android.protector.ProtectApplication” Hence, when the application’s launcher activity is triggered, “attachbasecontext” function from the class “com.android.protector.ProtectApplication” is executed and the other classes.dex (carried within the APK) are loaded and functions in those classes.dex files ----- are invoked using reflection and MultiDex support as shown in Figure 6 and 7. Figure 6: “attachbasecontext” using reflection to load the secondary dex files in the APK Figure 7: classLoader API loading secondary dex files using MultiDex support Looking at the logcat at runtime, with MultiDex support, secondary dex files are loaded as base.apk.classes1.zip and converted as executable ‘base.apk.classes1.odex’ as shown in Figure 8. Figure 8: The logcat image showing the base.apk.classes1.odex file at runtime ## Analyzing the Payload The payload file base.apk.classes1.zip as shown in Figure 9 has the references to services’ classes declared in the AndroidManifest.xml. ----- Figure 9: Defined Class Name from AndoridManifest.xml This malware collects location information like altitude, latitude, longitude, precision and even the speed at which the device is moving as shown in Figure 10. Figure 10: Collects the device location information SpyNote then proceeds to combine all the aforementioned data and compresses (using **gZIPOutputStream API) them before forwarding it to the C2 server as shown in Figure 11.** ----- Figure 11: DATA compression using gZIPOutputStream ## C2 Communication This RAT contacts the C2 server at IP 213.136.80[.]208, which is hardcoded in the “strings.xml” file (refer Figure 3). Figure 12 shows the connection established with the C2. Figure 12: TCP connection with the C2 server After the connection is established, the malware sends the gzip compressed data to the C2 as evident from the network packet’s header in Figure 13. ----- Figure 13: gzip data sent by the device after establishing the connection with the C2 Server The decompressed content of the data is shown below in Figure 14. Figure 14: Decompressed gzip data showing IP address ## Decode packets from the C2 The C2 responds by sending a series of compressed data, which when decompressed, is revealed to be system commands and the related APK payload as shown in Figure 15. In our case, the APK was extracted using Cyberchef. ----- Figure 15: Getting commands and APK file from C&C server We analyzed the C&C command ‘info’ and the associated APK. This command collects the clipboard data and verifies the victims’ device for the presence of a hardcoded list of mobile security products, may be with the aim of disabling them or forwarding the info to the C2. Figure 16: Collects the clipboard information ----- Figure 17: Checks for the presence of security related products The structure of the commands sent from the C2 to victims’ device is as follows: Figure 18: Commands sent by C2 ----- At K7, we protect all our customers from such threats. Do ensure that you protect your mobile devices with a reputable security product like K7 Mobile Security and also regularly update and scan your devices with it. Also keep your devices updated and patched against the latest vulnerabilities. ## Indicators of Compromise (IoC) **Package Name** **Hash** **K7 Detection** **Name** com.editorpdf.acrobat F115C634016A9199054358515C19B40B Trojan ( 005652621 ) ### C2 213.136.80[.]208 vmi876244.contaboserver[.]net ## MITRE ATT&CK **Tactics** **Techniques** Defense Evasion Application DiscoveryObfuscated Files or Information, Virtualization/Sandbox Evasion Discovery Security Software Discovery, System Information Discovery Collection Email Collection, Data from Local System Command and Control Encrypted Channel, NonStandard Port -----