Bi-Directional Trickery, (╯°□°)╯︵ oןɹ

Malware1

Level 76
Thread author
Sep 28, 2011
6,545
Malware authors are known to try various obfuscation techniques in order to hide their malware. The Unicode Right-to-Left trick (RLO), which has been known for quite some time, has been reported again by security firm F-Secure, showing its resurgence.

In their report, a signed Apple program was disguised to hide its true nature and install a piece of malware.

This prompted me to examine this technique in greater detail. This is a neat trick that deserves a proper explanation.


To understand how this works you need to know what Unicode is: an international encoding standard for use with different languages and scripts.

This allows computers, in our case, to display characters in special ways. The feature abused here is the “Right-to-Left” function. This would most commonly be used when displaying a language that is read in such a fashion, such as say Arabic, or Hebrew, to name a few.

This means that a cleverly named executable, manipulated in such a way, could be made to appear as something other than what it really is.

Windows XP requires specific configuration changes to enable support for this feature. We can use it to demonstrate what the file looks like, if an operating system does not know how to display RLO properly. This is useful to visualize where the flip point is inserted. Here is Windows XP, displaying my test file:

xp_white-box-300x130.png


The white box in the filename is the RLO unrecognized, thus not reading from right to left. This makes it easy to spot our file as an executable. Once the flip occurs the “cod” will appear as “.doc” completing the illusion.

Native support for this feature has been present since Windows Vista. Here is the same file, on a Windows 7 system:

win7_RLO2.png


I chose a filename that completed the illusion but didn’t look suspicious. You could also have multiple RLO insertions to accommodate a different name that would not need to end in “exe.” I also took it a step further, by modifying the embedded icon of the executable, to make it appear as a word document. Another common file extension used with this technique is “.scr,” which is used for screen savers.

Although this particular example was crafted for the PC, on a PC, I decided to copy it over to other machines in our lab, to see how it would be displayed. Here is the same file, on a Linux machine:

linux_rlo_gui-300x194.png


Since Linux cannot execute windows PE files, the threat is greatly reduced, but the file name is still being shown with the “.doc” file extension. Examining the same file from a command line environment reveals it’s true nature:

linux_rlo_bash1.png


And again, on a mac:

mac_RLO_gui-300x234.png


As it was originally crafted for a PC, this doesn’t work very well. The OSX command line also displays the file correctly:

OSX_RLO.png


However the autocomplete feature built into the command line of OSX briefly shows the file the other way:

OSX_RLO_autocomplete.png


A common vector for such files would be via e-mail, and unless the file was compressed in a zip, executables are disallowed. I tried sending the file via Gmail, and received an interesting error:

gmail_RLO.png


This message is Gmail, informing me that executables aren’t allowed.

And there you have it! Right-to-left functionality abused to try and cloak the file extension of an executable. This is by no means a new vulnerability, but still an interesting vector.

http://blog.malwarebytes.org/intelligence/2013/07/bi-directional-trickery-%E2%95%AF%E2%96%A1%E2%95%AF%EF%B8%B5-o%D7%9F%C9%B9/

I also found simillar sample, but I don't know where I saved it :( It was uploaded in one of last packs.
 

McLovin

Level 76
Verified
Honorary Member
Malware Hunter
Apr 17, 2011
9,224
Didn't know about that in Windows XP and Windows 7. So in theory it's harder to recognise malware in Windows 7 and Vista?
 

About us

  • MalwareTips is a community-driven platform providing the latest information and resources on malware and cyber threats. Our team of experienced professionals and passionate volunteers work to keep the internet safe and secure. We provide accurate, up-to-date information and strive to build a strong and supportive community dedicated to cybersecurity.

User Menu

Follow us

Follow us on Facebook or Twitter to know first about the latest cybersecurity incidents and malware threats.

Top