What are the Encryption Algorithms Used in Modern Malware? - A Comprehensive Guide
Malware authors increasingly rely on encryption to obfuscate their code and evade detection by security tools such as YARA, Suricata, and other static file analysis solutions.
For Security researchers, Analyze malware in an Interactive sandbox such as?ANY.RUN?is a more convenient and secure way, with a variety of monitoring features.
Encryption is a cornerstone of modern malware. It is used to encrypt network traffic, obfuscate command and control (C2) strings, and protect payloads. This guide provides an in-depth overview of the most commonly used encryption methods in malware.
Types of Encryption Algorithms
Stream Ciphers
Stream ciphers encrypt data in a continuous stream, one bit or byte at a time, akin to water flowing from a tap. This method is fast and efficient but generally results in a weaker cipher compared to block ciphers.
Stream ciphers are often used in malware for various reasons, primarily due to their simplicity, speed, and low computational overhead. In the context of malware analysis in real time, understanding how stream ciphers are used can help analysts detect, decrypt, and mitigate the threats posed by malicious software.
Examples of Stream Ciphers:
Stream ciphers offer an efficient and straightforward approach to encryption, making them suitable for specific applications where high speed and low complexity are essential. However, choosing a secure and modern stream cipher is vital to ensure the confidentiality and integrity of the encrypted data.
XOR Cipher:
XOR ciphers are often used in malware to obfuscate code, encrypt stolen data, and protect configuration information. Their simplicity and low computational overhead make them effective for these purposes.
By extracting the XOR key from the code or memory, analysts can decrypt the data to understand the malware's behavior. Despite their weak security, XOR ciphers are useful for evading basic detection mechanisms in malware analysis.
The XOR (exclusive OR) operation is a simple binary operation used in many stream ciphers. It takes two bits and returns 1 if exactly one of the bits is 1, and 0 otherwise.
The XOR cipher is widely used in modern malware due to its simplicity. Each bit or byte of plaintext is XORed with a corresponding bit or byte from the key, making it reversible.
Despite its simplicity, the XOR cipher can be surprisingly effective when used with a sufficiently complex key.
The XOR cipher is a simple encryption algorithm based on the XOR (exclusive OR) logical operation. It is a type of symmetric key algorithm, meaning the same key is used for both encryption and decryption. The simplicity of the XOR cipher makes it easy to understand and implement, but it is not secure for most practical purposes unless the key is as long as the message and truly random, as in the one-time pad.
Analyze malware in?ANY.RUN Sandbox?with no limits?- Create a Free Account
How the XOR Cipher Works
XOR Operation
The XOR operation takes two binary inputs and returns true (1) if the inputs are different, and false (0) if they are the same. Here is the truth table for XOR:
Encryption and Decryption Process
The XOR cipher encrypts and decrypts data by applying the XOR operation between the plaintext and the key. Because XOR is a symmetric operation (i.e., A XOR B XOR B = A), the same operation is used for both encryption and decryption.
Block Ciphers
领英推荐
Block ciphers are used in malware to encrypt payloads, exfiltrate data, protect configuration files, and secure communication with C2 servers, often using AES due to its strong security.
Ransomware like WannaCry and Petya utilize these ciphers to encrypt victims' files, making them inaccessible until a ransom is paid.
Analysts use tools like ANY RUN, an interactive sandbox for static and dynamic analysis, to identify encryption routines and extract keys, helping to decrypt and understand the malware's operations.
Notable examples include WannaCry's use of AES-128 and Petya's use of Salsa20 for encryption.
Block ciphers encrypt data in fixed-size blocks, usually 64, 128, 192, or 256 bits at a time. This method requires the key to match the block size exactly during decryption, or errors will occur.
To decrypt a block cipher in malware, you need to extract the key, the mode, and the IV, along with knowing the encryption algorithm used.
Characteristics:
Common Block Ciphers in Malware
AES (Advanced Encryption Standard)
AES is a symmetric block cipher and the de facto standard for encrypting sensitive data. It operates on fixed-size blocks of 128 bits and supports key sizes of 128, 192, or 256 bits. AES involves several steps:
The number of iterations (rounds) depends on the key size: 10 rounds for 128-bit keys, 12 rounds for 192-bit keys, and 14 rounds for 256-bit keys. AES is highly secure and efficient, making it a popular choice among malware authors for encrypting payloads and C2 communications.
DES (Data Encryption Standard)
DES is a symmetric-key block cipher that was once the primary encryption standard in the United States. Although largely replaced by AES, DES is still found in some older or less sophisticated malware samples.
It uses a 56-bit key and operates on 64-bit blocks, going through 16 rounds of transposition and substitution. The small key size of DES is now considered insecure, making it vulnerable to brute-force attacks. However, it may still be encountered in legacy systems or less advanced malware.
RSA (Rivest-Shamir-Adleman)
RSA is an asymmetric encryption algorithm that uses a pair of keys: a public key for encryption and a private key for decryption. This method is known as public key cryptography.
RSA relies on the difficulty of factoring large prime numbers for security, making it robust but slow. Malware authors typically use RSA to encrypt small chunks of high-value data, such as C2 addresses or keys, due to its computational complexity.
RSA is often combined with symmetric encryption algorithms, where RSA encrypts the symmetric key used for the actual data encryption.
Are You From SOC/DFIR Teams? Meet ANY.RUN
If you're interested in malware analysis and go deep into the malware files and their operations, then ANY RUN is a place where you can find your time.
ANY.RUN is an interactive sandbox that helps over 400,000 cybersecurity professionals worldwide analyze malware threats targeting both Windows and Linux systems. The platform offers threat intelligence products like TI Lookup, Yara Search, and Feeds to help identify Indicators of Compromise (IOCs) and respond to incidents faster.
Advantages of ANY.RUN
ANY.RUN offers a robust platform for cybersecurity professionals to understand and mitigate malware threats effectively. Try the full power of ANY.RUN for free and enhance your malware analysis capabilities.
By understanding these encryption algorithms and leveraging tools like ANY.RUN, cybersecurity professionals can better protect systems and data from malicious attacks.
Interact with malware in the ANY.RUN sandbox like you would on your workstation. - Book Free Trial
Management and Business Process Consultant, CMMI 3.0, PCMM, CMMI Practitioner and Project Management Professional, Lead Auditor and Implementer for QMS, ISMS, PIMS, BCMS, ITSM. CMMI Associate (ATM) and PCMM Assessor.
7 个月Thanks for sharing this article. Very well explained and very useful. It's great to see such detailed insights being shared. Encryption significantly affects malware detection by obfuscating malware code, making it harder for security tools to identify and analyze malicious software. Understanding the encryption methods used in malware is a critical step for any security professional. Staying informed is key to staying ahead of threats.
Thank you for sharing this informative article, Cyber Security News ?! Understanding the encryption methods used in malware is a critical step for any security professional. At Cambridge Cloudworks, we believe in empowering defenders with the knowledge they need to stay ahead of evolving threats. This breakdown of common encryption algorithms is a valuable resource for anyone involved in malware analysis. #Encryption #MalwareAnalysis
Great insights on the increasing use of encryption by malware authors! It's fascinating to see how encryption, while vital for security, is also leveraged for malicious purposes. Utilising interactive sandboxes like ANY.RUN indeed offers a robust approach to dissecting and understanding these sophisticated threats
Software Developer
8 个月Very usefull!