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 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.
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.
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.
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.
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.
The Remcos RAT is written in C++. In the unpacked “ST.exe”, we can identify that the sample is version 2.4.7 Pro.
Remcos has its configuration encrypted in the resource section, named as “SETTINGS”.
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 .
Upon running, Remcos sets about collecting system information, encrypted using RC4 algorithm with the key “pass”.
Santo Resume.rtf (Size: 39424 bytes)
tem3perz.exe (Size: 1078272 bytes) from ://104[.]244[.]74[.]243/7[.]jpg
AU16_O~1.EXE (Size: 400925697 bytes)
invoice.doc (Size: 38912 bytes)
sup2.exe (Size: 1073152 bytes) from ://104[.]244[.]74[.]243/10[.]jpg
AUS18_~1.EXE (Size: 400888833 bytes)