Posted by Virus Bulletin on Jun 9, 2011
Spaces and tabs used to encode into binary.
Researchers at Kaspersky have discovered a malicious PHP script that uses an inventive way to obfuscate its malicious behaviour.
The script, found on a Polish online store, dynamically adds some remotely linked malicious code into the website's HTML. What is probably more interesting is the way the malware's authors went about obfuscating the script's behaviour.
Apart from an unusual way of using comments - which may initially suggest the code itself is commented out - the code contains what looks like a large amount of white-space. However, upon further inspection, the white-space consists of a mix of spaces and tabs. The script decodes this into a binary string of ones (tabs) and zeroes (spaces), which is then converted to decimal values and then finally into ASCII characters containing the actual bad code.
Malware authors regularly use this kind of obfuscation. At the recent VB Seminar, TrustDefender's Alex Shipp explained this is done to frustrate malware researchers: the extra time they have to spend de-obfuscating the malware to stop its malicious behaviour means the malware can stay undetected for a longer period of time, thus increasing the chances of it being used for its malicious intentions.