Obfuscation of the API and assembly code
Obfuscation of API and assembly code is a technique that’s employed to hinder reverse engineering efforts by making it difficult for disassembly analysis tools to accurately understand the functionality of a program. This technique involves intentionally complicating the code or data structures within a program to confuse disassemblers, resulting in a misleading program listing.
This is typically accomplished through the use of API hashing, a process in which names of API functions are replaced by a hashed value.
Practical example
Let’s cover a practical example to understand this.
We won’t cover the hashing algorithm and its importance in malware development here; we will discuss this topic at length in Chapter 9. We will only write the source code here.
First of all, we will write a simple PowerShell script for calculating a hash of a given function name. In our case, it’s a CreateProcess
string: