waving android

I am currently a software engineer at Google, where as a member of the Android platform team I build frameworks and user interfaces.

The blog here at is mostly historical; you can find more recent posts on .

Re: Twitter spam.

May 5th, 2009


People are suddenly concerned about @reply spam on Twitter. It’s not here yet, exactly, but it will show up—along with its worse cousin, search spam—and then we’ll be in trouble unless Twitter stops showing us messages from strangers quite so readily.

Here comes everybody else

Via Scoble, Loïc Le Meur last week sounded the alarm about Twitter @reply spam:

It had to happen. I just got my first @loic spam and there is no way to filter it. Spammers got it. It’s very simple for them, they just tweet your @username, show up in your replies timeline and bingo that’s the one you pay so much attention at so you won’t miss it. There is no way for you to filter it. None. Yet.

So, it’s true: anyone can create a message that appears in your “Mentions” view, just by, er, mentioning you. Let’s see what that means, and if it’s really that dire.

Asking for it

First, let me say that I don’t think spam will be the death of Twitter; all complex ecosystems have parasites, and spam is a sign that Twitter is a success. In fact, abuse of a public communication system is like crime (or terrorism) in the physical world: you can’t eliminate it entirely, but you can reduce it from a crisis to a nuisance.

This has been a bitter struggle in the world of email, which was forged in the good old days of mutually-trusting research, military, and corporate networks and is therefore every bit as happy to deliver you a message from a deposed prince of Nigeria or vendor of pharmaceuticals as it is from a close friend or colleague.

Twitter, on the other hand, is remarkably resistant to abuse because of its subscription-based information flow: users get only what they ask for. In general, you don’t see messages from strangers, so there’s no way for spammers to get arbitrary text in front of your eyeballs.1

No way, that is, unless you’re in the habit of routing around the subscription system and explicitly looking for messages from strangers. You can do this in one of three ways:

  1. Viewing the public timeline (which nobody actually does);
  2. Searching across Twitter; or
  3. Looking at your mentions (messages containing @username, which—when they were confined to messages beginning with @username—used to be called “replies”).

So far, Twitter spam has been safely held at bay—a nuisance, not a crisis. Mention/reply spam is just not that common. Poking through my handy Twitter data set from last September2, I didn’t find much in the way of @replies that obviously looked like spam.3 I admit to being surprised that this kind of spam isn’t more common, but I think my colleague Mike has hit upon the reason: you can’t reach very many people at once. There’s a finite amount of space available in a tweet, and the spammer has to divide it between recipients and payload. Assuming the average twitter nickname is 9 characters4 (plus a space and an @) and the average TinyURL is 25, a single spam tweet5 can target at most 140 – 25 – 1 = 114 / (9+2) = about 10 recipients.

Rate limiting by Twitter caps the number of messages that can be sent out by a particular user to just over one per minute. As a result, in order to reach a million Twitter users, a spammer would need to send out 100 messages/hour, each mentioning 10 users, from 1000 junk accounts. This is certainly practical, although not quite the same scale as botnet-fueled email junk. As far as I know, it’s not in common use just yet (although there exist apps like TwitterHawk that occupy a gray area between obviously legitimate and spammy use of Twitter).

Twitter search (and spam) for everyone!

The most effective vector (most eyeballs; fewest effort) attacks user behavior #2 above by spamming search terms; when Twitter launched its election.twitter.com live feed, it wasn’t long before people figured out that this was a soft target. And URL shorteners obfuscators exacerbate the problem by making it very difficult to know whether to click a URL provided by a stranger in search results.

This is where I think we may now be in for some real trouble. On Thursday, Twitter added real-time search (including a smattering of trending topics) to the main web interface. In a blog post entitled Twitter search for everyone!, Biz Stone explains:

What was that loud noise outside your apartment? Did you just feel an earthquake? What do people think about your company, your product, or your city? With this newly launched feature,6 Twitter has become something unexpectedly important—a discovery engine for finding out what is happening right now.

Twitter teaches us new and amazing things every day and a big lesson learned is that search is so much more than a box and a button. As public tweets fly in from around the globe, we analyze them to detect when certain words or phrases occur with higher frequency. These trending phrases are surfaced in the Twitter home page just under the new search box and they’re updated throughout the day. Built on our search technology, trends are a compelling if rudimentary way to explore a collective global consciousness.

Real-time search, and its potential to rapidly spread very, very current information (whether accurate or not, and usually lacking in analysis) is without a doubt one of the most interesting7 features of Twitter. By choosing to feature it so prominently in the main interface, Twitter has dramatically raised the profile of search results, and therefore considerably upended the economics of search spam (in favor of spammers).

A plan for Twitter spam?

Loïc proposes a solution (that applies equally well to search spam and @reply spam):

… add a “report as spam” button. This button would report the spammer to Twitter (or to a separate database of users) that we could exclude from the clients after a sufficient number of users report them as such and maybe some manual checking. Twitter could then just delete those users.

Others propose creating a large central tweet-filtering system akin to Akismet, the blog comments spam clearinghouse.

The problems with these approaches are manifold. Blocking/reporting suspicious users doesn’t scale (requiring users to take the time to manually identify and report junk) and opens the door for abuse (how many spurious reports would be necessary to get a legitimate user canned?). The Akismet approach—content-based filtering—continues to be an arms race, and even when you have access to millions of different users’ messages (as Twitter would, and Gmail does) it’s still hard to know what’s legit and what isn’t. And even if you take a guess (er, a statistical inference), do we now have to create a “Junk” folder for each Twitter user, including the option to “Report as not spam” to move things back into the inbox? I already have one overgrown garden to tend, thanks.

Flees a crowd

Security geeks are notorious for complaining about others’ proposals without offering a better one. Here’s my take: I think the only long-term, scalable approach is to remove “strangers” from common views of the system, forcing the user to take extra steps to go beyond his own subscriptions. In this world, the only junk most users will ever see is junk from friends and family, which can safely be classified as “not spam.” The mentions/replies view, which has become an important Twitter inbox (particularly for users following more than a handful of others), would show a subset of your main view—messages from random users don’t belong in either place. I believe this is in the spirit of how most individuals use Twitter: primarily, to stay in contact with a limited number of friends and colleagues, and only secondarily to engage the public at large.

So how do you meet new people on Twitter if you can’t see their messages? First, it should be possible to see tweets from strangers—just not the default. A “show messages from everyone” checkbox in the mentions or search views ought to suffice. Second, Twitter users are pretty good at passing along interesting stuff (via retweets), so there still ought to be plenty of cross-pollination between circles.

Finally, Twitter can exploit the social graph to show us messages from friends-of-friends (or friends-of-friends-of-friends, and so on, to any desired depth). Messages from users with some indirect connection to me are still unlikely to be spam, and moreover, if the goal is to discover new users I’m most likely to be interested in people connected to my existing contacts (crowdsourcing the task of crowd-finding, if you will). The CS community is really starting to get into this sort of thing, and although I haven’t yet published my work along these lines, it is this approach that I plan to take in FETHR, my proposed distributed microblogging platform.

Somewhat ironic postscript

As usual, blog comments and Twitter comments are open below. Of course, culling responses from Twitter relies on searching the entire unfiltered public timeline, which I just burned about a thousand words inveighing against. As I mentioned when I started the experiment, this is easily abused; for now I’m explicitly courting tweets from strangers, and we’ll just have to see how long it lasts.

  1. Except new-follower notifications. But because the attacker can’t control the content of this message (beyond his own username), you (the recipient) have to do some extra work to actually see spam content: click through to the user’s page and possibly on through to some arbitrary URL. This is known as follow spam

  2. I still intend to make that data set available; watch this space. 

  3. I looked for spammy words and URLs addressed as @replies; there were a few hits, but nowhere near the overwhelming proportion you’d need to declare spam a real problem. However, as discussed elsewhere in this piece, content-based spam identification is a real challenge, and I might certainly be missing something. You might be able to do better; see previous footnote. 

  4. Based on my data, the average is 8.96 chars. 

  5. It is standard procedure to coin an awkward portmanteau for every new type of spam encountered (spim, spit, spamdex, to name a few). It is also de rigueur to create Twitter-related neologisms in a similar fashion (typically centering around use of “Tw” as a sort of charming speech impediment). Convention would therefore dictate that we call spam tweets something like “twam” or “sweets.” Instead, I will break with established practice and propose that we simply refer to Twitter spam as “bird poop.” 

  6. It’s hardly “newly-launched”—many of us have been using search.twitter.com since before Twitter bought it from Summize. But it’s still new to many users, so I’ll let this slide. 

  7. Interesting for users, of course, but possibly also for business reasons: (1) it might be something Twitter could charge for in some form; (2) it might make Twitter worth buying. This may explain why search has been pushed in front of users’ noses: it’s useful for users, but it’s valuable to the company. (Too cynical?) 

Discuss this page by posting to Twitter or by writing in the box below.

The Twitter watercooler

Messages referencing this page (newest at bottom):

5 responses

  1. Raluca Musaloiu-E.  

    Nice article! Following the idea of ‘limited reply view’, another option would be to show in the reply stream only the people that follow me (regarding if I follow them or not). In this way I will be able to see messages from new people, but they’ll have to do an extra step and follow me. That would make spam accounts (relatively) easy to detect, even without users specifically reporting them. Just wondering, is there a cap on following people (like 1 per minute)?

    comment posted at 2:37 pm on 05 May 2009

  2. Daniel Sandler  

    The API rate limiting applies to follow requests as well (100/hr). But I think the real cap on following people is the ratio—you can’t follow too many people without them following you back.

    comment posted at 8:46 am on 06 May 2009

  3. Daniel Sandler  

    Regarding mdietz’ point above: I wonder if Twitter is manually deleting spam search terms from the sidebar? This morning I noticed something like “Free Music Download” that was obviously being spammed, but shortly thereafter it disappeared.

    Manual deletion of spam terms, of course, won’t scale.

    comment posted at 7:17 pm on 07 May 2009

  4. Weekend link dump for May 10 « Off the Kuff  

    [...] Twitter @reply spam. Had to happen sooner or later. [...]

    comment posted at 11:58 am on 10 May 2009

  5. tl;dw (dsandler.org)  

    [...] has been six months since my last post. So much has happened since then that I wanted to tell you about. I tried, several times, but [...]

    comment posted at 4:03 pm on 21 Nov 2009

Add a comment

html help (show)

newer: older: