Turns out Twitter's expansion of Direct Message capacity beyond 140 characters inadvertently gives botnet operators a stealthy and streamlined way to control their bots.
A new backdoor tool built by white hat security researcher Paul Amar uses Twitter DMs as a botnet command-and-control infrastructure. Amar says his so-called "Twittor" tool was inspired by a Gmail-based botnet C&C tool called "Gcat."
"I was looking at how third-party services could hide malicious traffic" and how botnets could maintain a command-and-control infrastructure that could avoid takedowns, for example, says Amar, a security analyst with SensePost Information Security.
His Python-based Twittor backdoor tool basically allows a botnet to operate and hide in plain sight. The machines would already be infected with the malware, and then controlled by the attacker via his or her malicious Twitter DMs. "It uses just one Twitter account that sends" the DMs, Amar says. "Everything is going through private messaging" of the attacker's account, he says.
Amar says an attacker likely would use Tor to create the new Twitter account. With DMs longer than 140 characters, it leaves plenty of headroom for controlling the bots, he says. "It allows for more malicious activity."
Some security experts have called out the potential for abuse of DMs with Twitter's move in August to remove the 140-character limit, as well as the new option for any Twitter user to DM any other Twitter user even if they are not following one another.
Bad guys will use most any possible channel for C&C, notes Dan Kaminsky, chief scientist with WhiteOps, who points out that social networks long have been abused that way. Researchers at DC949 created Twitter FS, a file system tool that used just the 140-character limit to store files, he notes. "Small channels have always been attractive to C&C, which never needs much bandwidth to prosper," Kaminsky says.
Kaminsky's 2005 OzymanDNS project, meanwhile, demonstrated the potential for abuse of DNS by moving files and tunneling traffic over DNS.
Twit Bot Limit
Twitter limits users to 1,000 DMs per day, so Amar estimates that a Twittor botnet would max out at somewhere around 100 bot machines. "The best way to bypass that limitation would be to use different accounts and mesh them all together. So with three accounts, we can do around 3,000 DMs daily, which would be enough to control a few hundred boxes," Amar says.
Since they communicate via the Twitter API, the bots don't need their own Twitter accounts to be controlled, he notes. And since it uses the API, there's no worries of IP-filtering for the attacker, he says. And "nothing's public, [since it's] only using Direct Messages, so there's no public malicious activity," he says.
A DM-controlled botnet complicates a bot-infected company's defenses. "It's quite complicated. You would have to block Twitter in a corporate environment," says Amar, noting that such a ban obviously wouldn't be realistic in most companies. The DM traffic would be difficult to distinguish from legitimate communications, he says.
Amar says he's looking at adding a data exfiltration toolkit for his Twittor tool. Twittor is available on Github.