Researcher Eavesdrops on Mocbot

The latest Trojan shows its colors in a virtual internet environment.

When Joe Stewart spotted a variant of the Mocbot Trojan hijacking unpatched Windows machines for use in Internet Relay Chat-controlled botnets, he immediately went to work trying to pinpoint the motive for the attacks.

Stewart, a senior security researcher with the Threat Intelligence Group for Lurhq, in Chicago, set up a way to silently spy on the botnets command-and-control infrastructure between Aug. 13 and Aug. 15. His subsequent findings suggest that for-profit spammers are clearly winning the cat-and-mouse game against entrenched anti-virus providers.

"The lesson here is once you get infected, you are completely under the control of the botmaster. He can put whatever he wants on your machine, and theres no way to be 100 percent sure that the machine is clean," Stewart said in an interview with eWeek.

"The only way to be sure the system is malware-free is to completely wipe the hard drive and reinstall the operating system," Stewart said.

Stewart arrived at that conclusion after eavesdropping on Mocbot for a few hours. He set up one isolated machine and infected it with the malware and a second machine that pretends to be the entire Internet.

The second machine, known as a sandnet, is a custom-made tool for analyzing malware in an environment that is isolated yet provides a virtual Internet with which the malware interacts.

With the Mocbot variant, which was targeting the Windows vulnerability patched with Microsofts MS06-040 patch, Stewart was able to figure out that the infected drones were connecting to two hard-coded command-and-control servers at and

He captured the Internet Relay Chat, or IRC, log-in sequence generated by the bot. This included a user, a nickname, the channel name and the first bit of instructions to the infected machine. The command schemes were all encrypted, forcing Stewart to create a custom Perl script to decode the algorithms.

Using Telnet to connect to the command-and-control server on Port 18067 (the port number for the IRC server), Stewart successfully started spying on the control channel, but there was not much to see.

"The IRC server code was stripped down to give almost no information to the client except the channel topic line, which was encrypted," Stewart said.

Once the algorithms were decoded, he found that the botmaster was telling the infected machines to join another control channel to receive another encrypted message.

When decoded, the command simply served up a URL hosted at, a free image hosting service. Stewart said the mission of the bot-master was to get the second file into the infected system.

With the spam proxy Trojan sitting on his test machine, Stewart was again able to join the spam proxy network to get an internal peek at the operations.

Using the sandnet, he found that the Trojan was sending a 4-byte UDP (User Datagram Protocol) packet to the address.

Stewart then mimicked this on an Internet-connected network with a fake SOCKS proxy that feeds into a Blackhole SMTP server—a DNS (Domain Name Server) that contains the IP addresses of SMTP servers that either originate spam or are considered to be spam open relay hosts—to infiltrate the proxy network.

He immediately started seeing "loads of spam being pumped through [the] SOCKS server," he said. This was coming from dozens of IP addresses and using forged sender addresses.

The spam e-mails, which are now being pumped from infected Windows desktops, represented a range of the typical junk mail, Stewart said.

He found mail advertising everything from pornography to fake Rolex watches and pharmaceuticals.

"It looks like this was a small, targeted attack for one simple reason: They wanted to stay under the radar. This is all about setting up small botnets and making money from spam. They could be the spammers themselves or the guys doing the dirty work and then renting the botnets to spammers," he said.

In the initial stages of the Mocbot attack, only one-third of anti-virus scanners tested by Stewarts research team were detecting the malware.

Even more worrisome is the fact that the attack included the use of botnet instructions to download the second-stage Trojan executable.

"In this case, it was a spam proxy Trojan, but what if it was a rootkit? The rootkits are getting so good these days that the programs we typically rely on to find and clean machines just cant see them. There is still the possibility that the spammers could slip in a rootkit to hide things forever," Stewart said.

The lesson? "Dont get in--fected in the first place," Stewart said. He urged IT ad--ministrators to apply critical patches early and maintain several levels of defense against malware, including firewalls, anti-virus and system hardening.

Mocbot Unmasked

Here are the characteristics of this Trojan:

* This IRC-controlled backdoor Trojan spreads itself via the MS06-040 (Microsoft Windows server service) vulnerability.

* When run, the Trojan installs itself to the system, modifies several security settings, attempts to connect to a remote IRC server and starts listening for commands from a remote hacker.

* Infected machines become part of a botnet used to hijack files, create a proxy for e-mail spam, perform DoS (denial of service) attacks and send commands to instant messaging windows.