Vulnerabilities / Threats //

Advanced Threats

8/29/2017
10:30 AM
Connect Directly
Twitter
LinkedIn
RSS
E-Mail vvv
100%
0%

How Hackers Hide Their Malware: The Basics

Malware depends on these four basic techniques to avoid detection.

First of a two-part series.

Antivirus (AV) and anti-malware products are among the oldest and most mature defenses against cyber attacks we have, yet new malware samples seem to make it past legacy AV solutions every day. If you monitored the top AV engines the day WannaCry surfaced, you'd have seen that most of them missed the first samples early on but slowly updated signatures over the following hours, days, and weeks. This is a perfect example of the delayed, reactive nature of signature-based detection solutions.

Signature-based AV software can also miss well-known threats. The industry sees anywhere from 300,000 to 1 million new malware variants each day. However, criminals aren't making millions of new worms, Trojans, or viruses. There are probably thousands, not hundreds of thousands, of truly unique malware families. So, where do these millions of variants come from?

The answer is malware evasion techniques. Over time, malware authors have developed hundreds of techniques to make their malware look "new again" to evade security controls. In the second of a two-part post, I'll cover seven high-level evasion techniques cybercriminals use to hide malware from you and your security software, and explain some of the ways we can still detect them. Here, in part 1, I'll outline four basic malware obfuscation methods.

1. Packers
A packer is a program that compresses an executable to make it smaller. It wraps the compressed executable in the code necessary to decompress itself at runtime. The act of compression changes the way the executable file looks. Signature-based detection relies on malware researchers or automated systems finding a pattern in a known malware file, such as a hash or the number of binary patterns, to create a unique identifier for that malware. Packing changes this identifier, so the AV may not detect the packed file.

Though there are legitimate uses for packers, including making your executables smaller or making it harder for pirates to reverse engineer your code, malware regularly uses packed executables to try to hide from your AV. AV can often detect packing, but since you can legitimately pack executables, AV products can't use this alone to decide something is malware.  

2. Crypters
A crypter is similar to a packer but adds additional obfuscation or encryption to the mix. Like a packer, its goal is to change the binary fingerprint of a file to avoid detection. In a nutshell, the crypter encrypts the original executable using an encryption algorithm — often something as simple as a XOR cipher with a unique key. The crypter then creates a stub, which is the initial program that has everything it needs to decrypt and run the real embedded payload.

By using different keys with a XOR cipher to encode the original program, you can create almost endless altered copies of the same program. Nowadays, other criminals sell many different crypters on the underground market. You can also find many free ones, like the well-known Veil-Evasion framework.

There are some issues with both packers and crypters. For instance, both techniques mostly protect malware from static analysis but not necessarily dynamic analysis. Static analysis means malware detection techniques you perform on a file that has not executed yet. Because you want to stop malware before it gets onto systems, many AV products scan files as they pass through networks or get copied onto a computer's file system. However, static analysis limits what AV can learn about the particular file since those files could be packed or crypted.

Dynamic analysis, on the other hand, means detection techniques applied when a file executes. Dynamic analysis allows you to see the malware code in memory, or pay attention to other things it does. A packed or crypted program eventually has to unpack or decrypt itself to run. Thus, products using dynamic analysis can often recognize the obfuscated malware once it does run. Furthermore, once AV companies figure out how to detect particular packers or the stubs for crypters, they can sometimes recognize those malicious files without needing to see the decoded binary.

I'm simplifying, of course. Packers and crypters continue to evolve in an arms race against AV software and now use techniques such as only decrypting small portions of the real payload in memory at a time, which can make it harder for AV products.

3. Polymorphic Malware
At the highest level, polymorphic malware is malware that repeatedly uses packing and crypting methods to change the way it looks. However, rather than using static keys as most crypters do, polymorphic malware uses more complex encrypting algorithms with random keys, variables, and decoders. The malware itself can mutate itself every time it copies itself to a new location, or criminals can set up servers that automatically morph their malware variant every time it's sent to a new victim. Server-side polymorphic malware is very popular and likely accounts for a large majority of daily malware variants.

4. Downloaders, Droppers, and Staged Loading
Many kinds of malware use staging programs called droppers or downloaders to learn about a system before installing the real malware. Some of these droppers scope out a system first to avoid triggering security alerts when they download and install the real payload. They may seek out and kill security processes or check to see if they're running on a virtual system. They may also download their secondary payloads using encrypted back channels to avoid network detection or inject malware directly into known Windows processes to avoid detection. On the downside, AV vendors can design signatures to recognize these droppers and downloaders, and modern AV programs are good at defending themselves from dropper tricks.

These four techniques hackers use to hide malware are relatively basic but quite effective. In the second part of this series, I describe several more advanced obfuscation methods, and explain ways companies can still detect malware even if it's hidden.

Related Content:

Learn from the industry’s most knowledgeable CISOs and IT security experts in a setting that is conducive to interaction and conversation. Click for more info and to register.

Corey Nachreiner regularly contributes to security publications and speaks internationally at leading industry trade shows like RSA. He has written thousands of security alerts and educational articles and is the primary contributor to the WatchGuard Security Center blog, ... View Full Bio
Comment  | 
Print  | 
More Insights
Comments
Oldest First  |  Newest First  |  Threaded View
6 Ways Greed Has a Negative Effect on Cybersecurity
Joshua Goldfarb, Co-founder & Chief Product Officer, IDRRA ,  6/11/2018
Weaponizing IPv6 to Bypass IPv4 Security
John Anderson, Principal Security Consultant, Trustwave Spiderlabs,  6/12/2018
'Shift Left' & the Connected Car
Rohit Sethi, COO of Security Compass,  6/12/2018
Register for Dark Reading Newsletters
White Papers
Video
Cartoon
Current Issue
Flash Poll
The State of Ransomware
The State of Ransomware
Ransomware has become one of the most prevalent new cybersecurity threats faced by today's enterprises. This new report from Dark Reading includes feedback from IT and IT security professionals about their organization's ransomware experiences, defense plans, and malware challenges. Find out what they had to say!
Twitter Feed
Dark Reading - Bug Report
Bug Report
Enterprise Vulnerabilities
From DHS/US-CERT's National Vulnerability Database
CVE-2018-12026
PUBLISHED: 2018-06-17
During the spawning of a malicious Passenger-managed application, SpawningKit in Phusion Passenger 5.3.x before 5.3.2 allows such applications to replace key files or directories in the spawning communication directory with symlinks. This then could result in arbitrary reads and writes, which in tur...
CVE-2018-12027
PUBLISHED: 2018-06-17
An Insecure Permissions vulnerability in SpawningKit in Phusion Passenger 5.3.x before 5.3.2 causes information disclosure in the following situation: given a Passenger-spawned application process that reports that it listens on a certain Unix domain socket, if any of the parent directories of said ...
CVE-2018-12028
PUBLISHED: 2018-06-17
An Incorrect Access Control vulnerability in SpawningKit in Phusion Passenger 5.3.x before 5.3.2 allows a Passenger-managed malicious application, upon spawning a child process, to report an arbitrary different PID back to Passenger's process manager. If the malicious application then generates an e...
CVE-2018-12029
PUBLISHED: 2018-06-17
A race condition in the nginx module in Phusion Passenger 3.x through 5.x before 5.3.2 allows local escalation of privileges when a non-standard passenger_instance_registry_dir with insufficiently strict permissions is configured. Replacing a file with a symlink after the file was created, but befor...
CVE-2018-12071
PUBLISHED: 2018-06-17
A Session Fixation issue exists in CodeIgniter before 3.1.9 because session.use_strict_mode in the Session Library was mishandled.