Mastering API hooking techniques
In this section, we’ll dive into API hooking techniques and provide practical examples.
What is API hooking?
API hooking is a method that’s used to manipulate and alter the functionality and sequence of API calls. This technique is frequently used by different antivirus (AV) solutions to identify whether a given piece of code is malicious.
Practical example
Before hooking Windows API functions, it is essential to consider the scenario of using an exported function from a DLL.
This section will provide an illustrative instance of this wherein a DLL is used that contains the logic at https://github.com/PacktPublishing/Malware-Development-for-Ethical-Hackers/blob/main/chapter02/04-api-hooking/pet.cpp.
The DLL under consideration exhibits a set of basic exported functions, including Cat
, Mouse
, Frog
, and Bird
, each of which accepts a single parameter denoted as message
. The simplicity of this function’s logic is evident...