Diving deeper into process injection
In this section, we will cover the intermediate to advanced techniques of process injection. These techniques leave no trace on a disk and can enable fileless malware to maintain persistence. Before we cover these techniques, let’s talk about how the malware finds the process that it wants to inject into – in particular, how it gets the list of the running processes with their names and Process IDs (PIDs).
Finding the victim process
For malware to get a list of the running processes, the following steps are generally followed:
- Create a snapshot of all the processes running at that moment. This snapshot contains information about all running processes, their names, PIDs, and other important information. It can be acquired using the
CreateToolhelp32Snapshot
API. Usually, it is executed whenTH32CS_SNAPPROCESS
is given as an argument (to take a snapshot of the running processes, not threads or loaded libraries). - Get...