Simple malware obfuscation techniques | Infosec (2024)

Malware analysis

What is malware?

Malware stands for malicious software and software, in simple language, means some program written in any programming language. So if a malicious program is intentionally written to cause damage to any computer or server or gain unauthorized access to any system, it is called malware.

Malware is a generic term used to define a variety of malicious programs and can take various forms. These terms include virus, Trojan horse, worms, adware, spyware, ransomware and so on.

Simple malware obfuscation techniques | Infosec (1)

Become a certified reverse engineer!

Get live, hands-on malware analysis training from anywhere, and become a Certified Reverse Engineering Analyst.

Start Learning

What is obfuscation?

Obfuscation is the most commonly used technique to conceal the original code written by the programmer, rendering the executable code difficult to read and hard to understand while maintaining the functionality of the written code. Nearly every piece of malware uses obfuscation in some or the other way.

Why obfuscation?

Usually, every computer or server has some software installed on it to detect and prevent malicious programs from being executed onto the local machine. This software can be present in various forms like antivirus, Windows Defender, ad blockers and so on, which detect this malware and stop it at the perimeter.

Malware analysts can also analyze the malware and identify important information like strings and the URL with which the malware is communicating and implement necessary measures to prevent the malware from being executed. Thus, most of the malware is obfuscated by default.

Malware obfuscation techniques

There are many obfuscation techniques being used by malware writers. Some of them are basic, while others are advanced.

Let’s have a look at some of the basic malware techniques widely being used.

Exclusive OR (XOR)

XOR is the most commonly used technique for obfuscating any malware. Also, it is very simple to implement and can easily hide the malicious payload from getting detected.

XOR is a binary operation. It is denoted as ^. The Boolean table for XOR operation looks like this:

ABA^B000011101110

The following are the steps followed to obfuscate and de-obfuscate the code using the XOR technique:

Obfuscation

1) Attacker randomly picks one byte value. This value acts as the key.

2) Possible key values range from 0-255 (decimal value).

3) Attackers encode and obfuscate the original code by iterating through every byte of data and XORing each and every byte with the key selected in step 1.

De-obfuscation

4) For de-obfuscation, we need to make use of the same key used for obfuscation.

5) Attacker repeats step 3 and iterates through every byte of data, XORing each and every byte with the key selected in step 1 to de-obfuscate the original obfuscated data.

Base64 encoding

Base64 is another simple malware obfuscation technique. There are only 64 characters in base64 encoding, hence the name. They are:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=

The “=” character is used for padding.

In base64 encoding, the encoding function takes three characters and strings them with each other to obtain a 24-bit string. This string is broken into four chunks each of six bits, which is then translated into one of the base64 characters. Base64 is trivial to decode if it can be recognized.

ROT13

ROT13 is another malware obfuscation technique. It stands for Rotate 13.

It is simply a letter substitution cipher that replaces a letter by the 13th letter after it. Example “A” is replaced by ”N”, ”B” by ”O”, ”H” by ”U” and so on, continuing the sequence. Thus, only the alphabet is encoded while numbers, characters and symbols are not affected by it.

To de-obfuscate, applying ROT13 twice on obfuscated code reveals the original code.

Dead code insertion

In this, ineffective and useless codes are added to the original source code of the program. This results in a disguised program from the original one.

Dead code makes program control flows more complex and difficult to understand, while the behavior of the original program does not change. Dead codes are usually inserted into expressions and statements and not into loops to avoid performance issues.

Instruction changes

In the instruction change technique, malware writers alter instruction codes in the original code resulting in change in the appearance of the code while the behavior of the code remains the same. Thus, this makes it difficult for reverse engineers to reverse the code by going through the instructions and trying to understand the logic implemented in the code.

Packers

Packers usually involve compressing the original source code, thus reducing the original size of the code. Unlike standard zip files, packed executables automatically unpack themselves when executed.

Crypters

Crypters usually obfuscate the original source code and hide the original source code by cryptographic algorithm so that the original source code cannot be reversed by reverse-engineering. This technique also helps in bypassing and evading antiviruses and network defenses installed on the network. Most of the crypters get decoded and are not difficult to reverse.

Conclusion

As long as malware exists, so will various malware obfuscation techniques. Attackers will come up with new techniques to evade detection from malware engines, but it is the responsibility of the organization to take proactive measures for detecting and preventing various malware-based attacks by familiarizing themselves with the latest techniques being leveraged by attackers.

Simple malware obfuscation techniques | Infosec (2)

Become a certified reverse engineer!

Get live, hands-on malware analysis training from anywhere, and become a Certified Reverse Engineering Analyst.

Start Learning

Sources

Simple malware obfuscation techniques | Infosec (2024)

FAQs

Simple malware obfuscation techniques | Infosec? ›

Simple malware obfuscation

obfuscation
In software development, obfuscation is the act of creating source or machine code that is difficult for humans or computers to understand.
https://en.wikipedia.org › wiki › Obfuscation_(software)
techniques like exclusive OR (XOR), Base64, ROT13 and codepacking are commonly used. These techniques are easy to implement and even easier to overlook. Obfuscation can be as simple as interposed text or extra padding within a string.

What are the obfuscation techniques for malware? ›

Compression, encryption, and encoding are some of the most common obfuscation methods used by threat actors. Multiple methods are often used in tandem to evade a wider variety of cyber security tools at the initial point of intrusion.

What are the techniques of obfuscation? ›

Obfuscation is an umbrella term for a variety of processes that transform data into another form in order to protect sensitive information or personal data. Three of the most common techniques used to obfuscate data are encryption, tokenization, and data masking.

Which of the following malware obfuscation techniques is used to increase the size of a file beyond what some security applications can handle? ›

Binary Padding

Junk code is generated using a function and saved as binary to exceed the default maximum file size limit (typically 25–200 MB) of malware scanners. This prevents the malware scanner from inspecting it due to the high time and client-timeout risk involved.

What are two techniques which malware writers can use to protect their code? ›

Malware authors employ encryption and obfuscation to evade detection. Encryption transforms malware into a format decipherable only with a specific key, while obfuscation complicates the code to hinder understanding and reverse engineering.

What are the 3 methods for protecting your device from malware? ›

How to prevent malware
  • Keep your computer and software updated. ...
  • Use a non-administrator account whenever possible. ...
  • Think twice before clicking links or downloading anything. ...
  • Be careful about opening email attachments or images. ...
  • Don't trust pop-up windows that ask you to download software. ...
  • Limit your file-sharing.

What are three tools that can be used in the data obfuscation process? ›

Data masking, encryption, and tokenization are three common data obfuscation techniques. Each type has strengths in protecting against destructive malware. Familiarizing yourself with data obfuscation techniques will help you protect your sensitive data—and educate you in case obfuscation is used against you.

What is obfuscation for dummies? ›

Code Obfuscation is the process of modifying an executable so that it is no longer useful to a hacker but remains fully functional. While the process may modify actual method instructions or metadata, it does not alter the output of the program.

What is obfuscation simple? ›

: to be evasive, unclear, or confusing. The suspect often obfuscated during the interrogation. obfuscation.

What is the obfuscation rule? ›

Obfuscation rule actions define what attributes to look at, what text to obfuscate, and how to obfuscate (either by masking or hashing). Obfuscation expressions are named regular expressions identifying what text to obfuscate. Masking completely removes information, replacing it with X characters.

What are two techniques that malware can use to avoid detection? ›

Packers and Crypters: Packers and crypters are techniques used in malware to evade signature-based detection. Packers are tools that compress and encrypt the malware's code, creating a new executable that requires a specific unpacking routine to be executed, before revealing the original malicious code.

What new malware obfuscation and evasion techniques should you be aware of? ›

Additionally, watch for techniques like steganography, where malicious code is hidden within seemingly harmless files, and the use of encryption to conceal communication between malware and its command and control server.

What is the method of concealing malware? ›

Another concealment method is called Least Significant Bit (LSB) steganography, which involves hiding malicious code or data within the pixels of an image. It involves converting the malicious code into a binary format. In turn, the binary data is embedded into the least significant bits of the pixel values.

What are the methods of obfuscation of malware? ›

Common Malware Obfuscation Techniques
  • Encoding: Malware creators use encoding, like Base64, to transform malicious code into a different format, making it harder for security tools and analysts to recognize the threat.
  • Encryption: This technique transforms data into a secure format, readable only with a decryption key.
Mar 25, 2024

What are malware detection techniques? ›

Malware detection involves using techniques and tools to identify, block, alert, and respond to malware threats. Basic malware detection techniques can help identify and restrict known threats and include signature-based detection, checksumming, and application allowlisting.

What are the two common technique for malware analysis? ›

Two forms of malware analysis exist for malicious executables: static and dynamic. As its name implies, static analysis (also known as static binary analysis or source code analysis) examines computer code without executing a program. Alternatively, dynamic analysis examines the behavior of a program at runtime.

Top Articles
Latest Posts
Article information

Author: Delena Feil

Last Updated:

Views: 5817

Rating: 4.4 / 5 (45 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Delena Feil

Birthday: 1998-08-29

Address: 747 Lubowitz Run, Sidmouth, HI 90646-5543

Phone: +99513241752844

Job: Design Supervisor

Hobby: Digital arts, Lacemaking, Air sports, Running, Scouting, Shooting, Puzzles

Introduction: My name is Delena Feil, I am a clean, splendid, calm, fancy, jolly, bright, faithful person who loves writing and wants to share my knowledge and understanding with you.