Visual Basic Rises Again as a Document Malware Scripting Language

With a nod to the past success of macro viruses, more than one-quarter of all document malware now spreads via Microsoft's Visual Basic scripting language.

Visual Basic Malware B

In July 1995, a proof-of-concept macro virus, fittingly known as "Concept," started infecting Microsoft Word documents using a Visual Basic script to copy itself to the default template file.

For six years after that, macro viruses written in Visual Basic for Applications (VBA) dominated the rogues gallery of malicious software, supplanting boot-sector viruses as the top method of propagating code. And then, in 2001, the technique became nearly extinct, as Internet worms became the favored infection method.

Now, document malware written in Visual Basic is once again on the rise, according to an analysis by researchers at security firm Sophos. Macro-based infectors accounted for 28 percent of all document malware in July 2014, up from 6 percent the previous month. The rise in usage is likely due to common macro templates being shared between criminal groups, Sophos researcher Graham Chantry said in an email statement to eWEEK.

"Up until now we could only speculate as to why authors moved towards VBA, but these templates would go some way to explaining it," he said. "Getting malware installed on a user’s machine is one of the most difficult parts of the infection process, and with some companies explicitly blocking executable attachments, a VBA template ... provide(s) the perfect solution."

Like the macro viruses of the past, a significant number of current malware threats used Visual Basic to encode functionality within documents. In the mid-1990s, the success of Concept in the mid-1990s gave birth to a litany of similar viruses that used the lack of anti-malware technology to spread quickly through email attachments.

The Melissa (1999), LoveLetter (2000) and Kournikova (2001) viruses all spread widely, infecting hundreds of thousands of systems. Each program used Visual Basic for Applications, a programming language used for creating macros in Microsoft Office.

In 2001, however, macro viruses essentially died off and, with Microsoft disabling macros by default in Office 2007, the technique was largely bypassed for more productive techniques.

That is until this year. In a paper published in July, Sophos researcher Gabor Szappanos described the uses of VBA in current malicious documents. Most often, the programming language is used to drop code. However, Microsoft's security settings require that the attackers contrive some way to convince user to allow macros to run.

The result is that cyber-criminals are creating documents that claim to need macros to run, including declaring that other software is necessary to open the document or claiming the message is from an antivirus company, according to a blog post published in September by Sophos's Chantry. One example declared that the "contents of the document have been encrypted by SOPHOS encryption software."

"Whatever tricks they employ, their aim is always to convince unsuspecting users that a document is from a trusted source and that enabling its macros is safe," Sophos's Szappanos stated in his analysis.

Visual Basic is not the only scripting language targeted by attackers. Windows task automation utility software, PowerShell, AutoIt and Batchscript have all been used as well.

"Adding new layers to the infection process is likely an attempt by malware authors to conceal their true intentions from AV detection," Chantry told eWEEK.

Robert Lemos

Robert Lemos

Robert Lemos is an award-winning freelance journalist who has covered information security, cybercrime and technology's impact on society for almost two decades. A former research engineer, he's...