Malware Dũng Ngân Uy
Malware Dũng Ngân Uy
LAB ANALYSIS
Da Nang, 2023
Faculty of Computer Science and Engineering
1. Introduction:
- Malware and cybersecurity threats have been around since the early days of computing.
In the 1970s, the first computer viruses were created as experiments by researchers rather
than malicious attacks. However, as computers became more prevalent in the 1980s,
malware and cyber threats began to evolve and become more widespread.
- In the 1990s, the internet boom led to a significant increase in malware and
cybersecurity threats. The Melissa virus in 1999 was one of the first major internet-based
worms, spreading through email attachments. This was followed by the notorious
ILOVEYOU worm in 2000, which caused billions of dollars in damages.
- As technology continued to advance, so did the types of malware and cyber threats. The
early 2000s saw the rise of mass-mailing worms, which spread through email and
infected entire networks. In 2003, the Slammer worm caused massive disruption by
exploiting a vulnerability in Microsoft's SQL servers.
- In the late 2000s and early 2010s, malware and cyber threats became more sophisticated
and targeted. This included the emergence of ransomware, which encrypts a user's files
and demands payment for their release. In 2017, the WannaCry ransomware attack
affected over 200,000 computers in over 150 countries.
- Today, the evolution of malware and cyber threats continues with the rise of social
engineering attacks, such as phishing and smishing, and the use of artificial intelligence
by cyber-criminals. As technology advances, cybercriminals will find new and creative
ways to exploit vulnerabilities and compromise systems. Individuals and organizations
need to stay vigilant and up-to-date with cybersecurity measures to protect against these
evolving threats.
1
Faculty of Computer Science and Engineering
- Viruses are one of the most well-known types of malware. They are self-replicating
programs that attach themselves to clean files and spread from one computer to another
when the infected file is opened or executed. This can cause widespread damage to
systems and networks.
- Worms are standalone programs that do not need a host file to spread. They can
replicate themselves and spread through networks, usually through email attachments or
through vulnerabilities in software.
- Trojans are often disguised as legitimate software, but once installed, they can perform
malicious actions such as stealing sensitive information, deleting files, or damaging
systems.
- Ransomware is a type of malware that encrypts a user's files and demands payment for
their release. It can cause significant financial losses and disrupt operations for
individuals and organizations.
- Spyware and adware are typically installed on a user's system without their knowledge
and can collect sensitive information or display unwanted advertisements.
- One of the most commonly used disassembly tools is IDA Pro, which allows users to
disassemble and analyze binary code in multiple formats, including Windows, Linux, and
macOS.
- Another popular disassembly tool is Ghidra, which was developed by the National
Security Agency and released to the public in 2019. It is a free and open-source tool that
supports multiple languages and platforms.
2
Faculty of Computer Science and Engineering
- Other commonly used disassembly tools include Hopper, radare2, and Binary Ninja.
Each tool has its unique features and capabilities, and researchers and analysts need to
have a good understanding of them to effectively analyze and understand malicious code.
3
Faculty of Computer Science and Engineering
Dynamic analysis, on the other hand, involves executing the malware in a controlled
environment to observe its behavior in real-time, aiding in the identification of malicious
activities and functionalities. Additionally, code-reversing techniques, including
disassembly and decompilation, are crucial for translating machine code into a more
human-readable form, facilitating a clearer understanding of the malware's operations.
This section of the report delves into the nuances of these methodologies, emphasizing
their significance in unraveling the complexities of malicious code and enhancing the
overall efficacy of malware analysis practices.
Another pivotal aspect explored in the "Applications in Malware Analysis" section of the
report is the discussion on how disassembly tools significantly contribute to the
identification and comprehension of the functionality of specific malware types. In the
realm of ransomware, for instance, disassembly tools play a crucial role in dissecting the
encryption mechanisms employed by the malware to render files inaccessible. Analysts
utilize these tools to trace the code responsible for encryption, enabling a deeper
understanding of the ransomware's tactics and potential avenues for decryption.
When it comes to rootkits, disassembly tools assist analysts in uncovering the stealthy
techniques used by these malware types to evade detection and establish a persistent
presence on compromised systems. Through code analysis, analysts can identify the
rootkit's hooks into the operating system, revealing its efforts to manipulate system
functions and conceal its presence.
In the case of polymorphic malware, disassembly tools are instrumental in unraveling the
dynamic and shape-shifting nature of the code. Analysts can trace the code
transformations and variations, enabling a more adaptive and proactive approach to
counteract the ever-evolving strategies employed by polymorphic malware to evade
traditional signature-based detection methods.
This section of the report meticulously explores how disassembly tools serve as
indispensable assets in the analysis of distinct malware types, offering valuable insights
into their functionality, behavior, and evasion techniques. The nuanced understanding
gained through these tools empowers analysts to develop robust countermeasures and
fortify cybersecurity measures against evolving and sophisticated threats.
4
Faculty of Computer Science and Engineering
- In the realm of malware analysis, the juxtaposition of dynamic and static analysis serves
as a cornerstone for comprehensive threat understanding. While dynamic analysis
involves the execution of malware in a controlled environment to observe its behavior in
real-time, static analysis centers around the examination of the malware's code without
execution. The synergy between these two approaches proves most effective in certain
scenarios.
- This section of the report delves into the synergies between dynamic and static analysis,
emphasizing the nuanced scenarios where their combination proves most effective.
Furthermore, it highlights real-world examples where static analysis, driven by
disassembly tools, has been instrumental in unraveling the complexities of malware
threats.
5
Faculty of Computer Science and Engineering
- Obfuscation: The art of making code intentionally difficult to understand and analyze.
This is used to protect intellectual property, complicate debugging, and hinder reverse
engineering.
- Disassembly Tools: Software like IDA Pro, Ghidra, and Binary Ninja help reverse
engineers understand assembly code generated from compiled languages. These tools are
crucial in deobfuscating code by providing:
* Control Flow Obfuscation: This hides the actual execution path by adding jumps,
branches, and loops that don't contribute to the program's functionality. Disassembly
tools can help visualize the control flow and identify suspicious patterns.
* Data Obfuscation: Variables, constants, and strings are disguised using techniques like
encryption, encoding, or splitting. Disassemblers can analyze data structures and identify
suspicious operations on data.
* Instruction Reordering: Rearranging instructions can make the code appear more
complex and obscure its logic. Disassembly tools can identify common reordering
patterns and help reconstruct the original order.
* Anti-Debugging Techniques: Code can detect and bypass debuggers, making analysis
difficult. Disassemblers can provide information about debugger detection routines and
help identify their behavior.
* Virtualization and Packers: Obfuscation can be layered by running the code within a
virtualized environment or using packers to compress and encrypt the binary.
Disassembly tools can often identify and unpack these layers to reveal the underlying
code.
6
Faculty of Computer Science and Engineering
Practical Examples:
7
Faculty of Computer Science and Engineering
8.1. Function identification: Scripts can parse assembly code to identify function
prologues and epilogues, saving analysts from manually sifting through instructions.
Examples include:
* IDA Pro Python plugin: `idapython print_func()`: Automatically prints extracted
function signatures.
* Ghidra Script: `identify_functions.py`: Identifies functions based on call instructions
and stack manipulation.
8.2. Cross-referencing: Analyzing how different parts of the code interact is crucial.
Scripts can:
* Identify references to specific variables, functions, or data structures.
* Generate call graphs to visualize function interactions.
* Tools like IDA Pro's `xref` plugin, or Ghidra's "References" window can be
automated.
8.3. Pattern matching: Quickly discover specific code patterns indicative of known
vulnerabilities, encryption algorithms, or obfuscation techniques.
* Regular expressions or dedicated pattern-matching engines like IDA Pro's
"idc.find_binary()" can be used.
8.4. Data extraction: Automate the extraction of specific data types like strings, constants,
or network resources from the binary.
* IDA Pro scripts can directly access memory regions and extract data based on size
and type information.
* Ghidra scripts can utilize APIs like `Memory.getData()` for targeted data extraction.
8.5. Deobfuscation assistance: Certain scripts can automate tasks like constant decoding,
control flow flattening, or unpacking to simplify manual analysis.
* IDAPython plugins like `hexrays.dbg_decompiler` can assist with decompilation and
control flow analysis.
* Ghidra scripting allows custom deobfuscation logic to be implemented using Java.
Both manual and automated approaches have their strengths and weaknesses, and a
balanced approach is key to efficient and effective reverse engineering:
Manual Analysis:
8
Faculty of Computer Science and Engineering
* Advantages:
* Provides a deeper understanding of the code logic and intent.
* Can identify subtle nuances and context missed by scripts.
* More flexible for adapting to unexpected situations.
* Limitations:
* Time-consuming and prone to human error.
* Repetitive tasks can be tedious and demotivating.
* Can be biased by preconceived assumptions.
Automated Analysis:
* Advantages:
* Faster processing and reduced workload.
* Objective and consistent results.
* Can handle large datasets and complex patterns.
* Limitations:
* Requires careful script development and testing.
* Can miss important details or misinterpret context.
* Script errors can lead to false positives or missed vulnerabilities.
Remember, automation scripts are valuable tools, but they are not a magic bullet. They
should be used strategically and with a solid understanding of the underlying technical
concepts.
9
Faculty of Computer Science and Engineering
- The field of malware analysis faces many challenges and requires innovative solutions
to strengthen dismantling tools against evolving threats. In this essay, we address the
complexity of these challenges while highlighting the promising opportunities that lie
ahead.
- Zero-day malware is the ascent of zero-day malware that poses a significant hurdle.
Disassembly tools grounded in past information struggle to detect previously unseen
malware, particularly when attackers continuously refine their strategies, diminishing the
efficacy of signature-based approaches.
- Redundancy and irrelevant behavior are the presence of redundant and irrelevant
features in malware datasets, which pose a challenge for machine learning-based
dismantling tools. Effective management of these capabilities is essential to increase the
accuracy of malware detection models.
- Data protection In the context of the focus on malware detection, data protection
governance appears to be a central issue in malware analysis. Addressing this issue is
critical to maintaining user trust and ensuring compliance with ever-evolving privacy
regulations.
10
Faculty of Computer Science and Engineering
11
Faculty of Computer Science and Engineering
learning, human psychology, and computer engineering could lead to more robust and
widely used removal tools.
- As an essential tool in the cybersecurity professional's toolbox, removal tools play a key
role in detailed malware analysis. These tools allow analysts to uncover the complexity of
malicious code and gain a detailed understanding of its inner workings. By analyzing and
understanding the inherent complexity of malicious code, analysts can identify patterns,
characteristics, and potential vulnerabilities to formulate targeted and effective
countermeasures. Integrating removal tools into the arsenal of cybersecurity professionals
goes beyond the scope of reactive threat response. Rather, it puts them in a strategic
position to anticipate, adapt, and mitigate emerging threats with the precision necessary
to strengthen their defensive positions. Cyber security experts therefore make a
significant contribution to the continuous development of malware analysis practices,
ensuring their relevance and effectiveness in an ever-evolving digital landscape.
12
Faculty of Computer Science and Engineering
- As an essential tool in the cybersecurity professional's toolbox, removal tools play a key
role in detailed malware analysis. These tools allow analysts to uncover the complexity of
malicious code and gain a detailed understanding of its inner workings. By analyzing and
understanding the inherent complexity of malicious code, analysts can identify patterns,
characteristics, and potential vulnerabilities to formulate targeted and effective
countermeasures. Integrating removal tools into the arsenal of cybersecurity professionals
goes beyond the scope of reactive threat response. Rather, it puts them in a strategic
position to anticipate, adapt, and mitigate emerging threats with the precision necessary
to strengthen their defensive positions. Cyber security experts therefore make a
significant contribution to the continuous development of malware analysis practices,
ensuring their relevance and effectiveness in an ever-evolving digital landscape.
- In the ongoing battle against cyber threats, the effectiveness of malware analysis tools is
critical, especially as the repertoire of sophisticated malware continues to expand. In this
essay, we examine a series of case studies that highlight the diversity of malware types
and highlight the irreplaceable role of dismantling tools. Through before-and-after
analysis, these case studies illuminate the transformation path from an encrypted or
obfuscated state to an understandable code, demonstrating the versatility of disassembly
tools in diverse and complex scenarios. An illustrative case study involves a polymorphic
variant of malware that dynamically changes its code to evade detection by traditional
signature-based antivirus solutions. Disassembly tools are useful for removing complex
layers of obfuscation and revealing underlying patterns and features. The transformative
power of elimination becomes clear as analysts navigate the complex maze of obfuscated
code to ultimately reveal the true nature of the malware and formulate targeted
countermeasures. In another scenario, a lifeless malware strain that can only reside in
system memory presents a unique challenge to traditional analysis methods. Disassembly
tools that can analyze an application's runtime behavior provide a nuanced perspective.
Through detailed analysis of malware activity, dismantling tools uncover the hidden
operations of fileless malware and provide cybersecurity professionals with critical
insights to strengthen their defenses against these elusive threats. The ransomware case
study highlights the adaptability of dismantling tools. By examining the encrypted
ransomware payload, the uninstaller facilitates the recovery of the decryption process,
thereby providing the key to unlock the malicious encryption. This transformative
capability not only makes it easier to recover encrypted data but also contributes to the
13
Faculty of Computer Science and Engineering
development of decryption tools that can counter the effects of ransomware on a larger
scale. The versatility of dismantling tools is illustrated using a case study of a rootkit that
hides its presence in an operating system. By dismantling it, analysts decipher the
rootkit's hidden mechanisms and expose its hooks in the system kernel. This before-and-
after analysis not only uncovers rootkit tactics but also enables cybersecurity
professionals to develop effective detection and removal strategies.
- Overall, these case studies demonstrate the irreplaceable role of dismantling tools in the
dynamic landscape of malware analysis. By providing information about the encrypted or
obfuscated state of various types of malware, disassembly tools act as a crutch to
decipher their complexity. Before-and-after analyses show how dismantling tools
transform seemingly impenetrable code into an understandable format, enabling
cybersecurity professionals to proactively understand, mitigate, and protect against an
ever-evolving range of cyber threats. In summary, the case studies presented here
demonstrate the valuable contribution of dismantling tools to deciphering the complex
structure of modern malware. As the cyber threat landscape continues to evolve, these
tools remain a cornerstone of cybersecurity professionals' arsenal, enabling them to
navigate the complexities of different types of malware and strengthen their defenses
against the ever-evolving tactics of malicious actors.
14
Faculty of Computer Science and Engineering
Lab Analysis
1. Introduction
- To give a better understanding of how malware works, we are going to analyze Lab03-03.exe by
using basic dynamic analysis tools
- In the specific case of Lab03_3, notable observations can be made when monitoring the
malware with Process Explorer:
15
Faculty of Computer Science and Engineering
- When monitoring this malware with Process Explorer, one prominent observation is the
brief spawning of svchost processes. Both processes vanish shortly after being spawned,
indicating a potentially evasive behavior.
- Upon closer inspection of the memory strings associated with the running svchost
processes, it becomes evident that the malware has employed process replacement,
commonly known as process hollowing. This technique allows the malware to execute
under the guise of a legitimate svchost process, making its presence more challenging to
detect.
- In summary, Process Explorer proves instrumental in unveiling the malware's tactics, such
as process replacement and evasive behaviors, during real-time monitoring. These
observations contribute significantly to the overall understanding of the malware's
runtime behavior and aid in the identification of potential countermeasures.
- The identification and analysis of live memory modifications are paramount in the
thorough examination of malware, offering valuable insights into the dynamic behaviors
of malicious processes. In the context of Lab03_3, specific observations about live
memory alterations have been carefully noted.
- In our malware analysis endeavors, a noteworthy technique for monitoring live memory
changes revolves around an in-depth examination of the strings within the live memory
of the svchost process. This meticulous scrutiny enables analysts to discern discrepancies
16
Faculty of Computer Science and Engineering
between the content in memory and its corresponding data on disk, thereby uncovering
any significant deviations.
17
Faculty of Computer Science and Engineering
- The discerned variance between the live memory and disk-resident strings clearly
indicates a potential code injection technique employed by the malware. Code injection
allows the malicious entity to execute its deleterious code within the legitimate context of
a process, such as svchost, thereby augmenting the complexity of detection and analysis.
- Live memory modifications, particularly those involving code injection, often serve as
sophisticated evasion and stealth mechanisms for malware. The dynamic alteration of
code within memory enables the malware to elude static analysis techniques and security
measures reliant on examining file structures on disk.
18
Faculty of Computer Science and Engineering
artifacts that can be found on the infected system, indicating the presence of malware.
These can include file names, registry keys, and system changes made by the malware.
Host-based indicators can be used to detect and analyze malware and identify potential
weaknesses and vulnerabilities in the system.
19
Faculty of Computer Science and Engineering
20