Lecture 2
Lecture 2
Analysis
Static Analysis
During your analysis, determining the file type of a suspect binary will help
you
identify the malware's target operating system (Windows, Linux, and so on)
and architecture (32-bit or 64-bit platforms).
.ocx, and so on), then you can deduce that the file is designedto target
Determining the File Type
Most Windows-based malware are executable files ending with extensions such
as
.exe, .dll, .sys, and so on. But relying on file extensions alone is not
recommended. File extension is not the sole indicator of file type. Attackers use
different tricks to hide their file by modifying the file extension and changing its
appearance to trick users into executing it. Instead of relying on file extension,
File signature can be used to determine the file type.
Identifying File Type Using Manual
Method
The manual method of determining the file type is to look for the file signature
by
opening it in a hex editor.
A hex editor is a tool that allows an examiner to inspect each byte of the file;
most hex editors provide many functionalities that help in the analysis of a file.
The following screenshot shows the file signature of MZ in the first two bytes
when an executable file is opened with the HxD hex editor.
Fingerprinting the
Malware
Fingerprinting involves generating the cryptographic hash values for the suspect binary
based
on its file content. The cryptographic hashing algorithms such as MD5, SHA1 or SHA256 are
considered the de facto standard for generating file hashes for the malware specimens. The
malware sample can use different filenames, but the cryptographic hash that is calculated
based on the file content will remain the same. Hence, a cryptographic hash for your
or drop another piece of malware. Having the cryptographic hash of the sample can help in
identifying whether the newly dropped/copied sample is the same as the original sample or a
different one. This information can assist you in deciding whether the analysis needs to be
3.File hash is frequently used as an indicator to share with other security researchers to help
4.File hash can be used to determine whether the sample has been previously detected by
searching online or searching the database of multi Anti-virus scanning service like
VirusTotal
Scanning the Suspect Binary with
VirusTotal
VirusTotal (http:/ / www. virustotal. com) is a popular web-based malware scanning service.
It allows you to upload a file, which is then scanned with various anti-virus scanners, and the
scan results are presented in real time on the web page. In addition to uploading files
for scanning, the VirusTotal web interface provides you the ability to search their database using
COFF (Common Object File Format) header: Describes the file's format and architecture
Optional header: Contains information about the executable, including its size,
required subsystem, and the address of the entry point
Section headers: Describe the layout of the file's sections and their characteristics, such
as their size, permissions, and location in memory
You can inspect the PE header information of a Windows executable file using a tool such
as Microsoft's PEview or a hex editor.
Analyzing The PE
Header
The PE header contains the information the OS requires to run the executable.
In static analysis, we are looking for information about the executable, that can give us a
3. Sections - Is the executable packed and are there any inconsistent permissions.
4. Libraries & Imports - What libraries and imports are being used, and what information do they
Windows exports most of its functions, called Application Programming Interfaces (API),
Executables import and call these functions typically from various DLLs that provide different
functionality. The functions that an executable imports from other files (mostly DLLs) are called
If a malware executable wants to create a file on disk, on Windows, it can use an API
CreateFile(), which is exported in kernel32.dll. To call the API, it first has to load kernel32.dll
Inspecting the DLLs that a malware relies upon and the API functions that it imports
from the DLLs can give an idea about the functionality and capability of malware and
what to
anticipate during its execution. The file dependencies in Windows executables are stored
Often, attackers store information such as additional binary, decoy documents, and
configuration data in the resource section, so examining the resource can reveal valuable
The resource section also contains version information that can reveal information about the
and extract the resource from a suspect binary. Let's take an example of binary that looks
like an Excel file on the disk (notice how the file extension is changed to .xls.exe), as shown
here:
Loading a malicious binary in resource hacker shows three resources (Icon, Binary, and
Icon
Group). The malware specimen uses the icon of Microsoft Excel (to give the appearance of
Examining PE
Resources
The executable also contains binary data; one of them has a file signature of D0 CF 11 E0 A1
B1
1A E1. This sequence of bytes represents the file signature for a Microsoft Office document
file. The attackers, in this case, stored a decoy excel sheet in the resource section. Upon
execution, the malware is executed in the background, and this decoy excel sheet is displayed
Save Resource to a *.bin file. In this case, the resource was saved as sample.xls.
The following screenshot shows the decoy excel sheet that will be displayed to
the user: