Recently I have noticed more use of .lnk files used in malware distribution via email. These files are Windows Shortcut files, typically used for shortcuts on your system, such as on your desktop. The use of .lnk files in emails is not new, but a recent sample caught my eye and I took a closer look. The original email, as it would appear to the recipient, looked like this, purporting to be from an individual at Automatic Data Processing, and containing what looks to be a PDF document and a ZIP archive.
However, our Trustwave Secure Email Gateway had a slightly different view of the message, identifying the "statement.pdf" file as an executable, and showing a number of .lnk files in the ZIP archive, as well as another copy of the executable.
So what's going on here? My initial questions were why rename the executable file with a .pdf extension as it won't execute for the user? Also, why all the .lnk files? A closer look at the .lnk files show that they are identical. Their properties reveal a clue to what is going on. The target runs cmd.exe in the current directory and executes "statement.pdf" with a /c option, which simply means "Carry out the command specified by string and then terminate".
When one of the .lnk files is clicked, it effectively runs the "Statement.pdf" executable, regardless of the fact that it has a .pdf extension. Why should this be so? It turns out that this is a feature of cmd.exe, documented by Microsoft here. Cmd.exe uses the Kernel32 API function CreateProcess that examines the file's contents for executable headers, and if found, executes the file regardless of its extension.
So, assuming the user clicks on "Statement.pdf" first, and finds out that nothing happens, that user may then feel compelled to extract the contents of the zip file and see a series of "parts". These parts do not show a .lnk extension because these are hidden on Windows (think of your desktop shortcuts). But when clicked, the malware is executed, and the user's machine is now infected. In this case, the malware was an Upatre downloader, VirusTotal report here for those interested.
You have to wonder how many users would actually go through that many steps to check out an un-solicited email! But the ruse does have a few things going for it. The email would bypass any email gateways that seek to block executables based just on file extension, as opposed to examining the file contents. And if the email gets to the user, the file attachments appear to be a "harmless" PDF file. The .lnk files provide a way to invoke cmd.exe to run the renamed executable.
Shortcut files have also been observed by others in recent email targeted attacks, for example see here and here. Clearly, they are something to lock down in your email gateway policy. People shouldn't have too much need to email shortcut files into your organization, and if they do, then find another way to accommodate the file transfer. The Trustwave Secure Email Gateway blocks all .lnk files by default.