Following a successful analysis of the domain generation algorithm used by the Tofsee botnet, the Swiss domain registry (SWITCH) has temporarily suspended around 520 possible .ch domain names — seriously weakening if not neutralizing the botnet.

GovCERT.ch obtained a Tofsee sample. Among the hundreds of samples it analyzes every day, this one stood out because about half of the domains it queried were Switzerland’s top level domain (.ch). The other half are .biz domains. Since they all appeared to be algorithmically generated, the CERT set about analyzing the malware and its domain generation algorithm (DGA).

The algorithm was described in detail in a blog post yesterday. It ultimately generates 20 domain names on each day it is run: for example, dqgdqga (a to j) .ch and .biz. However, having cracked the algorithm, GovCERT was now able to predict which domains would be malicious, and when.

GovCERT contacted SWITCH, and SWITCH used its own processes to temporarily suspend the domains. In a separate post, SWITCH explained, “This week the Swiss Governmental Computer Emergency Response Team (GovCERT) informed us about the malware Tofsee using .ch as one of the TLDs in its DGA. Together with GovCERT and RoLR (Registry of Last Resort) we used our plan[n]ed process and added around 520 names to a list of .ch domain names that cannot be registered while they are actively used by the malware.”

Discussing Tofsee, PandaLabs CTO Luis Corrons told SecurityWeek, “At the end of the day we are talking about a bot installed in a number of victims’ computers. It will be used to send out spam and/or malware, and the content has to be downloaded from some place. It those addresses were hardcoded into the bot, it would be easy to discover them and take them down. Using a DGA algorithm is much better for the bad guys as it generates different URLs depending on a number of variables. The creators of the bot have created the DGA, so they always know what domains the bot will try to access at a particular given moment.

“For example,” he continued, “they will know that tomorrow at 10am all bots will try to connect to xxxxxx.ch; so they just need to register that domain a few minutes before 10am and put there all the malicious content they want to be distributed by the botnet. Security companies will see at 10am that the bot is connecting to xxxxxx.ch and they will add it to their black lists, and will try to get that domain shut down — but it will be too late because all of the bots have already connected and downloaded the malicious content.” And they won’t ever be coming back again.

Without this approach, commented F-Secure security advisor Sean Sullivan, “malware hunters would need to do a lot of crawling. By the time they report the live C&C, the URL will have changed. The proactive approach is to analyze the algorithm, figure out which domains will be generated in the future and to create a blacklist for those particular days.”

It’s not quite game over for Tofsee, however. It still has the .biz domains. SWITCH went one-step further than just a blacklist of the .ch domains — it physically ensured that they could not be used. Doing the equivalent with the .biz domains is not so easy. For now, it seems that the security industry will have to rely on the GovCERT generated blacklist. This can be used by large organizations, carriers and reputation list brokers; but doesn’t guarantee 100% success.

“If the malware has limited its URLs to a limited number of TLDs, [the SWITCH action] could have a big impact,” added Sullivan. “Unless the botmaster has another way to connect to his botnet to revise the algorithm; which, typically, they do.”

Overall, Sullivan does not believe this action will have much effect on spam and malware levels on the internet, but “it is an excellent way for a national CERT to run its TLD. Switzerland will end up running cleaner networks and will be the source of less malware. And that’s good for the reputation of both the country and its networks.”

It also demonstrates the continuous cat and mouse nature of the ongoing battle between security defenders and malicious attackers.

Kevin Townsend is a Senior Contributor at SecurityWeek. He has been writing about high tech issues since before the birth of Microsoft. For the last 15 years he has specialized in information security; and has had many thousands of articles published in dozens of different magazines – from The Times and the Financial Times to current and long-gone computer magazines.