Trend Micro Incorporated Research Paper 2013 # FAKEM RAT ### Malware Disguised as Windows® Messenger and Yahoo!® Messenger ----- ## Contents Introduction............................................................................................................................1 Distribution.............................................................................................................................2 Installation..............................................................................................................................3 Backdoor.................................................................................................................................3 Network Traffic Encryption............................................................................................... 5 Infrastructure........................................................................................................................7 Conclusion............................................................................................................................. 8 ----- ## Introduction The perpetrators of targeted attacks aim to maintain persistent presence in a target network in order to extract sensitive data when needed. To maintain persistent presence, attackers seek to blend in with normal network traffic and use ports that are typically allowed by firewalls. As a result, many of the malware used in targeted attacks utilize the HTTP and HTTPS protocols to appear like web traffic. However, while these malware do give attackers full control over a compromised system, they are often simple and configured to carry out a few commands. Attackers often use remote access Trojans (RATs), which typically have graphical user interfaces (GUIs) and remote desktop features that include directory browsing, file transfer, and the ability to take screenshots and activate the microphone and web camera of a compromised computer. Attackers often use publicly available RATs like Gh0st, PoisonIvy, Hupigon, and DRAT, and “closed-released” RATs like MFC Hunter and PlugX.[1] However, the network traffic these RATs produce is well-known and easily detectable although attackers still successfully use them.[2] Attackers always look for ways to blend their malicious traffic with legitimate traffic to avoid detection. We found a family of RATs that we call “FAKEM” that make their network traffic look like various protocols. Some variants attempt to disguise network traffic to look like Windows® Messenger and Yahoo!® Messenger traffic. Another variant tries to make the content of its traffic look like HTML. While the disguises the RATs use are simple and distinguishable from legitimate traffic, they may be just good enough to avoid further scrutiny. 1 [Gh0st: http://download01.norman.no/documents/ThemanyfacesofGh0stRat.pdf and http://www.](http://download01.norman.no/documents/ThemanyfacesofGh0stRat.pdf) [mcafee.com/ca/resources/white-papers/foundstone/wp-know-your-digital-enemy.pdf;](http://www.mcafee.com/ca/resources/white-papers/foundstone/wp-know-your-digital-enemy.pdf) [PoisonIvy: https://media.blackhat.com/bh-eu-10/presentations/Dereszowski/BlackHat-EU-2010-](https://media.blackhat.com/bh-eu-10/presentations/Dereszowski/BlackHat-EU-2010-Dereszowski-Targeted-Attacks-slides.pdf) [Dereszowski-Targeted-Attacks-slides.pdf; Hupigon: http://www.f-secure.com/v-descs/backdoor_](https://media.blackhat.com/bh-eu-10/presentations/Dereszowski/BlackHat-EU-2010-Dereszowski-Targeted-Attacks-slides.pdf) [w32_hupigon.shtml; DRAT: http://blog.trendmicro.com/trendlabs-security-intelligence/](http://www.f-secure.com/v-descs/backdoor_w32_hupigon.shtml) [watering-holes-and-zero-day-attacks/; MFC Hunter: http://blog.trendmicro.com/trendlabs-](http://blog.trendmicro.com/trendlabs-security-intelligence/watering-holes-and-zero-day-attacks/) [security-intelligence/japan-us-defense-industries-among-targeted-entities-in-latest-attack/; and](http://blog.trendmicro.com/trendlabs-security-intelligence/japan-us-defense-industries-among-targeted-entities-in-latest-attack/) [PlugX: http://about-threats.trendmicro.com/us/webattack/112/Pulling+the+Plug+on+PlugX](http://about-threats.trendmicro.com/us/webattack/112/Pulling+the+Plug+on+PlugX) [2 http://www.trendmicro.com/cloud-content/us/pdfs/security-intelligence/white-papers/wp-](http://www.trendmicro.com/cloud-content/us/pdfs/security-intelligence/white-papers/wp-detecting-apt-activity-with-network-traffic-analysis.pdf) [PlugX: http://about-threats.trendmicro.com/us/webattack/112/Pulling+the+Plug+on+PlugX](http://about-threats.trendmicro.com/us/webattack/112/Pulling+the+Plug+on+PlugX) [2 http://www.trendmicro.com/cloud-content/us/pdfs/security-intelligence/white-papers/wp-](http://www.trendmicro.com/cloud-content/us/pdfs/security-intelligence/white-papers/wp-detecting-apt-activity-with-network-traffic-analysis.pdf) [detecting-apt-activity-with-network-traffic-analysis.pdf](http://www.trendmicro.com/cloud-content/us/pdfs/security-intelligence/white-papers/wp-detecting-apt-activity-with-network-traffic-analysis.pdf) ----- ## Distribution All three versions of the FAKEM RAT that we investigated were distributed via spear-phishing emails using social engineering to lure targets into executing a malicious attachment. While we observed the use of different themes, the content of the emails were always interesting to potential targets. FIGURE 1: Sample spear-phishing emails with attachments that drop FAKEM RAT The malicious attachments were most often Microsoft® Word® documents with code that exploits the following vulnerabilities: - CVE-2010-3333: RTF Stack Buffer Overflow Vulnerability addressed in Microsoft Security Bulletin MS10-087.[3] - CVE-2012-0158: MSCOMCTL.OCX RCE Vulnerability addressed in Microsoft Security Bulletin MS12-027.[4] We also found a Microsoft® Excel® file that exploits CVE-2009-3129, the Excel Featheader Record Memory Corruption Vulnerability addressed in Microsoft Security Bulletin MS09-067.[5] We also saw samples that were simply executable (.EXE) files. [3 http://technet.microsoft.com/en-us/security/bulletin/MS10-087](http://technet.microsoft.com/en-us/security/bulletin/MS10-087) [4 http://technet.microsoft.com/en-us/security/bulletin/ms12-027](http://technet.microsoft.com/en-us/security/bulletin/ms12-027) [5 http://technet.microsoft.com/en-us/security/bulletin/MS09-067](http://technet.microsoft.com/en-us/security/bulletin/MS09-067) ----- ## Installation After exploitation, an .EXE file packed with UPX is dropped.[6] After initially dropping the malicious file named hkcmd.exe to the %Temp% folder, the malware typically copies itself using the name, tpframe.exe, to the %System% folder. It then adds the following registry entry to enable its automatic execution at every system startup: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ Windows\CurrentVersion\policies\Explorer\run tpbar = “%System%\tpframe.exe” ## Backdoor The network traffic the malware produces is designed to look like Windows Messenger traffic. Malware of this type were discussed on Twitter, noted by SonicWALL, and found to have been active as far back as September 2009.[7] However, it remains unclear if all the attacks that used this malware were connected. The malicious traffic begins with headers similar to actual Windows Messenger traffic: MSG 5 N 130 MIME-Version: 1.0 However, beyond this, you will see that the traffic is not valid Windows Messenger traffic but may be sufficiently disguised as such to escape further scrutiny. 6 UPX is a free tool that compresses executable files. However, it is commonly used to pack [malware files, see http://upx.sourceforge.net/ for more details.](http://upx.sourceforge.net/) [7 https://twitter.com/mikko/status/232851667446538241, https://www.mysonicwall.com/](https://twitter.com/mikko/status/232851667446538241) |Col1|Col2|Col3|Col4| |---|---|---|---| [7 https://twitter.com/mikko/status/232851667446538241, https://www.mysonicwall.com/](https://twitter.com/mikko/status/232851667446538241) [sonicalert/searchresults.aspx?ev=article&id=464, and https://twitter.com/diocyde/](https://www.mysonicwall.com/sonicalert/searchresults.aspx?ev=article&id=464) [statuses/232873023651336192](https://twitter.com/diocyde/statuses/232873023651336192) ----- FIGURE 2: Malicious traffic disguised as legitimate Windows Messenger traffic FIGURE 3: Legitimate Windows Messenger traffic Compared with actual Windows Messenger traffic shown in Figure 3, it is easy to distinguish the malicious traffic shown in Figure 2. During our investigation of the fake “Windows Messenger” RAT, we found another version that attempts to disguise its network traffic as Yahoo! Messenger traffic. The network communication this version uses begins with YMSG, the Yahoo! Messenger traffic header. FIGURE 4: Malicious traffic disguised as Yahoo! Messenger traffic FIGURE 5: Legitimate Yahoo! Messenger traffic However, the network traffic shown in Figure 4 does not resemble legitimate Yahoo! Messenger traffic beyond the use of the header, YMSG. Compared with the legitimate Yahoo! Messenger traffic shown in Figure 5, it is easy to distinguish between the two. A third version of the FAKEM RAT attempts to disguise the network traffic it produces as HTML. The malicious traffic begins with strings like