SpiderLabs Blog

Documents with IRM Password Protection Lead to Remcos RAT | Trustwave

Written by Diana Lopera | Sep 27, 2019 5:00:00 AM

Documents attached to emails are commonly used as the initial vector to deliver malware into a system. To give an impression of security, attackers sometimes use document protection features and technology to hide their malicious code and behavior from email scanners. In a previous blog, we showed how ransomware was delivered through a password protected document attachment. Recently, we encountered another password protected Word document, this time, with Information Rights Management (IRM) technology that delivered the Remcos RAT.

The Spam

The email samples we observed make use of two very common themes in spamming – fake job applications and invoices. Their email bodies contain brief summaries of the spammer’s intent and the password to the attachment.

 


Figure 1: Trustwave SEG Console displaying the scam email leading to Remcos RAT malware

 

This spam campaign has one attachment – a password protected document with “.rtf” or “.doc” file extensions for the fake resume and invoice respectively. The attached document is also wrapped with IRM Technology.

The Attachment

IRM is a technology that protects a document from unauthorized access. The document will be encrypted and the data about the access permission is stored within itself.

 


Figure 2: The IRM documents “Santo Resume.rtf” and “invoice.doc” has a WordDocument section

 

The documents attached in this campaign are identified by Trustwave Security Email Gateway as document with IRM. The fake resume is an OLE compound document and the invoice is Word 2007 document. The permission to access these documents are not restricted hence everyone who knows their password can open them.

Upon execution of the attachment “Santo Resume.rtf”, the password “123456” from the email body needs to be supplied. To be able to analyze the IRM document further, we saved the attachment “Santo Resume.rtf” to another WordDocument format – as Word 97 - 2003 document. Looking at the file in a hex editor, we quickly saw that this document has a macro which will download a file from a suspicious link.

 


Figure 3: Saving the IRM document “Santo Resume.rtf” as Word 97 – 2003 document, the attachment is verified to be password protected and Remcos RAT download URL can now be seen
 
 
Figure 4: “Santo Resume.rtf” contains a macro that will only download and save an executable file to the %tmp% folder

 

The attachment “Santo Resume.rtf” has a macro that will download an executable file from hxxp://104[.]244[.]74[.]243/7[.]jpg. This will be saved and executed as “%tmp%\tem3perz.exe”.

The Payload – Remcos RAT

The downloaded file “%tmp%\tem3perz.exe” is a self-extracting archive. Upon execution, it will run the executable file “AU16_O~1.EXE” which is the VB packed Remcos RAT.

Remcos is a remote access tool which is easily available to the public since 2016 and is popular nowadays. It has, for example, been used before by the Elfin group A.K.A. APT33. This RAT can be used to steal system information and control the infected system.

The Remcos RAT drops a copy of itself, along with a VBScript file which will be used for persistence of Remcos. The VB packed file “AU16_O~1.EXE” drops a copy of itself "ST.exe" and the VBScript "ST.vbs" at the folder %userprofile%\IN. The VBScript file "ST.vbs" is used in the autorun registry HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce.

 

Figure 5: Displays the file and registry changes made upon execution of the downloaded file “%tmp%\tem3perz.exe”. The code snippet on the lower right is the first routine that will be performed by the VB packed Remcos “ST.exe”.

 

The Remcos RAT is written in C++. In the unpacked “ST.exe”, we can identify that the sample is version 2.4.7 Pro.

Figure 6: Remcos RAT sample version 2.4.7 Pro by Breaking-Security.net

 

Remcos has its configuration encrypted in the resource section, named as “SETTINGS”.

Figure 7: The snippet of the code where configuration “SETTINGS” will be searched at the resource section and its data

 

Included in the configuration “SETTINGS” are the C&C servers, port, and the key used to encrypt the data to be sent to the C&Cs.

 

Figure 8: The vertical var delimited list of C&Cs, port, and key obtained from “ST.exe”

 

Upon running, Remcos sets about collecting system information, encrypted using RC4 algorithm with the key “pass”.

Figure 9: The snippet of the system information Remcos will collect
 
Figure 10: The data collected by Remcos has a header “[DataStart]” and the information are delimited with “|cmd|”

 

IOCs

Santo Resume.rtf (Size: 39424 bytes)
SHA1: BEEDEE62E9EBB9080BF6AA6716E404F74D7F7503

tem3perz.exe (Size: 1078272 bytes) from ://104[.]244[.]74[.]243/7[.]jpg
SHA1: C4A63C917651A89A370E8378B9790C81ADFF2182

AU16_O~1.EXE (Size: 400925697 bytes)
SHA1: AC40C8934A8CD35A7996C1D365EEA4291FBA4C52

invoice.doc (Size: 38912 bytes)
SHA1: 0E1A7632FCD2BDB72C509897B7B28186DB1E803C

sup2.exe (Size: 1073152 bytes) from ://104[.]244[.]74[.]243/10[.]jpg
SHA1: F9A15D3E27876F73CD148287EE0937161B920E78

AUS18_~1.EXE (Size: 400888833 bytes)
SHA1: 05C60D19ACB64F23D08FCDBA5095CDF9C4E5C940