Jump to content

Registry-Residing Malware Creates No File for Antivirus to Scan


Adriano
 Share

Recommended Posts

Registry-Residing-Malware-Creates-No-Fil

A new form of persistent malware has been discovered, one which does not create any file on the disk and stores all activities in the registry.

In a blog posted at the end of July, security researcher Paul Rascagneres of GData details the particularities of the new type of malware, dubbed Poweliks, whose methods he labels as “rather rare and new,” since everything is performed in the memory of the computer system and there are several layers of code to get through in order to avoid analysis.

The attack vector is an email with a malcrafted Microsoft Word document attached. The vulnerability leveraged by the attackers is CVE-2012-0158, which affects Office and several other Microsoft products. It is not new, but many users are still using old versions of the software that could be compromised.

Once the file is launched, the cybercriminals turn on the persistency feature of the malware by creating an encoded autostart key in the registry. It seems that the encoding technique used by the malware was originally created by Microsoft to safeguard their source code from being altered.

In order to avoid detection by system tools, the registry key is hidden by providing a name in non-ASCII characters, which makes it unavailable to the Registry Editor (regedit.exe) in Windows.

By creating the auto-start key, the attackers make sure that a reboot of the system does not remove it from the computer.

By decoding the key, Rascagneres observed two sets of code: one that verified if the affected machine had Windows PowerShell installed, and another one, a Base64-encoded PowerShell script, for calling and executing the shellcode.

According to the researcher, the shellcode executes the payload, which attempts to connect to a remote command and control (C&C) server for receiving instructions. There are multiple IP addresses for C&C servers, all hard-coded.

The peculiarity of this malware is that it does not create any file on the disk, making it more difficult to be detected through classic protection mechanisms.

“To prevent attacks like this, AV solutions have to either catch the file (the initial Word document) before it is executed (if there is one), preferably before it reached the customer’s email inbox. Or, as a next line of defense, they need to detect the software exploit after the file’s execution, or, as a last step, in-registry surveillance has to detect unusual behavior, block the corresponding processes and alert the user,” writes Rascagneres.

This type of malicious behavior is not new though, as a sample was also analyzed on KernelMode.info in mid-July, this year. In that case, the same vulnerability was exploited through a malicious RTF attached to an email claiming to be from Canada Post and/or USPS mail service.



Source: http://news.softpedia.com/news/Registry-Residing-Malware-Creates-No-File-for-Antivirus-To-Scan-453374.shtml#

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • VileTouch

    1

  • CODYQX4

    1

  • smallhagrid

    1

  • Adriano

    1

Popular Days

Top Posters In This Topic

Malware that resides in the registry only a rare and rather new approach

When security researchers talk about malware, they usually refer to files stored on a computer system, which intends to damage a device or steal sensitive data from it. Those files can be scanned by AV engines and can be handled in a classic way. The following analysis is an example of malware which resides in the registry only, is persistent and is not present as a file which can be scanned easily.

Executive Summary

When security researchers talk about malware, they usually refer to files stored on a computer system, which intends to damage a device or steal sensitive data from it. Those files can be scanned by AV engines and can be handled in a classic way. The following analysis is an example of malware which resides in the registry only, is persistent and is not present as a file which can be scanned easily.

This technique is something rarely put into focus. The initial file, which starts all malicious activity on the computer system, holds all code necessary for the attack, crypted and hidden, waiting to be called and executed. To unfold the harmful actions, the attackers work step-by-step deeper into the code. Executing these steps one after the other reminds of the stacking principles of Matryoshka dolls:

  • As the entry point, they exploit a vulnerability in Microsoft Word with the help of a crafted Word document they spread via email. The same approach would work with any other exploit.
  • After that, they make sure that the malicious activities survive system re-boot by creating an encoded autostart registry key. To remain undetected, this key is disguised/hidden.
  • Decoding this key shows two new aspects: Code which makes sure the affected system has Microsoft PowerShell installed and additional code.
  • The additional code is a Base64-encoded PowerShell script, which calls and executes the shellcode (assembly).
  • As a final step, this shellcode executes a Windows binary, the payload. In the case analyzed, the binary tried to connect to hard coded IP addresses to receive further commands, but the attackers could have triggered any other action at this point.
  • All activities are stored in the registry. No file is ever created.
So, attackers are able to circumvent classic anti-malware file scan techniques with such an approach and are able to carry out any desired action when they reach the innermost layer of the Matryoshka doll even after a system re-boot!

To prevent attacks like this, AV solutions have to either catch the file (the initial Word document) before it is executed (if there is one), preferably before it reached the customers email inbox. Or, as a next line of defense, they need to detect the software exploit after the files execution, or, as a last step, in-registry surveillance has to detect unusual behavior, block the corresponding processes and alert the user.

The analysis

The G DATA SecurityLabs have analyzed persistent malware which resides in the registry only and therefore does not create any file on the infected system. An overview of this mechanism was firstly described quite recently in the KernelMode.info forum. The analyzed sample is dropped by a Microsoft Word document which exploits the vulnerability described in CVE-2012-0158. The document was reported to be found as an attachment of fake Canada Post and/or USPS email which claims to hold information about ordered items for the recipient of the spam.

Autostart feature

To start at every boot-up of the system, the malware must create an autostart mechanism. In this case, the malware creates the following registry key:

nZUyamM.png

Note that the character used for the keys name is not an ASCII character. We will come back to this fact, later. The mentioned entry contains:

LGYBbKK.png

The purpose of this command is to open and execute the encoded content (the tag jscript.encode indicates the encoding) of the key:

\\HKCU\software\microsoft\windows\currentversion\run\(default)
Hide the autostart from the administrators tools

As mentioned, the name of the registry key to start the malware is not an ASCII character. The purpose is to hide the entry from system tools. The following screenshot reveals the registry keys content, opened with the common Windows tool regedit:

kTPnl2k.png

Regedit cannot read the non-ASCII character and therefore cannot open the key, as the error message shows. Furthermore, the user cannot see the key either.

Malware in a registry value like Matryoshka dolls

The developer uses a technique which resembles the stacking principle of Matryoshka dolls: initially used code embeds and executes further code and this code then leads to even more code used and so on and so on. The initial code executed is JScript code and then a PowerShell script which finally executes shellcode that contains the malicious code of Poweliks.

Step 1 (JScript code)

It is no surprise that the content of the executed registry key mentioned above is encoded:

FLkeUeW.png

This encoding technique was initially created by Microsoft in order to protect source code from being copied or tampered with. However, a security researcher had found a way to decode this kind of data which we can use now. Looking at the decoded key, the following tasks can be identified:

  • The script checks if Windows PowerShell is installed on the system. If it is not installed, the script downloads and installs it;
  • It executes further code, stored in base64; examined in the next paragraph.
Once decoded, the stored code is a PowerShell script, which perfectly explains why the malware searched for/installed the software during the previous step. By default, Microsoft Windows has protection to avoid the execution of unknown PowerShell scripts. If we try to execute a PowerShell script, we have the following error message:

PS C:\Users\User> .\script.ps1

File script.ps1 cannot be loaded because the execution of scripts is disabled on this system.

The attackers circumvent this limitation by making Windows believe that the script runs in interactive mode of PowerShell. Therefore, the script can be executed without a user notification.

Step 2 (PowerShell script and its purpose)

The PowerShell script contains a variable $p, which contains Base64-encoded shellcode. It uses VirtualProtect() to render the memory executable and CallWindowProcA() to execute the shellcode in $p.

Step 3 (ASM shellcode)

The shellcode realizes several actions:

  • It allocates memory, using VirtualAlloc();
  • it copies data, including itself (at the offset 0x1104);
  • It executes the copied code.
Have a look at the data copied to the offset 0x1104:

vnX8sgN.png

We can identify a Microsoft Windows binary (starting with MZ). Furthermore, we can see two other significant strings: MPRESS1 and MPRESS2. Theses strings are added by a packer called MPress , but we will not go into detail about the unpacking at this point. This last payload, the entire MZ, is the actual malicious part; it performs connections to two IPs located in Kazakhstan to receive commands. At the time of analyzing this case, the two IPs were already offline, so we cannot state what attack the authors wanted to launch.

As the malware is very powerful and can download any payload; the amount of possible damage is not really measurable. It might install spyware on the infected computer to harvest personal information or business documents. It might also install banking Trojans to steal money or it might install any other form of harmful software that can suit the needs of the attackers. Fellow researchers have suggested that Poweliks is used in botnet structures and to generate immense revenue through ad-fraud.

Conclusion

The analysis of this piece of code was uncommon and rather time consuming, with several code layers which were created to prolong the analysts work and certainly to hide the malware and to blend it into the usual system use without the user noticing the infection.

Poweliks is malware that does survive without any file creation, which is a rather rare and new technique, barely focused on everything is performed within the memory. It only resides in the registry and executes programs from there. Furthermore, the developers hid the autostart registry key by using a non-ASCII character as the name of the key. This trick prevents a lot of tools from processing this malicious entry at all and it could generate a lot of trouble for incident response teams during the analysis. The mechanism can be used to start any program on the infected system and this makes it very powerful!

Source

Edited by VileTouch
Link to comment
Share on other sites

smallhagrid

This type of posting is EXACTLY the kind of info that makes this place so valuable !!

More even than Wilders really when it comes to security-related subjects.

There, they blather on and on about other stuff that is a useless bore and here that other stuff is just ignored as the meaningless trash it really is.

(The bores at Wilders need to get...MEDICATED, I think !!)

I will be very curious to see more info about this new malware and how it will be detected & fixed.

It is a great help to see such valuable info posted for everyone and thanks for posting it here.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...