Lets admit, stack strings sometimes could be a lot of pain. They are one of the favorite method of malware authors to hide static strings without going. The stack strings allows them to hide strings in plain sight[so to say] and avoids use of complicated obfuscation techniques. While authors can use packers instead but analysts can these days easily identify the packed malware based on entropy level. Indeed the knowledge that sample is packed itself can help analysts to take different approach instead of wasting time in reading packed code.
But stack strings leave no hints behind[mostly]. Thus analysts may loose critical source of information to create good Host or Network signatures of malware for early detection.
Let us take following piece of malicious file:
Unknwown.exe
If we use Strings utility from Sysinternals suite we get following output:
These are utter nonsensical strings that carry no information for us. This is not defect of Strings utility really. It is designed to look for contiguous blocks of memory that contain printable ASCII characters terminated with null. The important word here is contiguous.
The malware authors exploit this, by storing parts of string separately. Then they construct the relevant string at run time by pushing these individual parts on stack and retrieving full string by pop. Look at the following code:
The code belongs to same file we ran Strings utility on. The parts of strings are separately stored and pushed on stack. Later a single pop would retrieve a pointer to whole string.
It is not that Strings utility entirely missed these strings. We may miss these due to one of following two reasons:
- the length of individual string part is smaller than -n option set in Strings utility
- the individual parts were nonsensical in themselves thus we may not be able to recognize them as part of larger sensible string


No comments:
Post a Comment