In-depth analysis of malware shows different methods of obfuscating their codes. They employ different tactics to hide themselves to harden analysis. They also dynamically load functions that they will be using. Those functions more often times called API (Application Programming Interface) are commonly loaded when we run an application.
Malware authors also use dynamic function loading to enable itself to adapt to different operating system. They use it to enable their program to run on Windows XP, Vista, Windows 7 or other platform.
Common practice is to list all function names as an array of strings to be loaded once the application is running. They used a combination of LoadLibrary and GetProcAddress functions to get the proper addresses. Still some try to use other techniques of getting those addresses without even using those two functions.
Let’s take a closer look at how W32/Bredolab.AC!tr.dldr resolved its API addresses.
W32/Bredolab.AC!tr.dldr did not use a list of API strings, instead it uses a list of hash values equivalent of the APIs. The hash is computed as below:
These are the steps how the malware got the right API addresses without using LoadLibrary and GetProcAddress functions.
Step 1:
It first copies the DLL file that it needs in a “%temp%” folder with TMP??.tmp as the filename(?? is a 2-digit number).
Step 2:
It then loads the TMP??.tmp to its address space.
Step 3:
After loading the tmp file which is the equivalent dll file, it can now work on parsing it. It parses its content, technically in the export table to get the list of function names. It then computes a hash value for each name and compare it to its own list.
Once it gets the right hash value, it then gets the address of the function. And it starts back on Step 1 till it gets all the addresses it needs.
This technique of getting API addresses is not new. But it still serves as a basis of how malware works. Malware authors go to some lengths just to try to make analysis harder. I imagine that this is not even half of what the malware does.





Twitter
FaceBook
LinkedIn
YouTube