Encoding/decoding – XOR Deobfuscation
You will come across the XOR Boolean operation being used for initialization of variables as xor eax,eax
or as an elementary obfuscation device. In the following simple C code, you can trace through sample XORing de-obfuscation of an ASCII string with a single static key and a dynamic key. You can also make use of string matches and brute-forcing (static key in this sample, you can easily replace it or embellish it with the dynamic key using one line of code, try it) function to get an idea as to how it may be used by malware. Use the locals window in VC++ to check the variable values within the loop and function scopes:
#include "stdafx.h" #include <conio.h> #include <string.h> #include <stdio.h> #include ...
Get Windows Malware Analysis Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.