Malware Analysis
Malware Analysis
What is Malware?
- Malware is a malicious program or software that inserts into
a system, with the intention of compromising CIA(Confidentiality,
Integrity, Availability).
Types of Malware:
- Virus: Malicious software inserted into a program or data
file.
- Trojan: disguised as legitimate files but something else,
attacker embedded malicious software into legitimate file.
- Worm: self replicating program, spear over network.
- Backdoor: open backdoor to C&C instruction. Like
RAT(remote access tool)
- Ransomware: malicious program that encrypts victim files
and asks for money to decrypt.
- APT (Advanced persistent threat): state-sponsored
group-create malware to remain undetected for an extended
period.
EX:
Rootkits Bootkits
-Designed to hide the existence -Rootkit + Boot
of certain processes from normal -Are Rootkits in which the first
methods of detection, in order to point of control is during the
enable continued access to a boot process that allow the
computer. malicious program to be
EX: flame, stuxnet executed before OS boot.
- PUPs(Potentially unwanted programs): they are programs
which don’t do anything good, usually bundled with other
useful software.
- PUPs are not malware because you agree to install it.
_________________________________________________
___________________________________________
Note: to do dynamic analysis you need to safe and isolated
environment to run malware, so that your device is not
infected with this malware.
So we need to setup a VM to run as a sandbox.
Basic Static analysis
_____________________
1.Anti-virus Scanning
- Antivirus detected based signature or heuristics or
behavior or ML
- Antivirus Action: Quarantine or delete
- Scan can be offline by installing any vendor AV or
online by searching any virustotal as example.
2.Hash Scanning
- PE header contain:
- Signature: PE -> 50 54
- File header: number of section, time stamp,
characteristics
- Optional header: address of entry point, image bass,
size of image
- We can analyze PE header by
PEstudio:
open PEstudio -> drop your file
look for DOS header to know end of header
Optional header contains Address of entry point
->(normal PE.txt)
look for section header and Directory
- Data Directory:
contains two section: import table and export table
● Import table: contain function that malware
imports from windows libraries
● Common libraries:
● user32.dll ->contain all user interface
component
● Gd32.dll -> contain display and manipulate
graphic
● Wsock32.dll -> contain high and low level
networking function
● Export table: export from dll
________________
Note: Naming conventions:
.dll end with A -> ASCII string version
.dll // // W -> Wide char string
.dll // // EX -> updated function
_____________________
- PE section: contains the executable code.
- stores global data accessed throughout the program
_____________________________
Note:
we can run malicious file by double-click if it’s .exe but how to
run non .exe file
First check its function by PEstudio or CFFexplorer
Then if .dll file open CMD write rundll (file name)
1.Process monitoring
_____________________________
- Malware configured to run during system bootup or
login (persistence)
- To detect this malware we use autoruns tool
- Startup malware can be in startup folder, Registry
and other location
- Autoruns scan every thing for detect it
- Windows API
Is a set of functions documented by windows, that allows
software to interact with the operating system
- Malware writers used windows API and we used process
monitor tool to detect them
- When you run process monitor reduce background
noise like (search indexer - Explorer.exe - svchost.exe)
- We can add filters to detect each process
- Procmon get its event by monitor windows API class
______________________________
Note: to analyze (process/ file system/ registry/ network) we can
use the procdot tool.
- install procdot
- install dot.exe and call it in procdot
- Save all event from procmon as .csv without sequence
number and with threat ID
- Then choose launcher process
2.File System activity
- Write:
- write to its config file
- Encryption (Ransomware)
- Delete:
- delete user’s file or delete itself
- delete file after encryption (Ransomware)
- Upload:
- exfiltrate data from the victim
- send encryption key to the server
- Lateral movement:
- to infect other machines in the same network
Note:
- nslookup : windows command line to translate domain name
into IP
- FakeNet-NG: make fake connection and save all traffic in
pcap file