The malware detected by Kaspersky Anti-Virus as TDSS is the most sophisticated threat today. TDSS uses a range of methods to evade signature, heuristic, and proactive detection, and uses encryption to facilitate communication between its bots and the botnet command and control center. TDSS also has a powerful rootkit component, which allows it to conceal the presence of any other types of malware in the system.
Its creator calls this program TDL. Since it first appeared in 2008, malware writers have been perfecting their creation little by little. By 2010, the latest version was TDL-3, which was discussed in depth in an article published in August 2010.
The creators of TDSS did not sell their program until the end of 2010. In December, when analyzing a TDSS sample, we discovered something odd: a TDL-3 encrypted disk contained modules of another malicious program, SHIZ.
TDL-3 encrypted disk with SHIZ modules
At that time, a new affiliate program specializing in search engine redirects had just emerged on the Internet; it belonged to the creators of SHIZ, but used TDL-3.
The changes that had been made to the TDL-3 configuration and the emergence of a new affiliate marketing program point to the sale of TDL-3 source code to cybercriminals who had previously been engaged in the development of SHIZ malware.
Why did the creators of TDL decide to sell source code of the third version of their program? The fact is that by this time, TDL-4 had already come out. The cybercriminals most likely considered the changes in version 4 to be significant enough that they wouldn’t have to worry about competition from those who bought TDL-3.
In late 2010, Vyacheslav Rusakov wrote a piece on the latest version of the TDSS rootkit focusing on how it works within the operating system. This article will take a closer look at how TDL-4 communicates with the network and uploads data to the botnet, which numbered over 4.5 million infected computers at the time of writing.
The way in which the new version of TDL works hasn’t changed so much as how it is spread - via affiliates. As before, affiliate programs offer a TDL distribution client that checks the version of the operating system on a victim machine and then downloads TDL-4 to the computer.
Affiliates spreading TDL
Affiliates receive between $20 to $200 for every 1,000 installations of TDL, depending on the location of the victim computer. Affiliates can use any installation method they choose. Most often, TDL is planted on adult content sites, bootleg websites, and video and file storage services.
The changes in TDL-4 affected practically all components of the malware and its activity on the web to some extent or other. The malware writers extended the program functionality, changed the algorithm used to encrypt the communication protocol between bots and the botnet command and control servers, and attempted to ensure they had access to infected computers even in cases where the botnet control centers are shut down. The owners of TDL are essentially trying to create an ‘indestructible’ botnet that is protected against attacks, competitors, and antivirus companies.
One of the key changes in TDL-4 compared to previous versions is an updated algorithm encrypting the protocol used for communication between infected computers and botnet command and control servers. The cybercriminals replaced RC4 with their own encryption algorithm using XOR swaps and operations. The domain names to which connections are made and the bsh parameter from the cfg.ini file are used as encryption keys.
Readers may recall that one of the distinguishing features of malware from the TDSS family is a configuration file containing descriptions of the key parameters used by various modules to maintain activity logs and communications with command and control servers.
Compared to version 3, there are only negligible changes to the format of the configuration file. The main addition is the bsh parameter, an identifier which identifies the copy of the malware, and which is provided by the command and control sever the first time the bot connects. This identifier acts as one of the encryption keys for subsequent connections to the command and control server.
Upon protocol initialization, a swap table is created for the bot’s outgoing HTTP requests. This table is activated with two keys: the domain name of the botnet command and control server, and the bsh parameter. The source request is encrypted and then converted to base64. Random strings in base64 are prepended and appended to the received message. Once ready, the request is sent to the server using HTTPS.
The new protocol encryption algorithm for communications between the botnet control center and infected machines ensures that the botnet will run smoothly, while protecting infected computers from network traffic analysis, and blocking attempts of other cybercriminals to take control of the botnet.
Just like Sinowal, TDL-4 is a bootkit, which means that it infects the MBR in order to launch itself, thus ensuring that malicious code will run prior to operating system start. This is a classic method used by downloaders which ensures a longer malware lifecycle and makes it less visible to most security programs.
TDL nimbly hides both itself and the malicious programs that it downloads from antivirus products. To prevent other malicious programs not associated with TDL from attracting the attention of users of the infected machine, TDL-4 can now delete them. Not all of them, of course, just the most common.
TDSS contains code to remove approximately 20 malicious programs, including Gbot, ZeuS, Clishmic, Optima, etc. TDSS scans the registry, searches for specific file names, blacklists the addresses of the command and control centers of other botnets and prevents victim machines from contacting them.
This ‘antivirus’ actually helps TDSS; on the one hand, it fights cybercrime competition, while on the other hand it protects TDSS and associated malware against undesirable interactions that could be caused by other malware on the infected machine.
Which malicious programs does TDL-4 itself download? Since the beginning of this year, the botnet has installed nearly 30 additional malicious programs, including fake antivirus programs, adware, and the Pushdo spambot.
Notably, TDL-4 doesn't delete itself following installation of other malware, and can at any time use the r.dll module to delete malware it has downloaded.
One of the most outstanding new features of TDL-4 is the kad.dll module, which allows the TDSS botnet to access the Kad network. So what do the cybercriminals want with a publicly accessible file exchange network?
We have known about botnets controlled via P2P for some time now, although until now, these were closed protocol connections created by the cybercriminals themselves. In contrast, TDSS uses a public P2P network in order to transmit commands to all infected computers in the botnet. The initial steps of how TDSS makes use of Kad are given below:
Below is a list of commands from an encrypted ktzerules file.
The most interesting command is Knock. This command allows the cybercriminals to create their own Kad P2P, the clients of which are exclusively TDSS-infected computers.
How publicly accessible and closed KAD networks overlap
Essentially, the TDSS botnet kad.dll module is more or less the same as cmd.dll in terms of control function. By running nodes.dat files containing a list of IP addresses of Kad clients in addition to ktzerlrules, which contains a command to download a new nodes.dat file from cybercriminal servers, the owners of the botnet can both include their infected computers in the publicly accessible Kad network and remove them from the network. The publicly accessible Kad network contains no more than 10 TDSS infected computers. This makes replacing the ktzerules file as inefficient as possible, which prevents other cybercriminals from taking control over the botnet. The total number of TDSS infected computers on the closed network number tens of thousands.
Furthermore, access to Kad makes it possible for the cybercriminals to download any files to botnet machines and make them accessible to the P2P users. This includes adult content files and stolen data bases.
The key threat that such a botnet poses is that even when its command and control centers are shut down, the botnet owners will not lose control over infected machines. However, the system does face two major obstacles:
In addition to its known adware function, TDL-4 has added some new modules to its arsenal. This article has already touched on the ‘antivirus’ function and the P2P module. The owners of TDSS have also added several other modules to their malware, and now offer services such as anonymous network access via infected machines and 64-bit support.
A file called Socks.dll has been added to TDSS’s svchost.exe; it is used to establish a proxy server on an infected computer. This module facilitates the anonymous viewing of Internet resources via infected machines.
Having control over such a large number of computers with this function, the cybercriminals have started offering anonymous Internet access as a service, at a cost of roughly $100 per month. For the sake of convenience, the cybercriminals have also developed a Firefox add-on that makes it easy to toggle between proxy servers within the browser.
The appearance of a 64-bit malicious driver in TDSS was another innovation in malware in 2010. In order to support operations with 64-bit systems in user mode, TDL-4 contains a module called cmd64.dll, a version of cmd.dll for 64-bit systems. However, due to the limitations of working with 64-bit programs, cmd64.dll code only provides communication with the botnet command and control servers.
The cmd.dll module (see for details) remains almost completely unchanged. This module facilitates communication with the botnet command and control servers and substitutes search results, i.e. fraudulently manipulates advertising systems and search engines. The newest innovation in the list of commands for TDSS is the SetName command, which assigns a number to each infected computer. For search engines and banner networks, TDSS uses the same fake click and traffic technologies as similar malicious programs. However, TDSS has the longest list of search engines for which it substitutes search results.
List of search engines supported by TDSS
When running, TDSS uses several sources to obtain lists of command and control server addresses. The default list is taken from cmd.dll; if these addresses are inaccessible, then TDSS gets a list from cfg.ini. If for some reason no command and control server listed is accessible, then a list is created from an encrypted file called bckfg.tmp, which the bot receives from the command and control server on first connection. Since the beginning of the year, around 60 command and control centers have been identified across the globe.
| Control server |
|Server address at the |
beginning of February
|Server address at the |
beginning of March
| Percentage of |
mentions in C&C lists
A careful examination of this list reveals that the IP addresses of command and control centers are constantly changing, while some command and control centers are phased out altogether. These changes are due to the use of proxy servers, which hide the true location of the command and control centers.
Despite the steps taken by cybercriminals to protect the command and control centers, knowing the protocol TDL-4 uses to communicate with servers makes it possible to create specially crafted requests and obtain statistics on the number of infected computers. Kaspersky Lab’s analysis of the data identified three different MySQL databases located in Moldova, Lithuania, and the USA, all of which supported used proxy servers to support the botnet.
According to these databases, in just the first three months of 2011 alone, TDL-4 infected 4,524,488 computers around the world.
Nearly one-third of all infected computers are in the United States. Going on the prices quoted by affiliate programs, this number of infected computers in the US is worth $250,000, a sum which presumably made its way to the creators of TDSS. Remarkably, there are no Russian users in the statistics. This may be explained by the fact that affiliate marketing programs do not offer payment for infecting computers located in Russia.
This heading of this last section has become traditional in our articles on TDSS. In this case, we have reason to believe that TDSS will continue to evolve. The fact that TDL-4 code shows active development — a rootkit for 64-bit systems, the malware running prior to operating system start launches, the use of exploits from Stuxnet’s arsenal, P2P technology, its own ‘antivirus’ and a lot more — place TDSS firmly in the ranks of the most technologically sophisticated, and most complex to analyze, malware. The botnet, with more than 4.5 million infected computers, is used by cybercriminals to manipulate adware and search engines, provide anonymous Internet access, and acts as a launch pad for other malware.
TDSS and the botnet that unites all the computers it infects will continue to cause problems for users and IT security professionals alike. The decentralized, server-less botnet is practically indestructible, as the Kido epidemic showed.
2011 Jun 27, 13:49
TDLx detection DNS
Thank you for this analysis :)
Re: TDLx detection DNS
Surprise! You are right) So you can detect tdl4 connections over proxy.
Re: Re: TDLx detection DNS
I've noticed that if you boot into a live linux distro of any sort (I mainly use the Kaspersky Rescue Disk at this point) that lists all of the services and processes called in detail, an infected computer will always have several references to local loopbacks being called at 127.0.0.1/8 and to 127.0.0.0/8 through 127.0.0.1... and that nearly always, the proxy that the infection specifies is either the localhost (127.0.0.1) or some variant of it (e.g. 127.0.0.1/4664). If TDSS is the only bootkit in residence on my crippled systems, that is...
Wonderful to see a blog article where the authors are so engaged in the commentary discussions. Thanks!
Would enabling the old MBR "change detection" in the BIOS stop this thing from infecting the MBR in the first place ??? Or does it have someway of getting around that protection.
2011 Jun 30, 16:01
"The cybercriminals replaced RC4 with their own encryption algorithm using XOR swaps and operations. "
Re: Encryption algorithm
This research was done in march and there was about 50% samples without RC4. Right now we are receiving samples just with RC4 algorithm. So 0.175 is not so old and it's really have a RC4. +
Sorry but we have very strong security policy for sharing malware IDBs...
2011 Jul 01, 09:29
"When developing the kad.dll module for maintaining communication with the Kad network, code with a GPL license was used — this means that the authors are in violation of a licensing agreement."
During the Prohibition Era in the U.S., 1920-1933, Al Capone, one of the major crime lords, was arrested, convicted, and imprisoned for tax evasion, not the numerous other criminal activities that he was responsible for. It's all about the paper (or electronic) trail...
2011 Jul 01, 10:40
Detection when booting from an infected computer,
I wonder if a small program that can directly send ATA commands to the disk controller could retrieve the real MBR sector (rather than the original MBR, which is what the stealth code wants you to see. (I'm guessing this is the basis of the various boot detection kits)
Edited by Paul Mullen, 2011 Jul 01, 17:36
Re: Detection when booting from an infected computer,
Yes! We already have whitelisting for MBR but there are lot of questions with LILOs like staff...
2011 Jul 01, 15:16
Have you heard of TDSS using Xen/BusyBox/X11 to virtualize the *BIOS*???
I apologize for writing from a compromised computer, but I haven't any other options at this point. I have switched my educational focus from information science to studying the patterns of malware information transfer - using basic social engineering to determine how different malware groups are not only competing but also working together... at least in the case of my systems.
2011 Jul 01, 17:55
I doubt that a mouse, keyboard or monitor contain sufficient programmable memory to be a source of infection. While a MFP certainly could, it would be way too complicated to program because of the many different possible models out there. So I think that is extremely unlikely.
Re: To Venushakti
Thanks for reading my comment and composing a thoughtful response!
Unfortunately, there are no hard drives attached to the computers in question... I can't get far enough to save BIOS settings to turn off the Wifi and Bluetooth anymore so that I can feel safe enough to reconnect the hard drives to format them. I'm getting notification of the ram hooks from the live disks I'm running, at shut down (when they inform me that they are unable to unmount the physical addressing something-or-other in RAM and briefly flash a list of approximately 20 entries of physical hooks in RAM that I guess are permanent as long as the bootkits are in charge. :(
Do you think swapping out the memory would allow me to boot from floppy again and flash the BIOS successfully? I haven't been able to get the BIOS to reenable floppy support (it's been specifically and *permanently* disabled in the BIOS - the supervisor password will not unlock security for that item)...
This was an x64 W7 box that got hit by a version of TDL4 that apparently also installed Poison, Dybalom, and Gen.Nullo (according to the few file detections on VirusTotal and with AVG/ESET/Kaspersky/MBAM/SB S D on the rare occasions I can get something through without it getting patched).
Of course, it could just be hackers trying to make me *think* that's what's happening so that everyone will just think I'm crazy. ;>
sorry, forgot to say, yes, it was connected to a LAN, by ethernet to an infected vDSL modem/wifi router (I didn't know that routers could be infected at that time, nor that the modem I had actually had dual processors and an OS as well as software hardware firewalls that were not enabled by default)
Yes, the x64 box was connected to WUPD, but it showed signs of browser redirections, cross-domain jscript injections, malformed css/xhtml errors, and forcible installing of Google desktop and Windows Live (*both* by **Windows Update** - I've never heard of WUPD installing Google desktop/toolbar before, have you?) -- I didn't know this had occurred until I rebooted after the final update (W7 SP1) and the programs began at startup. This was not an OEM install, this was a w7 box set I bought from a large computer chain, printed by Microsoft's disk mfrs.
The hard drive could indeed already have been infected when it came to me, the event logs (before I lost access to MMC) said that the "certified refurbishing" had consisted only of a system restore from the system backup partition... followed by a long list of errors in the log within seconds after the tech who did the restore rebooted the system... then MMC crashed and I've not been able to get back in. However, there hasn't been any writable media in that box for weeks.
If you have time to read my messages and offer your thoughts, wonderful... but even your response so far has sparked some questions for further research (now that I have a browser that can do at least partially-effective searches for the moment - on another computer).
I don't want to admit *total* defeat on the nicest computer I've ever owned (the x64) especially now that I'm learning so much about how nice Windows 7 can be, and the security improvements (bootkit notwithstanding) to the OS overall (I don't know enough about other OS's to protect them as well yet)... so any comments are appreciated!
If there is a way to send PMs on here so we can spare everyone my laundry list of desktop dramas, I will see if I can reach it with one of my systems... if not, perhaps I can get to the library again in the next few days. :)
2011 Jul 02, 20:51
Detection and/or Protection?
Re: Detection and/or Protection?
Hello Martin! Yes sure. http://support.kaspersky.com/faq/?qid=208283363
Re: Re: Detection and/or Protection?
Question - how robust is the approach in tdsskiller versus TDL-4? Are there indications that TDL-4 is evolving protection measures against tdsskiller, or is it a pretty safe bet that something basic to TDL-4 is so unchangeable that protection will be (at least somewhat) lasting?
Re: Re: Re: Detection and/or Protection?
It's always a challenge) we release tdsskiller update each ~2 weeks. Last version is "220.127.116.11 Jul 1 2011 18:45:21"...
2011 Jul 03, 08:49
My ears pricked up when you said there is a root (MBR) component. A sophisticated rootkit could hypothetically detect the flavor of OS being booted and install an initialization payload appropriate to the OS. Are there any indications of advancement of TDL4/TDSS beyond the Windows framework?
2011 Jul 04, 17:53
decrypting ktzerules / locating the nodes.dat
so from what I've read above the P2P part works like this?
Re: decrypting ktzerules / locating the nodes.dat
Sorry. No reply)
2011 Jul 05, 07:59
Thtreats to Linux users?
I've stumbled across this forum after checking out info about "XP Recovery" malware. The technical issues as discussed here are way above my level. I'm interested in how to help fellow members of my computer club who might fall foul of this menace. Also, as a Linux user, I'm interested in the level of vulnerability for:- 1) a stand alone Linux system, 2) running Linux from a live CD. Your thoughts on this aspect would be most welcome
Re: Thtreats to Linux users?
TDSS is working only on Windows systems so Linux is safe for that. For fighting with such kind of threats I can suggest our free tools like http://support.kaspersky.com/faq/?qid=208283363 )
2011 Jul 23, 11:15
We need a hardware based solution...
I worked for SMC Networks back in 1998-2000. Back then I was trying to convince the Director of Technology and Marketing that we need a Hardware Based NIC+AV solution to stop threats before it could write to the computer. Costs have come down significantly...this is doable with today's capabilities. Integrated into every MB NIC, the average Joe will have a fighting chance!
2011 Sep 03, 02:53
how the virus is to fool the antivirus and infiltrate in MBR?
2011 Sep 15, 06:56
Does the TDL4 infect the EFI bios?
2011 Sep 16, 13:14
Infection Code TDSS
There is a keyboard-hook somewhere which looks for ftp-connections ... and finds index.* ... then it adds: var t="";var arr="646f6 ... 2)t+=String.fromCharCode(parseInt(arr[i]+arr[i+1],16));eval(t); after the last char (usual ).
2011 Nov 21, 17:21
Name of the version of TDL4 with kad.dll
I'm very interested in the communication through Kad of TDL4. What is the name that Kaspersky use for the version of TDL4 with the kad.dll module? Could you facilitate the md5 of the sample you analyzed? I would like to see the report of virustotal about it.
2012 Jul 04, 11:22
How to detect ???
2013 Mar 19, 13:12
i herdy from a little birdy that some parts of tdl were originally written by anakata. good thing he can't do that for a living anymore.