Microsoft's core set of application programming interfaces available in Windows operating systems.
The Portable Executable (PE) file format is a file format for executables, object code, DLLs, FON Font files, and others used in 32-bit and 64-bit versions of Windows operating systems. The PE format is a data structure that encapsulates the information necessary for the Windows OS loader to manage the wrapped executable code. This includes dynamic library references for linking, API export and import tables, resource management data and thread-local storage (TLS) data.
Understanding the PE file format is crucial in malware analysis as it provides valuable information about the potential malware, which can be used to determine its functionality and potential impact.
A PE file consists of a number of headers and sections that tell the dynamic linker how to map the file into memory. The headers are at the beginning of the file, while the sections follow them. The headers provide a directory of the file's contents, specifying, among other things, the size and location of the sections.
The sections contain the information necessary to create a process image, i.e., code, data, resources. Each section is defined by a section header that gives the name, size, and location of the section, among other things.
Malware often comes in the form of PE files. By analyzing the PE file structure, an analyst can gain insights into what the file does and how it works. For instance, the Import Address Table (IAT), which is part of the PE file structure, can tell analysts which system calls the malware is using. This can provide clues as to what the malware might be doing.
Malicious PE files often have certain characteristics that can be used to identify them. These include:
Anomalies in the header: Malware authors often manipulate the PE header to create files that are difficult to analyze or that evade detection. For instance, they might set the size of the image in the PE header to a very large value to cause a buffer overflow.
Suspicious section names: The section names in a PE file are arbitrary and can be chosen by the programmer. Malware authors often use unusual section names to hide malicious code.
Large amounts of data in unexpected sections: Malware authors often hide data in sections where data is not usually found, such as the text section.
Unusual import functions: Malware often imports functions that are not typically used by legitimate software, such as functions for keylogging or network communication.
By understanding the basics of PE files, you can start to analyze potential malware more effectively, identifying suspicious characteristics and behaviors. This knowledge forms a crucial foundation for the rest of your malware analysis journey.