How TeamSpy Turned Legitimate TeamViewer App Into Cyberespionage ToolAttackers abused TeamViewer's functionality as part of their effort to go undetected for years
The discovery of the so-called TeamSpy espionage campaign marks yet another example of malware sliding under the radar while pilfering data from sensitive systems. But perhaps the most striking element of the attack is its abuse of a legitimate remote access tool (RAT) to administer infected machines.
TeamSpy is a cyberespionage operation targeting government agencies, businesses, and activists that may stretch back as far as roughly a decade. Many of its victims appear to be from Europe. The crew took advantage of the functionality of the TeamViewer application, which is used for remote control, Web conferencing, desktop sharing, online meetings, and transferring files between computers.
The malware installs a version of TeamViewer on infected systems. The attackers then extend TeamViewer's functionality to provide additional stealth, dynamically patching it in memory to remove indications of its presence.
"This set of TeamSpy attacks is unique for a number of reasons, including the attackers' use of TeamViewer, and then extending TeamViewer functionality on target desktops with a DLL hijacking exploit," explains Kurt Baumgartner, senior security researcher at Kaspersky Lab.
The DLL hijacking occurs courtesy of a module called Avicap32, which contains a PE EXE file written in Assembler. That file is stored in the same folder as TeamViewer.exe, and when TeamViewer is launched it will "show no warning, no popups, no systray icons and will silently continue working providing remote access to the infected machine," Kaspersky Lab notes in a report examining the attacks.
"This module not only disables TeamViewer popups but also extends its functionality to the classical HTTP bot supporting a set of commands," according to the report. "This module installed with Teamviewer 6 allows the attackers to access computer desktop remotely, activate webcam or microphone, download or upload files to the infected machine and many more."
Dr. Boldizsar Bencsath, of Laboratory of Cryptography and Systems Security (CrySyS Lab) at the Budapest University of Telecommunications and Economics, says he is not all that surprised to see a legitimate remote access tool used in this way.
"If hackers attack a Linux server, they also abuse regular Linux tools; for many things they don't have to write malware -- just reconfigure or start them to use," he says. "It is a good trick that they don't write the whole tool, just a part, and [antivirus] companies can't set a signature on TeamViewer itself, just for the small malicious modification, which then can be easily modified if detected.
"Of course, it's not that tricky, not impossible to be detected, but if there is no reason for the user to check, it won't be that easy to see he or she has a problem."
In its analysis of TeamSpy, CrySys Lab observed that TeamViewer had also been leveraged in the "Sheldor" attack campaign, which was detected between 2010 and 2011 and resulted in between $600,000 and $832,000 in assets being stolen. Though there were also similarities in command-and-control traffic between the campaigns, CrySys Lab researchers stopped short of saying the campaigns were connected beyond the tool level.
Once inside a network, targeted attackers may attempt to blend in by using legitimate tools and stolen credentials from the network, Kaspersky's Baumgartner says, but he would not call what happened with TeamViewer "common." The most unique aspect of the attack, he opines, is that an almost decade-long cyberespionage operation relied heavily on a digitally signed, well-known RAT.
TeamViewer spokesperson Magdalena Brzakala said in a statement that the presence of the avicap32.dll is an indication of infection, and that users should patch their systems and run up-to-date antivirus to deal with attacks.
The exact number of victims is not known, but security researchers at CrySys Lab and Kaspersky Lab believe the number is less than 1,000.
"An overall number is hard to arrive at, because the operation ran for almost a decade across multiple command and control servers," according to Baumgartner. "I would say overall, victims ran into the high hundreds, partly because of the inefficiencies of running watering hole schemes."
Have a comment on this story? Please click "Add Your Comment" below. If you'd like to contact Dark Reading's editors directly, send us a message.