The Rise of 'Fileless' Malware

The attack that fileless malware causes does not touch the disk of the target, loading the malware instructions only into memory. Sneaky.

Malware has typically used files that it makes resident on a target machine to carry out an attack. But another class of malware called "fileless" does the opposite. The attack that the malware causes does not touch the disk of the target, loading the malware instructions only into memory.

Though they have become more frequent, this sort of malware has been seen for at least 15 years. The Lehigh virus was an example of this technique. The virus infector actually contained the malicious code and the payload running in memory. It would overwrite the boot sector of a DOS machine, preventing the target from booting.

In the 2018 Ponemon Institute State of Endpoint Security Risk, respondents predicted 62% of attacks targeting respondents' companies in 2019 would be file-based while 38% would be fileless attacks.

Nowadays, exploit kits (EK) like Magnitude can stream its Grand Crab ransomware payload and execute it without dropping it on disk first. This is an attack that seeks the maximum of targets and is spread indiscriminately to see if it sticks somewhere. Using fileless techniques, the EK leaves minimal traces of itself on the target which helps prevent its detection by AV products and proactive mitigation.

In some ways, use of fileless techniques will present the same problems to the security team as a manual breach. In both cases, there may not be a clear origin point present for post-incident analysis.

Additionally, these sorts of attacks will have "living off the land" as a philosophy. That is, they will try to use any software that they expect to see resident on an uninfected machine as part of their attack.

Interpreted code, found in Java for example, or a Windows utility like Windows Management Instrumentation (WMI) which automates system administration tasks, can be abused to allow malicious scripts to run. These are then rolled out to the endpoint, without writing to disk.

PowerShell in Windows has been used repeatedly in such situations. It is a powerful tool that can be used benignly by the OS, but can also be used in an attack. Determining what use it has been put to just from a log examination may not be possible.

But, let's say a user goes to a malicious web page where it causes Flash to load. Flash can invoke PowerShell, which it then feeds instructions via the command line. PowerShell can then be connected to a malicious command and control server, where it downloads a malicious PowerShell script. The script then finds sensitive data and sends it to the attacker.

It can be seen that this attack will never download any malware file onto the target at any point in the attack. It is "fileless" in how it executes. There will be no static file signature for an AV tool to identify.

Trend Micro has found a kind of fileless Trojan malware that is self-propagating, also known as a vaporworm. The malware hides its code in the Windows Registry at HKEY_CURRENT_USER\Software, which is stored in memory. It uses AutoIt (the FileInstall command) to compile the payload and the main script into a single executable. This makes the payload -- in this case the BLADA-BINDI backdoor -- difficult to detect. That backdoor can do keylogging, retrieving and executing files, as well as stealing credentials from web browsers.

To gain persistence, another autorun registry entry is created that executes the first one upon booting, using PowerShell. The executable is loaded directly from the registry to the memory of PowerShell, leaving no traces on a system disk.

The vaporworm will also copy itself onto any removable storage that is attached to the system. That means USB drives, external hard drives, and the like.

One way to help in the mitigation of these kinds of attacks is for the AV tool to have a behavioral component. That is, the defending tool is aware of what is happening in memory and will sound an alarm if certain behaviors are encountered. The tool needs to be aware of the interrelations of various system parts to each other. Just having an analysis occurring when a file is written to disk is insufficient given this kind of threat model.

Limiting the actions of your system that are allowed can help too. Disabling macros or PowerShell can stop some attacks. Links from unknown sources should never be clicked, as well.

As attacks evolve as a response to defenses that stymie them, the fileless kind of attack will no doubt be a more prevalent modality.

— Larry Loeb has written for many of the last century's major "dead tree" computer magazines, having been, among other things, a consulting editor for BYTE magazine and senior editor for the launch of WebWeek.