Slashdot Mirror


Cross-Site Scripting Hits Major Sites

An anonymous reader writes "Dark Reading and SC Magazine covered a story about hackers posting cross-site scripting (XSS) vulnerabilies en mass on dozens of high profile websites including Dell, MSN, HP, Apple, Myspace, YouTube, MSN, Cingular, etc. The media coverage drew the hacker's attention to the publication's websites where they got a taste first-hand. On message board wall-of-shame is PC World, MacWorld, Fox News, the Independent, and ZDNet UK. "...not only did we get the "scoop" on the XSS site problems, but we also got the message loud and clear: Don't assume you're immune to XSS vulnerabilities. They're everywhere." The news comes shortly after Mitre (CVE) released statistics showing XSS has become the most popular exploit. Unfortunately new XSS attacks are growing increasingly severe and scanners are unable to find many of the issues on modern websites."

37 of 161 comments (clear)

  1. The Cross Site Scripting FAQ by mrkitty · · Score: 5, Informative
    --
    Believe me, if I started murdering people, there would be none of you left.
    1. Re:The Cross Site Scripting FAQ by Dwonis · · Score: 4, Interesting

      I particularly like this example.

      Here's the spoiler.

    2. Re:The Cross Site Scripting FAQ by blowdart · · Score: 5, Informative
      No it doesn't. Cross site scripting works by adding a script tag to the source page. For example, imagine you have allowed scripts from slashdot because you can't use the new comments system without it.

      Now an evil hax0r manages to insert an XSS attack on slashdot what would happen is the attack would be embedded in a normal slashdot page, as a block. So the source would be from slashdot.org, and noscript would view it as being allowed.

    3. Re:The Cross Site Scripting FAQ by Schraegstrichpunkt · · Score: 2, Informative

      Look closer. This particular vulnerability doesn't use any special JavaScript or anything else; It's a simple redirect. The only way to fix it would be for Google to change something (such as by adding a referer check) in its preferences module, or for you to special-case this particular attack in your browser.

    4. Re:The Cross Site Scripting FAQ by blowdart · · Score: 3, Informative

      I was talking generically; anyway the redirect is not an XSS attack at all.

  2. Scripting? by Anonymous Coward · · Score: 3, Funny

    document.write("It's very hard to check for XSS. I can understand why most people don't bother.")

  3. Scanners not able to find XSS by possible · · Score: 2, Informative

    The reason most vuln scanners can't find XSS vulns on modern sites is because of the increased amount of JavaScript and Flash (with ActionScript) that's in use. But some scanners can grok this stuff to varying degrees of completeness.

    1. Re:Scanners not able to find XSS by Tackhead · · Score: 2, Insightful
      > The reason most vuln scanners can't find XSS vulns on modern sites is because of the increased amount of JavaScript and Flash (with ActionScript) that's in use.

      Which is why I'm so happy that the currently-in-demonstration phase of the new Slashdot discussion system presumes/requires that Javascript be active.

  4. Re:Why? by RevDobbs · · Score: 2, Insightful
    For most contracts, if you aren't paying experienced developers, there should still be money in the budget for a pro to give the code the once over and do a sign-off.

    Have you ever read poorly-written, newbish code?

    For anything non-trivial, it would probably be quicker and cheaper to have the "pro" write the code in the first place than to pay him for his time to read, understand, and correct a steaming pile of turd spaghetti.

  5. In soviet russia.. by djuuss · · Score: 4, Funny

    .. XSS links YouTube

    --

    my capcha was condom
  6. Re:I don't get XSS by truthsearch · · Score: 3, Interesting

    Actually, CS 101 is data types and algorithms. Earning my CS degree taught me little of input validation. Most programmers learn security in one of two ways: proactively reading up on it or having one of their applications hacked. Unfortunately I think many average programmers don't consider input validation as much of a priority until after a hole they provided is exploited. When I ask many web developers what they do to prevent SQL injection attacks, for example, only about half have even considered it. Scary.

  7. scanners by rilian4 · · Score: 3, Interesting
    ...and scanners are unable to find many of the issues on modern websites
    Obviously the hackers can find systems with this vulnerability...ergo there exists a means to scan for it...

    Draw you own conclusions from there...
    --

    ...quicker, easier, more seductive the darkside is...but more powerful, it is not.
    1. Re:scanners by From+A+Far+Away+Land · · Score: 2, Insightful

      "Draw you own conclusions from there..."

      You're using logic, while security software marketers are using damage control.

  8. But of course Slashdot... by Billosaur · · Score: 3, Funny

    ...remains unaffec... FOJSF{09fiE*EU90av['vlwIOA934MAwadpskf[aepfkfa[-09 u9a

    --
    GetOuttaMySpace - The Anti-Social Network
    1. Re:But of course Slashdot... by _xeno_ · · Score: 4, Interesting

      A while ago, someone posted a link to a webpage that, when clicked, caused their post to be moderated up. Their post was at +5 for quite a while until enough replies got moderated up pointing out that the link wasn't what it claimed to be.

      So, in a sense, Slashdot has already been hit by a cross-site scripting vulnerability. The fix for XSS vulnerabilities like that involves requiring a secret token to be sent to take user actions, to prevent people from creating forms off-site and submitting them as the user. I suppose checking the referrer may work too, but I wouldn't count on it.

      --
      You are in a maze of twisty little relative jumps, all alike.
    2. Re: But of course Slashdot... by klenwell · · Score: 2, Interesting

      Tokens probably solve some of these problem. And something like this doesn't hurt:

      http://cyberai.com/inputfilter/index.php

      --
      Innovation makes enemies of all those who prospered under the old regime... -- Machiavelli
    3. Re:But of course Slashdot... by finiteSet · · Score: 2, Funny
      A while ago, someone posted a link to a webpage that, when clicked, caused their post to be moderated up.
      Do you have a link to support this claim?
      --
      If we start buying CDs then the terrorists have already won.
  9. Web 2.0 anyone? by griffon666 · · Score: 2, Insightful

    Web 1.0: Simple fishing scam
    Web 2.0: Cross-Site Scripting

    1. Re:Web 2.0 anyone? by blowdart · · Score: 4, Insightful

      Bad assumption. If you're assuming everything is coming down correctly encoded you're a fool, all it takes is a bit of javascript that submits to your back end without encoding and *bang*

  10. Re:I don't get XSS by Yvanhoe · · Score: 3, Informative

    That's it. They allow users in forum to post links, and URL. URL can have a lot of strange characters in it, & ? ! # etc... Apparently, the basis of XSS is to make a link that appears like a valid URL but that will, in some clients, execute as a javascript code, usually in order to steal cookies (therefore, an opened session) of the user watching the post. There seems to be a shield vs sword thing growing between attackers and web developers. You have numerous ways of "hiding" a code in an URL, hexadecimal notation, strange utf-8 characters and so on. Here again, an incomplete implementation of a standard is the cause of major headaches.

    --
    The Wise adapts himself to the world. The Fool adapts the world to himself. Therefore, all progress depends on the Fool.
  11. JavaScript/browser design flaw by oohshiny · · Score: 4, Insightful

    Before web designers blame themselves for this, the existence of XSS is really a fundamental design flaw in the way JavaScript and browsers work. It should have been obvious as soon as JavaScript came out that these kinds of attacks would become a major issue over time, but the "ooh shiny" attitude of the computer industry meant that people adopted JavaScript without knowing what the implications were. In fact, the other big security hole and productivity drain of the industry, C/C++, got adopted in a similar way.

    Writing any substantial piece of software in C, C++, or JavaScript without creating safety or security issues is extremely expensive and beyond the ability or resources of most developers. For C and C++, there are alternatives you can choose today. For JavaScript, you just have to minimize its use or simply not worry about it and let the client fix it with tools like NoScript.

    1. Re:JavaScript/browser design flaw by julesh · · Score: 2, Insightful

      The point is, though, that browser developers could have made script filtering substantially easier. If you want to accept HTML-formatted input to a web application, you have little choice but to try to filter out any scripts a malicious user may have inserted. And doing so is hard, because there are so many different ways scripts can be inserted into HTML. Script tags, event handler attributes, any attribute that can take a URL (e.g. src, href in many different elements), style attributes, style tags, ...

      And it *is* a fairly common requirement, because of the existence of technlogies like 'contenteditable' and 'designmode' that allows sites to embed WYSIWYG HTML editors into a web browser, and the lack of alternatives that produce non-HTML results.

      But forget that for a second: even if all you want to do is accept a URL and create a link to it, you need to do non-trivial filtering. Basically, you can either require that the URL is in a known good scheme (i.e. it begins with a substring from a list of good ones like "http:", "https:", "ftp:", "gopher:", "magnet:", etc.) or you can try to filter out URLs that invoke javascript. Start with anything that looks like "javascript:". Make it case insenstive. Now account for the fact that you can encode a URL with HTML entities for some or any characters (e.g. javscript), and that some browsers are rather permissivie with what they accept, and will accept embedded whitespace or null characters inside the javascript URL scheme.

      Basically, the javascript URL scheme was a mistake that never should have been made. It has made filtering javascript out of HTML source code a nightmare. It has turned otherwise safe tags (like A and IMG) and attributes (style) into something that you *must* strip or examine closely to determine if there is a security issue.

  12. Re:Why? by Schraegstrichpunkt · · Score: 3, Insightful
    What we have is total morons passing themselves off as web developers, just like we have thousands of "web designers" who don't know the meaning of the word "design".

    "Web design" is for aesthetics and graphics people, like "interior design". Of course you run into problems when you have a web designer doing development work!

    As for "No web developer has written XSS vulnerable code since 2002", I refer you to The Daily WTF.

  13. I do my duty and report them. . . by Hero+Zzyzzx · · Score: 5, Insightful

    but it's probably pointless. Not enough developers care about their craft.

    There's a prominent "popular science" website out there (no, it's not this one that I'm thinking of) that has ENORMOUS XSS vulnerabilities in its image gallery. They pass captions and img src in URL encoded query string parameters. Yuck.

    I noticed this about a year ago and reported it to the development team, with a demonstration link that put in a (sorta not nice) image and caption. No response, and when I checked six months ago the vulnerability was still there. So much for being a nice guy.

  14. Re:I don't get XSS by RevDobbs · · Score: 3, Interesting
    Earning my CS degree taught me little of input validation.

    Maybe I lucked out with a particularly cluefull teacher, but input validation was beaten into me learning Basic on an Apple II(e?) in high school: everyone fails the first round of the Craps game assignment when the teacher asks "what happens when I bet a negative amount?".

  15. Too Lazy? by Anonymous Coward · · Score: 2, Informative

    It looks like the attacks can be prevented by simple user input validation. Are the above mentioned high profile website developers/architects being too lazy or nobody knew about this type of vulnerability until recently ? I cant see how Joe Average will know about this exploit because he will not bother to read the query string(or even understand what it does) if it points to major website.

  16. Experienced this firsthand. by Anonymous Coward · · Score: 2, Interesting

    I've seen the interesting effects of this first hand with a customers server, which I was tasked to unhack. Took a while to spot the reason the server was hacked because stupidly I didn't think of XSS when I considered the range of hacks that had occurred. When I did finally start grepping the access_logs and saw the rather odd things being passed through an enquiry form script things started to piece together. I've filched a copy of the script passed and its quite impressive, though its probably reasonble to stake a claim on the hacker not being the script writer given the sheer wealth of comments and how to customize tips present. n00bishly (but then I'm not employed to harden boxes, nor am I a website programmer) I didn't expect a site to be quite so vulnerable to such a range of exploitation through XSS. The script I have includes stuff to exploit unpatched mysql to create new users, passes a load of hex strings I won't even hazard a guess at their purpose etc. etc.
    As a geek I appreciate it the technical qualities, as the guy who had to unhack an exploited server however.. :)

  17. Been there, done that. by Medievalist · · Score: 2, Interesting
    For anything non-trivial, it would probably be quicker and cheaper to have the "pro" write the code in the first place than to pay him for his time to read, understand, and correct a steaming pile of turd spaghetti.
    If you pay me enough money, I'll write new code and claim that what I did was correct the old codebase.

    You could probably take a random blob of ones and zeros, run multiple instances of it as an executable image while randomly tweaking bits until you evolved a real executable, far faster than you could analyze some of the code I've had to replace over the years.
  18. Re:I don't get XSS by CastrTroy · · Score: 2, Insightful
    You've said it. I've found that school teaches very little about programming in the real world. Sure you get some security courses, adn they are great, but I think there should be a class on the common problems that show up in programming. Things that should really be taugh are:
    1. Always use parameterized queries and never construct your own queries by concatenating strings. This will not only speed up the application, it will make sql injection attacks a non-issue
    2. Always verity the users input. You never know what the user is going to try to do with bad input.
    3. When programming in languages like C, always check to ensure that the user can't perform a buffer overflow attack.
    I'm sure there's a lot of other things that people could add to this list. There's a lot of mistakes that happen over and over again. And I don't think that it's because people don't care, or aren't smart enough, but simply because they don't know the problem exists.
    --

    Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
  19. But they don't care... by BunnyClaws · · Score: 2, Interesting

    The problem from what I have seen is in the attitude of the people running the websites. Their attitude tends to be that cross-site scripting doesn't directly impact their servers but only impacts the systems viewing the website. Since this doesn't have a direct impact on their server's it's not a high visibility threat to them. Their attitude towards their visitors is "We are secure but it sucks to be you."

    --
    "Anything tastes good if you deep fry it."
  20. You get what you pay for with developers... by queenb**ch · · Score: 3, Insightful

    The biggest problem is farming everything in the world out to $8/hr guys in some foreign country. If you pay $8/hr, you're going to get an $8/hr guy. Keep in mind that Wal-Mart starts at $9/hr. Given these two statements, I fail to see why it's surprising that such simply fixed vulnerabilities continue to plague software.

    2 cents,

    QueenB

    --
    HDGary secures my bank :/
  21. Re:Move on... by profplump · · Score: 2, Insightful

    A) It's just as simple to prevent an SQL injection attack. Failing to clean your input is just a stupid mistake, regardless of the input method. Mistakes happen, but let's not pretend that input validation is complicated.

    B) The reason people like to build web interfaces is that the client, server, and transfer mechanism already exist. Writing a new one for each project is much, much more work.

  22. Re:I don't get XSS by Jerf · · Score: 3, Interesting
    Apparently, the basis of XSS is to make a link that appears like a valid URL but that will, in some clients, execute as a javascript code
    No, that's just one way to do it. XSS is any insertion of Javascript code into a site that shouldn't be there, and there are a surprising number of ways to do that. <a href="javascript:alert('hi!')">text</a> is just one of the easier ones.

    I say this because people need to be aware that links are not the only vector. My favorite one I've seen so far is <bgsound src='javascript:bad_code()'>. If you choose poorly and are trying to filter out bad tags (instead of what you should be doing, specifying only exactly what tags and attributes are allowed and forbidding anything else that looks like a tag), did you remember to block out the BGSOUND tag? If not, that auto-executes; it doesn't even need to be clicked. (IE may have closed that; I saw this in the IE 4 era.)
  23. Validate, Validate AND Validate by Joe+U · · Score: 5, Insightful

    I'm a web developer and I've said this dozens of times.

    VALIDATE ALL INPUT EVERYWHERE.

    Validate on the client. (For bandwidth reduction)
    Validate at the APP Tier (For security)
    Validate at the Data Tier(For security and integrity)

    If you accept input from a web page, scrub it, and that doesn't mean stripping brackets or quotes, it means putting in a list of valid characters and tossing or replacing absolutely everything else.

    Yes, you might wind up validating something that doesn't need to be validated or scrubbing something that doesn't need to be, the performance hit is worth it.

    Also, Stored Procedures are a great resource, if you design them properly you add an extra layer of security that can actually improve your application performance. (All my recent projects have Stored Procedure execute only rights.

    If your db code has select * from table in it, you're doing it wrong.

    Ok, enough ranting from me.

  24. XSS attempts I've noticed by trevdak · · Score: 4, Interesting

    As a content manager for the U of Rochester when I was a student there, I witnessed thousands of attempts at XSS every month. All of this thanks to one idiot who decided he wanted to put a mambo website up on the student activities server, we had our main server breached and multiple websites defaced. once you're breached, everyone wants to try to hack you again. One interesting thing I noticed is that the majority of XSS attempts will try to call a script in a file with a .gif or .jpg name. This way, if a curious person sees the attempt and tries to visit the linked script, all they get is a broken image. However, the file_get_contents php function, or other such functions, will read those as PHP. I've seen these scripts uploaded to government websites, university servers and many other places. The one that was put on the U of Rochester server attempted to delete all of the files on the server and put in code for what looked like a perl proxy server (i dunno, it was kinda obfuscated, and I'm not too good at perl yet). The XSS scripts are quite complex, too. Some of them create HTML/javascript console interfaces for people to interact with the server as if they had an SSH connection. And they're all over the place. I've got a website that's had less than 1000 hits, and I've seen three separate attempts to use XSS on it.

  25. XSS is Common Because Our Tools Are Broken by Dom2 · · Score: 2, Insightful

    How many "web" templating systems do you know that automatically escape HTML unless told otherwise? I know of one that can be made to do so: Mason. Even then, you have to enable it, as it's not turned on by default.

    What about PHP, ASP, JSP and so on? Will they ever grow up and automatically escape HTML by default? I doubt it very much.

    In the meantime, there's always mod_security if you're willing to invest the time configuring it. But it's no guarantee...

    -Dom

  26. Re:I don't get XSS by TheAJofOZ · · Score: 2, Insightful

    The problem isn't that they didn't validate the user input, so much as that validating user input is really, really hard. RSS aggregators are discovering the problems with validating that HTML is safe. See http://www.feedparser.org/docs/html-sanitization.h tml
    The trouble is that an approach like that limits what you can do too much: http://www.symphonious.net/2006/09/10/stripping-st yles-as-part-of-sanitation/
    Any site that wants to support formatted comments, like Slashdot, has to deal with this. The plus side when it's just comments is that you can have very draconian limitations to what's accepted without it getting in the way (like Slashdot does).