Slashdot Mirror


XSS Vulnerabilities Reviewed and Re-Classified

An anonymous reader writes "Security Analysts at NeoSmart Technologies have revisited the now-famous XSS-type security vulnerabilities and attempted to re-classify their status as a security vulnerability. The argument is that XSS vulnerabilities are not a mark of bad or insecure code but rather a nasty but unavoidable risk that's a part of JavaScript - and that even then, XSS 'vulnerable' sites are no less dangerous or vulnerable at heart." Are they unavoidable, or just a symptom of lazy coding, or both?

142 comments

  1. Well by twalicek · · Score: 5, Funny

    Samy is still my hero.

    1. Re:Well by chiskop · · Score: 1

      Samy is still my friend.

  2. A hole is a hole by Watson+Ladd · · Score: 5, Insightful

    Saying that these holes don't matter because websites can't avoid them with the standard method of doing things is just plain wrong from a security standpoint. If you are dealing with sensitive data, secure it. If the standard way won't let you, don't do it the standard way.

    --
    Inventions have long since reached their limit, and I see no hope for further development.-- Frontinus, 1st cent. AD
    1. Re:A hole is a hole by dnoyeb · · Score: 1

      Your still young. It takes a few years to appreciate the difference between a quality hole and a not so quality hole...

    2. Re:A hole is a hole by kv9 · · Score: 1

      Your still young. It takes a few years to appreciate the difference between a quality hole and a not so quality hole...

      how many years does it take to learn properly using your/you're?

    3. Re:A hole is a hole by IndigoZenith · · Score: 1
      Your still young. It takes a few years to appreciate the difference between a quality hole and a not so quality hole...

      how many years does it take to learn properly using your/you're?

      Something about this reminds me of glass houses and stone throwing, but I just can't put my finger on it.

      --
      "If at first you don't succeed, destroy all evidence that you tried"
    4. Re:A hole is a hole by baadger · · Score: 1

      how many years does it take to learn properly using your/you're?

      Correction:

      how many years does it take to learn proper use of your/you're?

    5. Re:A hole is a hole by SnapShot · · Score: 1

      I've never been a fan of the / contraction except occasionally when used with "and" and "or" (i.e. and/or).

      New correction (including capitalization):

      How many years does it take to learn the proper use of "your" and "you're"?

      or even:

      How many years of learning does it take to properly use "your" and "you're"?

      --
      Waltz, nymph, for quick jigs vex Bud.
    6. Re:A hole is a hole by Korvar · · Score: 1

      How many years does it take to learn the proper use of your "you're"?

      --
      Korvar the Fox!! www.korvar.pwp.blueyonder.co.uk
    7. Re:A hole is a hole by rsenic · · Score: 1

      I don't think Paul has visited the XSS Cheat Sheet. First of all JavaScript is not the only language that applies to XSS. Secondly, it is a very real attack vector. Especially as Ajax becomes more mainstream, and the filter evasion becomes more diverse, it will be harder and harder for developers to know how to protect themselves. Stripping out angle brackets will protect them against a certain type of XSS, yes. No, it won't protect them from everything. For instance, UTF-7 encoding, or US-ASCII encoding attacks will both walk right around that form of filtering.

      Unfortunately people expect developers to understand what to do. "It's HTML, right? You know HTML don't you? Just stop it from happening!" Well, it's just not that easy. There are two faults.

      One, there are no canned libraries out there that are 100% successful at stoping XSS (you read that right, not one). There are some that when coupled with the correct encoding can stop 100%, but not alone. That's a fact, argue it if you like.

      Second, the browser companies allow XSS (and consumers expect it). It's how Ajax works, and it's how you can embed Flash on a webpage. It's just the way people want to do business online today. There's no going back, so the browser companies need to help come up with creative ways to solve the issue. I spoke with Firefox a while about one possibility of using content restrictions, so that webmasters could tell the browser to highten their security settings on pages they felt were unsafe. There's probably a hundred other ways to do it, but so far nothing has been done.

      Thus the vectors continue. And it's not limited to the attacks you have seen thus far. Jeremiah Grossman and I have come up with a whole new set of attacks based on XSS (he'll be presenting it thus summer at Blackhat if you happen to be near Las Vegas in August). The point being this guy really mis-understands the attack and doesn't get the big picture - which is that the more people tunnel applications over port 80 and the more people want to have a rich dynamic experience on the web, the bigger a problem this will become. Like it or not.

  3. User Content by agnokapathetic · · Score: 5, Insightful

    As buzzwordy as Web 2.0 is, end-user content is rapidly becoming the majority of the visible end-user internet experience (e.g. Digg, MySpace, Facebook, etc.) With thousands/millions of users posting content, XSS filters start to become an arms race against the latest techniques. With Internet Explorer even rendering code with as valid code. Even when filters are put into place, all it takes is one XSS virus to take down an entire website.

    Even disabling Javascript content all together in websites, with user content, other methods can be used to steal cookies/sessions/user credentials. Flash attacks are becoming more and more common, and are near impossible to protect against. Users demand dynamic user-driven content, the companies comply, I'm just surprised this hasn't been more prevalent.

    --Joel
    Ajax Translator

  4. Pardon Me? by drpimp · · Score: 0, Offtopic

    If it was only Javascript that would be one thing. But when some one can "include" say a remote PHP file, I believe this is still considered XSS, maybe just another class of XSS. This is when it becomes an issue. It can allow a user to run arbitrary commands as the web server user, or what ever user that PHP is running as. Next thing you know, if your system is not harded properly, you have remote IRC pipes or shells sending data to/from your server to some remote host. It's a much bigger problem than expressed in the article. Buzzword maybe, but buzzword or not, still has potentially vulnerable security implications.

    --
    -- Brought to you by Carl's JR
    1. Re:Pardon Me? by jmcguire81 · · Score: 3, Informative

      Sorry, but its not the same thing. XSS is strictly dealing with injecting JavaScript into a page so that it will be run in a visiting users browser. What you describe is known as RFI, Remote File Inclusion. This requires some very specific kinds of flaws in program logic to allow it to happen, while XSS can generally be found from any unfiltered content being echoed back in a web page.

      --
      "Konnichiwa", said the boneless horror.
    2. Re:Pardon Me? by dvaldenaire · · Score: 0, Offtopic

      Could you explain how you manage to post BEFORE my answer ?

      --
      What does it mean, "appended to the end of comments you post"
  5. Crazy by Bogtha · · Score: 5, Insightful

    The argument is that XSS vulnerabilities are not a mark of bad or insecure code but rather a nasty but unavoidable risk that's a part of JavaScript

    Er, no. XSS attacks are caused by sloppy web application developers that fail to encode user-supplied data for output in the appropriate way, and by sloppy web developers that trust that whatever was submitted by a user was submitted by the user intentionally.

    Both of these factors have technical solutions that are 100% effective and have been well-known for years. The former has nothing specifically to do with JavaScript anyway, it's just that the holes are most often used to sneak JavaScript onto a page.

    This article is a total crock of shit. For instance when it says:

    It is of the utmost importance to note that a page that has an "XSS vulnerablity" is no more dangerous than visiting a random result generated by a Google search

    It's no more dangerous in terms of security for the client machine. If Hotmail has a security hole, it doesn't make it more likely that somebody will get onto your computer. But they can still read and delete your email, and send email from your account.

    Actually, I take that back, it is more dangerous in terms of security for the client machine. With tools like the NoScript Firefox extension, and the similar mechanisms other browsers have, many people disable JavaScript for the random websites found with Google, but enable them for websites they trust, like Hotmail. So if Hotmail has an XSS vulnerability, they will be executing malicious JavaScript even though they only intended to allow trusted JavaScript to be executed.

    This author seems to have no real clue about web security. I guess this is why Slashdot shouldn't link to random weblog entries.

    --
    Bogtha Bogtha Bogtha
    1. Re:Crazy by masklinn · · Score: 1

      I'd second this post, a forum I lurk on had a major XSS issue a few years ago: flash uploads were allowed and a user found a way for his scripts to call home: he had the ability to embed flash on a page, then every time the flash'd display it'd phone home and send him the login informations/cookies of the user who'd displayed the flash.

      Long story short, he gave himself supadmin rights as a proof of concept and then told of the vulnerability to the dev of the forum software.

      He could just as well have destroyed the whole forum.

      --
      "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
    2. Re:Crazy by Crayon+Kid · · Score: 1
      XSS attacks are caused by sloppy web application developers that fail to encode user-supplied data for output in the appropriate way, and by sloppy web developers that trust that whatever was submitted by a user was submitted by the user intentionally.

      That's how XSS happens. But why does it happen?

      Because the website accepts raw HTML of some kind. And with raw HTML comes JavaScript. Forget about filtering it perfectly. Yahoo has tried for years on end and still the occasional JavaScript injection issue pops up. Because that's what XSS is: JavaScript injection, plain and simple.

      Don't want JavaScript injection? Cut to the root of the problem. Deny the means of propagation: raw HTML. If your users need to format text and you don't trust them, then use something else: BB code or wiki syntax. End of story.
      --
      i ate crayons when i was a kid and now i have two braincells and the blue ones taste nicer
    3. Re:Crazy by laffer1 · · Score: 1

      I have trouble believing that bbcode or any other method is full proof. It depends what you translate the bbcode into in your app. You may still introduce an issue. Perhaps user agents should allow you to disable features on pages using headers, etc. I could explicitly mark a page as not including javascript, etc. Obviously this wouldn't be full proof either, but it would certainly help. If the browser isn't expecting javascript or embedded objects then it can safely ignore them. Maybe we should start signing pages so that they don't display without a checksum, etc. The browser would need to wait for the whole page though.

      Raw xhtml in itself isn't bad.

    4. Re:Crazy by Crayon+Kid · · Score: 1
      I have trouble believing that bbcode or any other method is full proof. It depends what you translate the bbcode into in your app. You may still introduce an issue.
      Nobody said it was perfect. The first rule is to be paranoid. And yes, issues may always appear, but it would be with something you control. Not with something controlled by anybody out there, which expands the possibilities for mischief 1000-fold.

      Maybe we should start signing pages so that they don't display without a checksum, etc. [...] Raw xhtml in itself isn't bad.
      You're just complicating the problem needlessly. Yes, raw HTML is bad, because raw HTML == JavaScript == XSS. When coming from the client-side, that is. Stop raw HTML and you stop XSS. Escape all input from the client-side and there's no more XSS.
      --
      i ate crayons when i was a kid and now i have two braincells and the blue ones taste nicer
    5. Re:Crazy by h4ck7h3p14n37 · · Score: 1

      Forget about filtering it perfectly.

      It can be filtered, you just have to know what you're doing (eg. understand some computational theory, grammars, etc.)

      Don't want JavaScript injection? Cut to the root of the problem. Deny the means of propagation: raw HTML.

      Isn't the root of the problem JavaScript? The JavaScript code doesn't have to be planted on a site by a third-party in order for your information to be collected.

  6. XSS - a bug... sometimes by madsheep · · Score: 4, Insightful

    I think someone would be pretty hard pressed to convince me that XSS cannot be considered the earmark of bad or insecure coding in all or most cases. If anyone reads full disclosure we all know that any given moron can spend 24 hours a day looking on every website to find some XSS bug in the page. Now just because XSS exists in a site does not make it insecure or poorly coded (the later is arguable). However, when these XSS bugs exist on websites that use session cookies or have a login of some sort that allows users to take actions, post, edit things, etc. then it is a product of insecure and poor coding. The risks exists when something can be gained by a threat source by conducting an XSS attack. If a user can post something on slashdot that slaps over my slashdot username and password or my session cookie (allowing them to jump in on slashdot right now and post as me) then it is a security risk. Finding a XSS issue on a webpage such as one that www.arin.net (see Full Disclosure) really doesn't do anything or represent a risk. It is more about what can be gained or done from the XSS attack. As a quick side not to this dicussion.. XSS is *VERY* easy to prevent. Much more so than SQL injection. Who knows maybe these people will try and reclassify SQL injection as not being a problem either. Sanitizing user input by not allowing it or for example converting to < and > respectively is pretty easy and will stop almost all of these attacks. There is no excuse for not being able to secure a page with such coding practices to protect your site and users.

    1. Re:XSS - a bug... sometimes by DavidWide · · Score: 1
      Finding a XSS issue on a webpage such as one that www.arin.net (see Full Disclosure) really doesn't do anything or represent a risk.
      So if someone visits a link to www.arin.net in good faith that it is a trusted website that wouldn't try to break into your machine, what happens when an XSS vulnerability on www.arin.net allows an attacker to redirect to a malicious site that harbours a remote exploit for Firefox, for example? I wouldn't call that "doesn't do anything or represent a risk".
    2. Re:XSS - a bug... sometimes by Watson+Ladd · · Score: 1

      or looking at where user input enters the page and restricting html to a limited number of tags. It's hard to think of all evil sequences. Thinking of what's good is simple.

      --
      Inventions have long since reached their limit, and I see no hope for further development.-- Frontinus, 1st cent. AD
    3. Re:XSS - a bug... sometimes by KPU · · Score: 1

      XSS is *VERY* easy to prevent. Much more so than SQL injection.
      SQL injection is easy to prevent. Pass input though an escaping function or use parametrized queries.

    4. Re:XSS - a bug... sometimes by Anonymous Coward · · Score: 1, Informative

      XSS is *much* harder to prevent than SQL injection. Why? If you're a competent coder, you can secure the code on the server end properly. In order to prevent XSS, you need to know about parsing bugs in the *browser*.

    5. Re:XSS - a bug... sometimes by masklinn · · Score: 3, Interesting

      XSS is *VERY* easy to prevent. Much more so than SQL injection.

      Uh? SQL Injection is trivial to prevent, just escape your user-provided content (most languages do it automagically for you if you use prepared statements btw, and by "most languages" I mean to say "just about every language but PHP before mysqli_ and PDO")

      XSS, on the other hand, relies as much in your lack of escaping as in browser-specific "features" such as the ability of MSIE to execute arbitrary Javascript code embedded in CSS.

      XSS is much harder to prevent than SQL Injection.

      Which does not mean that it should ever be classified as "unavoidable" (it's not) or less dangerous than SQLI (it can, in fact, be much worse)

      --
      "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
    6. Re:XSS - a bug... sometimes by baadger · · Score: 1
      The solution to this problem would appear to be to whitelist what is *allowed*, rather than filtering out what is not. If you only need a simple commenting system then only allow plain text, convert double line breaks to

      and wrap the whole thing in

      ... </p>

      This is made alot more difficult with unicode/multibyte input however.

    7. Re:XSS - a bug... sometimes by Fuzzie+Viking · · Score: 1

      Not to stop your PHP bashing, but I use http://www.php.net/manual/en/function.pg-query-par ams.php/ also.

      --
      I am Ergo the magnificent. Short in power, tall in stature, narrow of vision and wide of purpose.
    8. Re:XSS - a bug... sometimes by masklinn · · Score: 1

      Have you noticed that it's not, in fact, older than mysqli_ or PDO?

      --
      "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
    9. Re:XSS - a bug... sometimes by Crayon+Kid · · Score: 1
      SQL Injection is trivial to prevent, just escape your user-provided content [...]

      So is XSS. Just escape all HTML in user-provided content. Ah, but you don't want that, do you? You want your bold and italic tags. Would SQL injection still be trivial to prevent if you didn't escape it altogether and wanted for "some" SQL to pass through and some not?
      --
      i ate crayons when i was a kid and now i have two braincells and the blue ones taste nicer
    10. Re:XSS - a bug... sometimes by dzfoo · · Score: 1

      >> XSS, on the other hand, relies as much in your lack of escaping as in browser-specific "features" such as the ability of MSIE to execute arbitrary Javascript code embedded in CSS.

      I'm sorry, but if a developer is aware of this IE bug^H^H^Hfeature, then why can't he properly validate and encode tainted input in much the same way? Any arbitrary text will not execute from CSS, only JavaScript code will execute. And not only any JavaScript code, but code that is properly embedded for it to be recognized as executable code by the browser. Whatever markings it has that make the browser execute it should *never* be valid user code, and so there is no reason for a properly implemented application to allow it in the first place.

              -dZ.

      --
      Carol vs. Ghost
      ...Can you save Christmas?
    11. Re:XSS - a bug... sometimes by poot_rootbeer · · Score: 1

      XSS, on the other hand, relies as much in your lack of escaping as in browser-specific "features" such as the ability of MSIE to execute arbitrary Javascript code embedded in CSS.

      There's no reason to allow a user to inject their own CSS code into site content.

      Filter out all style definitions from user-provided content before sending it to the client for rendering.

      Better yet, use a whitelist approach. If you're going to display the user's name, don't accept anything other than letters and whitespace. If you're letting the user submit "free text", don't accept anything that's not alphanumeric, whitespace, punctuation, or a standard subset of HTML markup, like <b> and <i%gt;.

      Know what your data type is SUPPOSED to be, and it will make it much easier to identify cases where invalid data is offered.

  7. Re:How about some XSS abuse at interpol by brenddie · · Score: 1

    curiosity killed the cat. dont click that link.

    --
    The best test environment is production. - Me
    chrome://browser/content/browser.xul
  8. Yes, unavoidable. by Spazmania · · Score: 3, Informative

    Back in the 1980s' BBS days, I wrote a terminal emulator for the commodore 64 that would allow a BBS to enhance the user's experience by downloading and running short assembly programs. Users of any standard BBS software could even post such programs to the message boards for other users to enjoy.

    JMP 64738 (system reset) was the unavoidable result. The next version of the software recognized that the functionality could not be secured and removed it.

    --
    Moderating "-1, Disagree" is simple censorship. Have the guts to post your opinion.
    1. Re:Yes, unavoidable. by LordLucless · · Score: 3, Informative

      There's a difference between that example and XSS attacks on a website.

      In your example, the BBS was expecting code. It couldn't verify which code was good, and which code was bad, so it created an insecurity. On a website, the site expects textual content. It doesn't expect code. As long as you escape all user input properly, there's no chance of an XSS vulnerability. If you setup a website that allowed random users to upload javascript to be run on the site (rather than simply display the code as content) then that would be analogous to your BBS situation.

      --
      Just because you're paranoid doesn't mean there isn't an invisible demon about to eat your face
    2. Re:Yes, unavoidable. by Spazmania · · Score: 3, Interesting

      I should hope there are differences between my situation and XSS attacks. They're seperated by the better part of two decades of advances in computing.

      Nevertheless, many of the fundamentals were similar:

      1. The client (terminal emulator) allowed the server (BBS) to download and run code.
      2. A BBS expecting a post (text message) received machine code from a user instead.
      3. The BBS sent that code to the next viewer expecting a text message.
      4. The viewer performed undesired and unauthorized actions as a result.

      The biggest difference is that today's crop of programmers keep insisting they'll find a way to secure the scripting functionality while I gave it up for bad right away.

      --
      Moderating "-1, Disagree" is simple censorship. Have the guts to post your opinion.
    3. Re:Yes, unavoidable. by LordLucless · · Score: 1

      I think you're missing what I'm saying.

      With the BBS situation, you created a tool that allowed people to distribute executable code via BBS. The BBS was designed for content, not executable code. Allowing it to distribute code made it insecure.

      These websites are designed for distributing content, the same as your bog-standard BBS. People upload content, website displays it. All that is needed to secure it, is to get it to treat code as text, rather than as code. In terms of HTML, that's easy. Just run a regexp on all user-supplied data to convert to &gt;, and the content will be treated as text.

      It only gets to be a security issue when you try and do what you did; allow distribution of arbitrary code. That's not what most of these sites do, but since the primary langauge of the web is a human-readable, ascii-text based language, it's possible to sneak executable code on to them disguised as content.

      --
      Just because you're paranoid doesn't mean there isn't an invisible demon about to eat your face
    4. Re:Yes, unavoidable. by Spazmania · · Score: 2, Informative

      These websites are designed for distributing content, the same as your bog-standard BBS. People upload content, website displays it. All that is needed to secure it, is to get it to treat code as text, rather than as code. In terms of HTML, that's easy. Just run a regexp on all user-supplied data to convert to >, and the content will be treated as text.

      Yeah, I got that. The same argument could have been made about my software: all BBSes could have been programmed to recognize the text escape sequences that would trigger my software and eliminate them. Problem is, they were (as you say) bog-standard BBSes. They weren't expecting to receive any sort of text that some wacky guy's terminal emulator would render as machine code.

      Did that make the BBSes insecure? I say baloney. The BBSes weren't the problem. The problem was that my software would accept such text and render it as machine code.

      Browsers that run Javascript could be rigged so that some kind of activator has to be present in the main <head> section or no later code will be recognized. They aren't so suddenly its the fault of every individual web form author who doesn't account for the possibility that someone might enter some code in to the form. No way. Put the fault where it belongs: the architecture of the Javascript language.

      --
      Moderating "-1, Disagree" is simple censorship. Have the guts to post your opinion.
    5. Re:Yes, unavoidable. by LordLucless · · Score: 1

      Did that make the BBSes insecure? I say baloney. The BBSes weren't the problem. The problem was that my software would accept such text and render it as machine code.

      I'd say it did make the BBSes insecure. The BBSes were vulnerable to an attack made by a malicious user. That attack may not have been in sufficiently common usage to make it a concern, but it is a flaw. Writing an online application, and expecting users to "just behave" is naieve to the extreme today. Never trust that the user will give you what you expect, verify everything, and develop secure solutions.

      --
      Just because you're paranoid doesn't mean there isn't an invisible demon about to eat your face
    6. Re:Yes, unavoidable. by masklinn · · Score: 1

      As long as you escape all user input properly, there's no chance of an XSS vulnerability.

      Define "escape all user input properly"

      --
      "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
    7. Re:Yes, unavoidable. by LordLucless · · Score: 1

      Take anything that can be interpreted as browser-executable code, and transform it into something that ain't.

      --
      Just because you're paranoid doesn't mean there isn't an invisible demon about to eat your face
    8. Re:Yes, unavoidable. by psmears · · Score: 1
      In terms of HTML, that's easy. Just run a regexp on all user-supplied data to convert < to &gt;, and the content will be treated as text.

      That’s true, but unfortunately it’s not as simple as that—most web-based bulletin-board software wants to allow the user to use lots of emphasis . I agree that it’s still not very hard to secure—but it’s easy to see how people get it wrong...

    9. Re:Yes, unavoidable. by petermgreen · · Score: 1

      Define "escape all user input properly"

      only allow generation of html that you know is sane, DO NOT let anything unrecognised go through.

      if your just interested in text you can do this as a simple replace operation, < becomes &lt;, & becomes &amp;

      if you wan't to offer formatting you have to parse the input and generate known safe html from it. You must also use appropriate sanitisation methods (e.g. make sure users can't embed extra quotes in a quote deliminated string) for anything you pass from input to output.

      if you wan't to offer users the ability to have custom javascript given back to them or for admins to edit such script you must take extra steps to ensure the information really was intentionally submitted by the user (or thier machine is so comprimised it doesn't matter anymore)

      --
      note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
    10. Re:Yes, unavoidable. by LordLucless · · Score: 1

      Yep, particularly when people start using javascript event handlers in otherwise harmless tags. Thats why I think a lot of sites use bbCode type stuff - [b] instead of <b. Just filter out all HTML tags, then convert bbCodes to HTML.

      --
      Just because you're paranoid doesn't mean there isn't an invisible demon about to eat your face
    11. Re:Yes, unavoidable. by Crayon+Kid · · Score: 1
      Did that make the BBSes insecure? I say baloney. The BBSes weren't the problem. The problem was that my software would accept such text and render it as machine code.


      Ho ho ho. And where did your software live? On the BBS. The problem was that your software had a classical security flaw: code injection. No matter what the code was. The software had a hole and in my book that makes the server it runs on "bad", as in "does bad things to users". So while the server itself wouldn't be compromised, was it desirable if it compromised the users or did bad things to them?

      Browsers that run Javascript could be rigged so that some kind of activator has to be present in the main section or no later code will be recognized. They aren't so suddenly its the fault of every individual web form author who doesn't account for the possibility that someone might enter some code in to the form. No way. Put the fault where it belongs: the architecture of the Javascript language.


      I don't think so. That's treating the symptoms instead of the cause. Browsers are meant to run JavaScript. End of story. If a website feeds a browser JavaScript, it will execute it. It is NOT the browser's job to care whether that JavaScript should be there or not. It is the website's job.
      --
      i ate crayons when i was a kid and now i have two braincells and the blue ones taste nicer
    12. Re:Yes, unavoidable. by Spazmania · · Score: 1

      And where did your software live? On the BBS.

      Incorrect. I believe I made it very clear that my software was the client-side terminal emulator. It required and used no special software on the server/BBS side. Like Javascript, it was intentionally designed to do all its work on the client-side so that no change was needed on the BBS.

      Browsers are meant to run JavaScript.

      And my terminal emulator was meant to run machine code. So what? Since when is it the server's responsibility to accomodate client-side features beyond the agreed-upon baseline? Javascript is not a required component of web surfing. Why should a server that doesn't use that optional feature have to make special arrangements with the expectation that its present? It shouldn't, any more than BBS authors should have had to accomodate my special terminal emulator software.

      --
      Moderating "-1, Disagree" is simple censorship. Have the guts to post your opinion.
    13. Re:Yes, unavoidable. by Anonymous Coward · · Score: 0

      Sounds like a precursor to ActiveX.

    14. Re:Yes, unavoidable. by Anonymous Coward · · Score: 0

      > I don't think so. That's treating the symptoms instead of the cause. Browsers are meant to run JavaScript. End of story. If a website feeds a browser JavaScript, it will execute it. It is NOT the browser's job to care whether that JavaScript should be there or not. It is the website's job.

      This is still missing the big problem with this. Even pages that are supposed to contain javascript need to correctly handle user-supplied data, so a simple header flag would never provide a significant level of protection. Lots of sites have some javascript on every page, which would render this mechanism completely useless.

    15. Re:Yes, unavoidable. by Spazmania · · Score: 1

      Javascript is an OPTIONAL component of the web surfing experience. A header flag doesn't have to solve the problem for all cases; it need only solve it for the cases where the web applications choose not to implement anything associated with Javascript.

      The article's point (and its a good one) is that a web server's failure to implement an optional feature should never be able to open a security hole in a web browser. If it does, that's the browser's fault.

      --
      Moderating "-1, Disagree" is simple censorship. Have the guts to post your opinion.
  9. My take on this sort of thing by dkleinsc · · Score: 5, Interesting

    XSS is not the problem. JavaScript is (just for the record, at NeoSmart we feel JavaScript is more of a headache than it is a life-saver..), and XSS is but a result of the (many) inherent security holes in JavaScript and not in the package itself!

    That quote really says it all. The basic argument seems to be very simple: Javascript Sucks, Ergo XSS Vulnerabilities are inevitable. That's about as accurate as saying that if Chewbacca lives on Endor, you must acquit.

    As someone who's had to wrangle plenty of Javascript, I agree that it sucks, but I disagree with any argument that security vulnerabilities are inevitable. These days, they seem to be more a product of adding features without thinking about the security implications (Hey, let's allow email viewed in Outlook to run scripts!) than poor implementations of those ideas. Although implementation problems play a part: You're busy coding the nifty new feature, you get to a point where it works, and you happily go and check it into CVS oblivious to the buffer overflow you've introduced.

    Fundamentally, there's no such thing as a computer error, only a series of human errors buried deeply enough that they appear to be a computer error (with one exception, that of the expected hardware failure).

    --
    I am officially gone from /. Long live http://www.soylentnews.com/
    1. Re:My take on this sort of thing by Anonymous Coward · · Score: 0

      That's about as accurate as saying that if Chewbacca lives on Endor, you must acquit.

      The Chewbacca defense. I'm glad someone took the time to put that in perspective!

    2. Re:My take on this sort of thing by Anonymous Coward · · Score: 0

      As someone who's had to wrangle plenty of Javascript, I agree that it sucks, but I disagree with any argument that security vulnerabilities are inevitable.

      Actually, over time and many users, yes, they are.

      Javascript is a loosely-typed language designed without security considerations in mind. Like the legions of programmers who insist on using C to create large end-user applications, those who use Javascript ultimately contribute to a culture of "fixing" leaks and vulnerabilities.

      Ironically, true Java applets prevent the very problems that Javascript/AJAX engender. The current generation of Java applet technology is very nice indeed. It is a tried and tested technology that can accomplish anything that you can accomplish with AJAX and more, EXCEPT for compromising security in the ways that Javascript-enabled sites can.

      But because applets have the reputation (not the reality) of being "slow" or "too big", even in this age of big Internet pipes into most homes, they aren't usually considered as an option. Too bad, really.

    3. Re:My take on this sort of thing by Itchy+Rich · · Score: 1

      As someone who's had to wrangle plenty of Javascript, I agree that it sucks, but I disagree with any argument that security vulnerabilities are inevitable. These days, they seem to be more a product of adding features without thinking about the security implications (Hey, let's allow email viewed in Outlook to run scripts!) than poor implementations of those ideas. Although implementation problems play a part: You're busy coding the nifty new feature, you get to a point where it works, and you happily go and check it into CVS oblivious to the buffer overflow you've introduced.

      XSS Vulnerabilities are caused by improperly escaped HTML tags, which are absolutely an implementation issue. HTML tags have to be escaped regardless of XSS because otherwise users can accidentally or otherwise paste a </div> tag into your page and screw the whole thing.

      Why shouldn't you have Javascript in an HTML email? It's just a document like any other. Surely that's the same argument as saying that we shouldn't have Javascript in web pages... or is it the implementation of permissions in the email application that are the problem?

    4. Re:My take on this sort of thing by Itchy+Rich · · Score: 1

      Javascript is a loosely-typed language designed without security considerations in mind.

      There are clear security considerations in the design of Javascript, eg. domain restrictions, file system restrictions and DOM restrictions.

      Ironically, true Java applets prevent the very problems that Javascript/AJAX engender.

      While I do have a high opinion of "true" Java, I find "true" Javascript acting on the HTML DOM is a far more suitable tool to develop web applications with. Different tools for different jobs.

      Personally I find Java applets to be painfully slow because our corporate anti-virus setup makes Java run at glacial speed... which makes me laugh because we're a software company that develops almost entirely in Java.

    5. Re:My take on this sort of thing by baadger · · Score: 1

      Maybe i'm completely wrong, but aren't Java applets just Java programs thrown into a browser window in a secure context? I agree with you, in my opinion it *is* rather disturbing that people are trying to make Javascript do just that, as AJAX, without any standard mechanism for doing so in place (Hence all these AJAX frameworks popping up).

      The problem with Java applets (as far as I'm aware) is they don't integrate smoothly into the DOM, play nicely with stylesheets and can't be extended as easily to access all that juicy browser functionality. What people want from AJAX is the best of both worlds. Java can't do that (yet?) but, although it's distusting and ugly, Javascript can to a degree at the moment

      This is why standards like XSLT, 'Web Applications 1.0' and new versions of Javascript are coming into existance, there is now an apparent need for smoother and more standardised integration between a user's interaction with a client side document, client side data or state, and the server side (database backend).

      Of course the side effect of doing more work on the client side is you have less and less data hitting the server you cannot trust and XSS, SQL injection attacks and God knows what other vulnerabilities are going to play and larger and larger role in 'Web 2.0'

  10. First language by ptaff · · Score: 5, Insightful
    Are they unavoidable, or just a symptom of lazy coding, or both?

    I wouldn't say lazy, but naive. Lots of people now cut their teeth at programming with HTML/Javascript and a simple server-side scripting language, like PHP or ASP. For a reason unknown, these simple languages (PHP especially) try to create a blanket so thick around the coder that most of them don't even think about validating input.

    Crap like auto-string escaping, crap like automagic global variables, crap like easy access to eval(), auto variable casting, these help when learning to program so you can concentrate on the task at hand, but become a big fat no-no when deploying stuff in a networked environment.

    Going back to my first programs in BASIC/C/C++, they were probably filled with holes; but for sure they weren't available for the world to hack.

    1. Re:First language by HeroreV · · Score: 1
      Going back to my first programs in BASIC/C/C++, they were probably filled with holes; but for sure they weren't available for the world to hack.
      You didn't open source your programs?! And you consider that to be good?! What are you doing at Slashdot?!

      Let your work free! I even publish all my grocery lists under a Creative Commons license for all to enjoy! Because /. tells me too!
    2. Re:First language by Crayon+Kid · · Score: 1
      Going back to my first programs in BASIC/C/C++, they were probably filled with holes; but for sure they weren't available for the world to hack.
      And how is that relevant? This is the Web, bad code in one place can now affect a lot of people. All the more reason to pay attention.
      --
      i ate crayons when i was a kid and now i have two braincells and the blue ones taste nicer
    3. Re:First language by h4ck7h3p14n37 · · Score: 1

      *LOL* I've actually kept all of my coursework from my sophomore year of high school onwards; it's in a bunch of 3" binders in a few boxes. I bought a scanner with an automatic feed so that I could scan all of the papers, but I never got around to it. Maybe I should and then release everything under the Copyleft license?

    4. Re:First language by HeroreV · · Score: 1

      Do it! And laugh when people try to make use of it!

  11. This guy doesn't know what he is talking about! by NerdENerd · · Score: 4, Informative

    I work for a bank. A hacker found one page in the Internet banking system that echoed a value from a form into an error message. They then used this to inject some JavaScript which gathered user logons. They managed to acumulate about $70,000 of fools money into a holding account before they were caught. I don't feel particulay sorry for fools who fall for phishing scams but it was still a security hole in the web application that could simply be avoided by an echoding of values before echoing to the page. Since then all code is audited for SQL injection and XSS by an external company before being relesed to production.
    XSS is a real security threat.

    1. Re:This guy doesn't know what he is talking about! by Pink+Tinkletini · · Score: 1

      "Which bank do you work for?"

      "...A major one."

    2. Re:This guy doesn't know what he is talking about! by Anonymous Coward · · Score: 0

      Fuck the banks. It doesn't take a computer for a bank to put a major fucking security hole in your account or your identity. Someone posted a link to this a while back:

      http://wamublamesgrandma.blogspot.com/

      Check out this check the bank cashed:

      http://wamublamesgrandma.blogspot.com/2006/03/chec k-1.html

      The biggest security liability in bank applications are their god-damned lobbyists.

    3. Re:This guy doesn't know what he is talking about! by jrumney · · Score: 2, Insightful

      I don't feel particulay sorry for fools who fall for phishing scams

      I sure wouldn't want to bank with a company that called its customers fools when the phishing scam was being run from the bank's own website.

  12. They are flat wrong by Snowhare · · Score: 4, Insightful

    XSS is not unavoidable and it is a security vulnerability. Slashdot has a cookie based login system. This means that if there is an XSS vulnerability in Slashdot I can cause any action a logged in user (maybe, Commander Taco?) can cause by doing something as simple as tricking them into loading a web page with an 'invisible' 1 pixel tall frame exploiting the XSS. Saying XSS isn't a security vulnerability is like claiming that leaving your house keys under the doormat isn't a security vulnerability.

    1. Re:They are flat wrong by Pink+Tinkletini · · Score: 1
      ...if there is an XSS vulnerability in Slashdot I can cause any action a logged in user...
      You don't need XSS for that. :-)
    2. Re:They are flat wrong by Anonymous Coward · · Score: 0

      Depends on.

      You can force a logout on slashdot, but if a site is coded properly actions with side effects (especially side effects that need to be secured) will only be allowed by POST. Your tinyURL, or 1x1 pixel hacks aren't going to work.

    3. Re:They are flat wrong by HeroreV · · Score: 1
      ...loading a web page with an 'invisible' 1 pixel tall frame exploiting the XSS...
      Firefox and IE both evaluate scripting in hidden iframes. Just set the CSS to "display:none" and not a single pixel of the frame will be visible anywhere on the page. Although I really don't see why you would want to hide the frame very badly anyway.
  13. Is it just me by Anonymous Coward · · Score: 1, Interesting

    Is it just me or did this article not make sense. The information is not presented logically, and it seems to contradict itself. It is vague about details. Is Javascript the problem, or is it XSS, or is it bad users, or is it site owners, or hackers exploiting XSS? I still don't know.

  14. Not me! by fuzzyfozzie · · Score: 2, Funny

    I use VBScript, so I guess I'm safe.

  15. XSS is made of people! by Ant+P. · · Score: 2, Interesting
    Are they unavoidable, or just a symptom of lazy coding, or both?

    Both, in different amounts depending on which scripting language you use.

    It's impossible to write perfect software - not even NASA can do that.
    On the other hand the languages aren't much help. PHP for instance allows you do to stupid things with user input variables. Depending on how your scripts work, you can see no errors for months and then all of a sudden half your database or site gets deleted. Great fun, that.
    1. Re:XSS is made of people! by Anonymous Coward · · Score: 0

      >It's impossible to write perfect software - not even NASA can do that.

      This has to be one of the most often repeated idiocies around. Depending on the scope of the problem, it may be extremely difficult, yes, but not impossible, assuming the specification has a solution (I'll agree that writing software which decides if an arbitrary program terminates is impossible :-))

      That said, not many people are even trying to write perfect software, i.e. software with a proof: typically people just try for software that is informally/experimentally determined to be good enough, or at least rely on other software like compilers and interpreters for which they have no proof.

    2. Re:XSS is made of people! by CTachyon · · Score: 1

      While it's not impossible to write a given piece of software that's bug-free, it is impossible to know that it's bug-free. You may suspect it, or perhaps even believe it, but you can never know it. Formal software provers can demonstrate that a piece of software obeys a theorem, but it doesn't demonstrate that the theorem is correct (i.e. that it proves what you think it proves). It just moves the task of bughunting one abstraction higher.

      --
      Range Voting: preference intensity matters
    3. Re:XSS is made of people! by h4ck7h3p14n37 · · Score: 1

      Agreed, but writing proofs for computer programs is a PITA.

  16. Re:How about some XSS abuse at interpol by Bob54321 · · Score: 1
    curiosity killed the cat. dont click that link.

    Does that include the one in your signature?
    --
    :(){ :|:& };:
  17. Unavoidable? by radical_dementia · · Score: 3, Informative

    Perhaps the author is unaware of the PHP function strip_tags. Or in a more general sense, a simple regular expression can be used to remove script tags or all HTML tags from a string. That's seriously all you need to do to eliminate XSS. The only times when XSS holes exist are when lazy or oblivious coders forget to call the function on any input passed to a script.

    As far as the seriousness of XSS, I think the author is heavily downplaying the issue. With the xmlhttprequest it is easier than ever to use XSS to hijack users' sessions. For example, in a messageboard post or something I could put a simple script that uses an xmlhttprequest object to send the user's cookies with the session id to a remote script. The script can then immediatly hijack the user's session and steal information or whatnot, before the user even navigates to a different page.

  18. Obiously... by Anonymous Coward · · Score: 0

    Obviously CowboyNeal is drunk or his clock incorrectly displays 4/1/2006. No sane programmer with a clue would post or link to such utter nonsense.

  19. XSS has always been bullshit by neuroxmurf · · Score: 3, Insightful

    If you allow local execution of code provided by untrusted remote sites, you have no security and never have, no matter how much the vendor assures you their "sandbox" is safe. XSS is not the security hole, it's just the latest batch of holes in the entire concept of client-side scripting.

  20. Script tags isn't enough. by The+MAZZTer · · Score: 3, Interesting

    If I recall correctly, samy exploited MySpace (there's a link somewhere above if you never heard about it) by taking advantage of the fact that IE6 will execute Javascript: urls in CSS url() attributes (IE something like this:

    background-image: url(javascript:codehere

    Something like that at least. And of couse if you allow HTML tags with attributes anyone could stick a style="" on it and inject some javascript... in theory anyways.

    I read somewhere, and I agree, that the best solution is to strip ALL HTML and use your own tag set (most web forums are way ahead in this department). If you do insist on allowing a subset of HTML, use whitelists to define allowed tags and attributes etc, instead of blacklists... because with a whitelist, if you leave something out, oh well someone can't use a tag they should be able to, it's more restrictive than it should be, they file a bug report and it's fixed. With a blacklist if you leave something out, it's a potential security hole.

    1. Re:Script tags isn't enough. by radical_dementia · · Score: 3, Informative

      Yes, you are absolutely right! However it seems the possible damage is very limited. I just tried this out and it works in both Firefox 1.5 and IE6, but surprisingly NOT in IE7. Here is what I did:

      First I made a css class called test in a seperate .css file in which the background-image property had the following text:

      background-image: url('javascript:window.location=\'http://www.googl e.com\'')

      Then I just made a simple html page with a div tag of that class. When I navigated to the page, it almost instantly redirected to google. It also worked with putting the same text in the style attribute of a tag. However, I tried doing some other things, such as calling alert() and document.write(), and appending document.cookie to the url, but these all did not work. In firefox, the javascript console reported "Uncaught Exception: Permission Denied" on those scripts. IE6 and 7 simply did nothing. So while you can use this to screw up a page, it doesn't seem like you can do more serious things like session hijacking. But I agree with you that the best solution is just to strip all HTML.

    2. Re:Script tags isn't enough. by masklinn · · Score: 2, Informative

      you may want to check Samy's hack of Myspace

      While he didn't use it for anything really detrimental, he more than likely could have, especially when you see the bunch of code he managed to cram in.

      --
      "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
    3. Re:Script tags isn't enough. by timbrown · · Score: 1

      Not just in CSS URL attributes tags actually, see Misunderstanding Javascript injection. Interesting to note that this appears to have been fixed in IE 7, although I haven't carried out any detailed testing yet.

      --
      Tim Brown
  21. Can't understand by Vexorian · · Score: 3, Insightful

    Bulletin Boards have been effective against these issues for ages with bbcodes that use [] instead of > < . Also wikipedia has excellent formatting features without letting users ever use an html tag by themselves.

    By simply turning >< into &gt;&lt;before displaying content that was influenced by user input you get rid of every single XSS risk. If users complaint about it being too limited they should get their own site instead of depenging on blog/forum/ whatever other thing.

    --

    Copyright infringement is "piracy" in the same way DRM is "consumer rape"
    1. Re:Can't understand by Mark+Round · · Score: 4, Informative

      "By simply turning > into >
      Rubbish. That's one of the most basic errors made when people start trying to filter out XSS. Suppose you have a form that takes a user's name and then uses it in a hidden field on the next page ? You could quide easily do something like :

      UserName" style="background:url(javascript:alert('Getting rid of angled brackets won't help you here'))

      Not an angled bracket in there, yet on most systems that'll work and display a popup. Hence the reason it's really not that simple, and the parent post referrs to "an arms race against the latest techniques"

    2. Re:Can't understand by dk-software-engineer · · Score: 2, Informative

      That is why you also turn " into " when it's inside double-quotes. This is the right solution, you just have to finetune it. It's not that hard, you just need to remember it every single time it should be done. It's the "remember" stuff that's hard.

      Include turning & into &amp;. Finally there's ' (&#039;) and you're done.

      Some languages has functions to do this for you, you just need to call them.

    3. Re:Can't understand by jani · · Score: 4, Informative

      Yet even this can be too simplistic, since there may be other things that's happening in the background.

      The first book to deal with this properly that I ever saw was Innocent Code by Sverre H. Huseby (ISBN 0-470-85744-7, Wiley).

      I recommend this not only to people new to web programming, but also to seasoned programmers. There's more than one time that I've heard people say "pfah, I know the pit traps, I don't need this book", and a few weeks later tell me that there were things there they hadn't thought about.

      The book is concise and to the point.

      Note: I'm not neutral about this book; I was one of the people who read through the book and commented on it before publishing time, and Sverre is one of my friends.

    4. Re:Can't understand by piranha(jpl) · · Score: 4, Informative

      As someone else has pointed out, that's a naïve and incorrect approach.

      HTML is a standard. BBcode is a whim. HTML wins for its ubiquity. BBcode gives you nothing.

      People that don't think they can effectively and safely include HTML content from untrusted sources are not viewing the problem in a formal way. Address the cause, not the symptom.

      The cause is not thinking of and treating your HTML input as structured data. Rather, you're thinking of it as a character stream. Textual substitutions are a sign of that line of thought.

      Your user's HTML content is a tree structure. Parse it. Then filter out all elements that are not in your allowed-elements list. Filter out all element attributes that are not in your allowed-attributes lists. Construct these lists by examining the HTML specification and considering the risks of each element or attribute.

      Take it a step further. For each attribute value that contains a URI, parse that URI using a formal grammar. Filter out all URI schemes ("http", "ftp", etc) that are not in your allowed-schemes list. Certain characters, like non-printables, should never occur in a URI directly—signal an exception to the user to inform them of their error. Don't just stop if you don't find anything wrong! Reconstruct the URI from its constituent parts and replace the original with your sanitized version.

      Likewise, formally parse all CSS code: in referenced external stylesheets, embedded stylesheets, and in style attributes. Filter out anything not explicitly allowed. Replace any URIs with the output of the same URI-sanitization function above. Reserialize the content. (This is hard; drop all CSS as a short-cut.)

      When you're done, you'll serialize the HTML document and transmit that to your clients. I guarantee that this will eliminate XSS problems stemming from Internet Explorer incorrectly interpreting malformed HTML, CSS, or URIs. There are other attack vectors; be careful of what you allow to be included inline with documents, or linked to. (Think Flash.)

      This is the correct solution, and most flexible to your users. It's not another idiosyncratic language to learn. It's the world standard for rich textual documents on the World Wide Web.

      Unfortunately, it requires work.

    5. Re:Can't understand by Mark_Uplanguage · · Score: 1

      Thanks for the book reference! Programmers helping programmers is always a good thing.

      --
      "The difference between stupidity and genius is that genius has its limits." -- Albert Einstein
    6. Re:Can't understand by dk-software-engineer · · Score: 1

      It's great that you want to add information to the discussion, but you don't: I'm not going to buy a book to see what you are talking about.

    7. Re:Can't understand by jani · · Score: 1

      The topic is too large to cover in a comment on Slashdot.

      It's so large that it's best covered in a full-day class at a bare minimum.

      I cannot recite the contents of the book, for obvious reasons.

      That is why I provided a book recommendation -- a small, reasonably priced book -- and a link to the book's home page, where you can find part of the introduction and an incredibly useful excerpt to the intelligent reader and experienced programmer.

      Why am I even bothering with spending time with comments like these on Slashdot? Well, because of people like the first person who responded to me; I know that one person more with the necessary knowledge and experience is worth a hundred times more professionally than the rest, and that saves me time and money. That others don't see the point is irrelevant; you wouldn't have seen the point if I hadn't posted, either.

    8. Re:Can't understand by dk-software-engineer · · Score: 1
      The topic is too large to cover in a comment on Slashdot.

      I have made a very elaborate and ground breaking answer to your comment. It's too large to quote here, but you can read it in my reasonable priced book.

      Seriously: I'm not asking you to cover it. Just mention it, in stead of asking us to buy a book. Give us a couple of keywords so we know what you're talking about, no need to cover it in detail. If we want the details we can buy the book. But I'm not going to buy a book because you say it some something that you think I don't know. That it not contributing to a discussion.
    9. Re:Can't understand by jani · · Score: 1

      Is there anything I can say to make you follow the link?

      That you can't be bothered with it, and instead keep repeating your request here, is a waste of my time and yours. Get on with it already.

    10. Re:Can't understand by dk-software-engineer · · Score: 1
      This is what triggered me:
      I recommend this not only to people new to web programming, but also to seasoned programmers. There's more than one time that I've heard people say "pfah, I know the pit traps, I don't need this book", and a few weeks later tell me that there were things there they hadn't thought about.


      Translation: "This is sooo good I can't even explain what it is."
      Further translation: "This isn't really so good. If I just told you what it really is, you'd loose interest."

      First you didn't even say that there was anything interesting on the books website, I assumed the link was for buying the book. But OK, I checked out the site.

      Page 1: Advertisement, as expected. No real info.
      Page 2 (Excerpt from the Introduction): Blah blah
      Page 3 (Summary of rules chapter): This one I only read because it was the last one, I'm being really patient here, trying to find out what you are talking about. I didn't find anything relevant to the comment you replied to. Also, I didn't fint anything a seasoned programmer shouldn't know. I didn't find anything new, and I'm not very seasoned in making high-security websites. I haven't read any books about it, taken any classes or anything like that.

      So either I was right when my internal warning lights started flashing, or I still don't know what your are talking about. Maybe you could just mention which of the rules you think would be relevant for preventing XSS (except escaping which I already suggested), or which of them you think is a surprice to a "seasoned programmer".

      By the way, my first reply to you was really to teach you about discussing online, but since you are insisting so much that you do have an argument, I'm getting curious.
    11. Re:Can't understand by jani · · Score: 1
      Maybe you could just mention which of the rules you think would be relevant for preventing XSS (except escaping which I already suggested), or which of them you think is a surprice to a "seasoned programmer".

      "Seasoned programmers" have different ideas about what they think is obvious and not. I think many of the rules are relevant, but it depends on the programmer's personality, background and experience battling security issues.

      Here's one that's caught a few, and which definitely is something other than your one-in-all solution, escaping:

      Rule 16: Do not massage invalid input to make it valid

      Escaping invalid input can be an example of falling into this pit trap.

      Rule 22: Filter all data before including them in a web page, no matter the origin

      Escaping won't help you here, either.

      Another thing that escaping won't catch, is input that is perfectly valid, but which in an underlying layer has different semantics. I believe the book mentions an example using VBscript, which IIRC is typeless. The incoming value might be okay for validation, but once it reaches has gone through the database layer and is returned to the VBscript layer again, it's harmful.

      Rule 1: Do not underestimate the power of the dark side

      This is the first rule for a reason.

      Rule 3: In a server-side context, there's no such thing as client-side security

      Apparently, few programmers know what a client is. The obvious problem is, of course, that the input you get from JavaScript/ECMAscript, VBscript, Java applets etc. cannot be trusted. The not-so-obvious problem, is that from a middle-ware point of view, the web server is a client, and cannot be trusted.


      By the way, my first reply to you was really to teach you about discussing online,

      In online discussions, that kind of statement basically means "you win, I have nothing but direct or indirect ad hominem to add". Have you even considered that attacking someone else's post for being not quite to the point is further removed from the point? You have contributed nothing else in this subthread.

      Before you presume to "teach" anyone about "online discussions", I suggest that you tone down your patronizing arrogance a few levels, and -- if I may patronize you a bit in return -- learn a bit more about discussions in general.
  22. Re:People being what they are... by Anonymous Coward · · Score: 0

    XD True. Why is there no referrer validation or anything for logout?

  23. Huh? by GT_Alias · · Score: 2, Insightful

    Buffer overflows are an unescapable symptom, C is the real problem. Car accidents aren't the problem...steering wheels are.

    Maybe the people writing web apps need better training? No matter how safe you make the language, there will be people using it who are inexperienced, unfamiliar, or otherwise uneducated about the nuances of paranoid programming. It's very narrow-sighted to blame the tool.

  24. Really? by NerdENerd · · Score: 5, Interesting

    Click on this link for an example against CitiBank
    CitiBank Exploit

    1. Re:Really? by limegreen · · Score: 1

      That's good. Better looking than most phishing emails I get. Even Slashdot reports the domain as [citibank.com]

      Can make it work with https?

  25. Most at risk by Joebert · · Score: 2, Insightful

    Advertisers are the ones who are effected the worst by this.

    Banks & things like that are insured against loss, Federally in the case of banks.
    Advertisers who pay for people to click things on the other hand, are not.

    I'd bet CowboyNeals left nut there's thousands of dollars a day being scammed from advertisers through the use of XSS clicking adverts in the background, or changing the target address of an add banner.

    --
    Wanna fight ? Bend over, stick your head up your ass, and fight for air.
  26. Re:How about some XSS abuse at interpol by m00j · · Score: 1

    well I did anyway, it somehow managed to overload outlook and a copy of outlook express opened as well (the outlook express setup dialogue at least). Seemed to be trying to run some irc and edonkey scripts as well. Had to kill process on firefox.

  27. I don't think so. by Telastyn · · Score: 1

    That's like saying buffer overflows are a nasty unavoidable side effect of using C. They're exploits in the practical world, plain and simple. Caused by poor coding? Yes. Likely due to language difficiencies? Absolutely. Unavoidable? No, not really.

  28. Complete Twit by Anonymous Coward · · Score: 1, Insightful

    Read some of the other guy's articles, he's a complete twit. The best is the one on how javascript should be dead and replaced with VBScript, and how Firefox is "against" Javascript, and how javascript was "almost dead" until Gmail came around.

    Probably a 15 year old kid. Its a fucking wordpress site w/ the default theme. I mean, come on, seriously.

  29. Silly and obnoxious by Lost+Found · · Score: 1

    It's perfectly possible using simple hashing techniques to totally avoid XSS attacks.

  30. This guy is asking for Bruce Schneier's liability by Schraegstrichpunkt · · Score: 1
    As many of you know, Bruce Schneier has been pushing for new law to make software developers liable for defects, regardless of warranty disclaimers. While I don't dispute his analysis of the situation from a short-term security standpoint, I think such the liability he wants would be a disaster for self-employed software developers and the free/open-source software movement in general, and I think such law is unnecessary in the long run (remember that the software industry is still in its infancy).

    That said, if we, as software developers and vendors, start taking arbitrary classes of security holes and declare them "non-vulnerabilities" for the sake of convenience, we are just begging to be regulated!

    Whether or not we should care about certain vulnerabilities is another question (for example, executing arbitrary ActiveX code on a tightly-controlled private network is not necessarily something to worry about), but claiming that such vulnerabilities aren't security issues is lying.

  31. The Cross Site Scripting Faq by mrkitty · · Score: 2, Informative

    Once again if you're curious what XSS is check out

    The Cross Site Scripting FAQ

    --
    Believe me, if I started murdering people, there would be none of you left.
  32. Idiots by twistah · · Score: 1

    I won't even comment on the security risk issue; though it takes a bit of social engineering, XSS can easily be leveraged for everything from session hijacking to plain old phishing.

    Unavoidable? I don't know ASP, for example, and when I was using it for the first time and had a user variable which was displayed as HTML, 2 minutes of Googling led me to HTMLEncode(). Problem solved, for the most part. A real programmer can accomplish this in any language, with a regex or whatever.

    Whoever wrote this obviously doesn't even have a basic understanding of programming or security.

  33. Neowin: Lazy or Naive? by humanaut · · Score: 3, Interesting
    1. Re:Neowin: Lazy or Naive? by aymanh · · Score: 1

      When I came across the parent comment, I was curious to see how it actually worked. Unlike the common XSS attacks, this one doesn't require JavaScript to be enabled, when searching the vulnerable site, it outputs the search query back to the browser, the query is stored in the $s variable, apparently the variable isn't sanitized before being output, so one can inject whatever HTML code they like into the page. The vulnerability is mentioned here on the WP support forums, sadly posters assumed that such code wasn't vulnerable.

      --
      python>>> q="'";s='q="%c";s=%c%s%c;print s%%(q,q,s,q)';print s%(q,q,s,q)
  34. What the hell is Cross Site Scripting? by vtcodger · · Score: 1
    Feeling a bit lost? No damn wonder.

    After reading the linked article, you probably don't know what XSS is unless you knew going in. Here's a link to a FAQ on XSS. http://www.cgisecurity.com/articles/xss-faq.shtml.

    As for the article. My impression is that it is not very well written. I don't know enough about XSS to be sure, but for the most part I don't think it is a very accurate assessment. It appears to me that XSS attacks most certainly are a security issue and are by no means limited to Javascript.

    --
    You can't see ANYTHING from a car, You've got to get out of the goddamned contraption and walk...Edward Abbey
  35. "XSS is another one of those buzzwords by damburger · · Score: 4, Funny

    ...we prefer to call it an 'unrequested Javascript surplus'"

    But that isn't the best bit:

    "Sites with XSS "vulnerabilities" aren't insecure. They're absoloutely no different than any other site - except that a user can manipulate the way content displays on an "insecure" page"

    Thats like saying 'Pearl Harbour wasn't "vunerable". It was absolutely no different than any other naval base - except that the Japanese could drop bombs on it'

    --
    If we can put a man on the moon, why can't we shoot people for Apollo-related non-sequiturs?
  36. XSS prevention in web browser? by IzEBaLL · · Score: 2, Informative

    In my master thesis I implemented a solution in the mozilla firefox web browser that protects the surfing user. It analyzes the data access and data flow in the JavaScript engine of the web browser.

    NoMoXSS (no more XSS)
    http://www.seclab.tuwien.ac.at/projects/jstaint/

    Although it is only a prototype of an implementation (in a rather old version of firefox), it shows the potential of this solution to stop XSS attacks.

  37. XSS isn't a problem. Javascript, cookies are by Anonymous Coward · · Score: 0

    Don't use javascript, don't enable cookies. No problem.
    It really gets my why people don't use HTTP auth (plain or digest) for authentication, as it was intended, instead of rolling their own crap. Sensible people should not escape stuff beyond the normal - XSS problems after than are a problem of the browser.

  38. Our Tools Suck by Dom2 · · Score: 1
    Part of the problem with XSS is that pretty much every single web development tool out there has the wrong defaults. When you build a page in a templating system, anything that you insert into that template should be HTML escaped by default. Of course, you need an easy way to turn that off. But that simple act would probably fix 99% of holes out there. For example, in HTML::Mason, I've set it up so that this:
    <% $foo %>
    gets escaped, whilst this does not.
    <% $foo |n %>
    The question remains -- why are we putting up with such poor behaviour from our tools? The SQL people fixed this sort of issue years ago by introducing placeholders into their APIs. The result is that SQL insertion became a rarer vulnerability. Why not for web templating systems too?
  39. another TLA starting with X? by m4c+north · · Score: 0, Offtopic

    Taking the liberty to change T to trendy, sounds like XSS would fit in nicely with XHTML, XML, Xbox, Xmen, X11, Xray, and heaps of others as "X Something Something". Maybe we should ask Homer?

    --
    Who's your user, program?
    1. Re:another TLA starting with X? by menace3society · · Score: 2, Funny

      Why not--Homer was the first to write extensively about Ajax!

  40. Re:How about some XSS abuse at interpol by Anonymous Coward · · Score: 0

    Sure i *had* to click that link too - I'm glad I'm using a normal browser (Opera) - would not like to think about what could have happened with IE or other crap - Opera just blocked that PopUps and that was it...

  41. Re:How about some XSS abuse at interpol by Anonymous Coward · · Score: 0
    curiosity killed the cat.

    For the curious, it's a fake Interpol message submission page. There's a GNAA linky pic next to the submit fields, which I suspect Interpol would be unlikely to include on their real site.

  42. A Clarification by Anonymous Coward · · Score: 0

    A lot of what has been said here really doesn't go against what the article was about - it wasn't about XSS not being a vulnerability, just about it being taken out of proportion... There's a clarification/follow-up posted now: http://neosmart.net/blog/archives/194#comment-2299

  43. Can we mod the article by danskal · · Score: 1

    Can we mod the article -1 troll?

  44. I like JavaScript! by supersnail · · Score: 2, Funny

    Much of the article seems to be a diatribe against JavaScript more properly called ECMA script.
    I was always prejudiced against JavaScript but a couple of years ago I was stuck with a problem which could only be done in JavaScript (The selections in the second emnu depended on you choice in the first menu, all other checkboxes and menus depended on the second menu selection) or with about 50 static pages.
    I actually came to like it its actually a very clean and consistent programing language albeit with very few builtin features. After a couple of days the only times I ever felt the need to RTFM was for the exact names of the various bits of the web browsers DOM structure.

    How anyone could recomend VB over javascript is beyond me, and, I note no one has suggested the return of the Java Applet!

    As for buggy, well there are javascripts with bugs in but there are very, very few bugs in the ECMAscript implementations I have dealt with.

    --
    Old COBOL programmers never die. They just code in C.
  45. A Clarificiation.. by Anonymous Coward · · Score: 0

    NeoSmart Technologies has posted a clarification on this article:
    The Clarification..

  46. Enlightment from TFA by Frightening · · Score: 1

    XSS just is, and so long as JavaScript remains the buggy and decrepit language it is, XSS will be, and that's all there is to it.

    Excellent, earth-shattering conclusion. Now can I have 10 minutes of my life back please (and all the IQ points I lost while you're at it)?

    Notice also that the blog is apparently vulnerable.

  47. Don't allow the GET method except for index... by dvaldenaire · · Score: 1

    I write some webapps in PHP. At one moment, i completely remove GET method, for another reason (not important here). But i see that, by the way, you can't force someone to POST a form with a link.

    Am I wrong ? I always tought POST was handy and secure.

    If you are interested I may provide some code. It's ugly and perfectionable, but, hey, it works.

    --
    What does it mean, "appended to the end of comments you post"
    1. Re:Don't allow the GET method except for index... by kobaz · · Score: 2, Insightful

      POST is not secure in any way. POST is jsut another method of sending data to the web server, anyone can send the server any data they please to try and exploit your app. The key is validating all user input so that something unexpected never gets into your backend.

      --

      The goal of computer science is to build something that will last at least until we've finished building it.
    2. Re:Don't allow the GET method except for index... by dvaldenaire · · Score: 1

      What i mean is, you can't force (as you can with GET, with a URL containing a URL encoding script) a user to POST a form to any site.

      Cross-Site Scripting is that. Script/SQL injection is another thing.

      --
      What does it mean, "appended to the end of comments you post"
  48. What arms race? by Moraelin · · Score: 1

    Heh. And what happened to escaping quote signs? It's not even a new thing that only the latest JavaScript expert hackers discovered, but something that's also been known in the SQL Injection world for a long long time. (Yes, you can use prepared statements instead too, but you can also just escape the quotes and apostrophes.) And I wouldn't be surprised if it also was a part of some ancient CGI exploit.

    Basically if there's an "arms race", then escaping quotes isn't much of a part of it. The problem was known long before Java Script, and the solution was known long before Java Script.

    So, I don't know... Personally I'll side with the "it's just sloppy coding, by sloppy unqualified coders" camp. Seriously. It has no bloody excuse to still exist. Much less to be handwaved as some _unavoidable_ risk that's really just benign and ok to have in a web site. (As TFA was hand-waving it.) It's _not_ unavoidable, it's certainly _not_ benign, and both points have been known for at least a decade.

    I mean, seriously, wtf... I knew that competence went out of fashion during the dot-com era, but seeing the massive ignorance and cluelessness of some supposed "Gurus" (read the big title at the top of TFA page) is just disheartening. It seems like these days all one needs to be a "Guru" is the arrogance to proclaim oneself a "Guru". From stuff like this, to personally seeing some self-proclaimed "Java Guru" recommend techniques that betrayed some _massive_ ignorance of the language, the VM, and the JIT, not to mention of the fact that he obviously doesn't read much on the subject if he managed to miss 5 years of that stuff being again and again proven to not just work that way. It seems like these days any ex-burger-flipper can just proclaim himself a computer guru and pass their ignorance as some "can't be done any other way, sorry" expertise.

    --
    A polar bear is a cartesian bear after a coordinate transform.
    1. Re:What arms race? by Anonymous Coward · · Score: 0

      It's especially unconscionable because the solution for these kind of compromises is so trivial: take a page from the firewall world and use "default deny" type behavior. That is, if the input isn't known to be safe (e.g. restrict form input to alphanumeric plus _ for usernames), escape it or filter it out. From what I can tell, the biggest reason "new" XSS vulnerabilities keep being found is web coders seem to have forgotten this basic, basic security lesson. Instead of defining what is accepted, and taking a very conservative approach to allowed input, they try to lock down specific attack vectors. Then wonder why new vectors they didn't imagine keep being discovered.

  49. Re:How about some XSS abuse at interpol by Anonymous Coward · · Score: 0
    For the curious, it's a fake Interpol message submission page.

    Uh, it's the REAL interpol site having LastMeasure injected into it via an XSS vulnerability. You know, what this discussion is about? And what the poster of the link said it was in the subject?

  50. horror by Kaenneth · · Score: 1

    back around '99 I worked for a very short time for an 'e-commerce website development' company. I was their very first dedicated tester.

    When I pointed out that users could enter javascript as a user name to be displayed to other users, they didn't care, the response was "Why would anyone want to hack a website?".

    The last website this company produced before then was for a major gaming company that produced a VERY popular collectable card game and had bought out another company that made a paper RPG game featuring underground prisons and large reptiles.

    Which is a completely different demographic group than those who enjoy 'exploring' other peoples computer systems.

    They basically let me go because I wouldn't give up arguing they needed to fix security issues.

  51. NeoSmart no credibility, no reputation in security by Anonymous Coward · · Score: 0

    "Security Analysts at NeoSmart Technologies..."

    These people know nothing about security!!! They should change their name to NoSmart or redefine "New Smart" to mean dumb!!!

    Please... can we just remove this! It's giving some people a false sense of security.

  52. Avoiding XSS: Escape and... ? by dk-software-engineer · · Score: 1
    Now we're getting somewhere. :)

    Rule 16: Do not massage invalid input to make it valid

    Escaping invalid input can be an example of falling into this pit trap.


    This is more a usability-issue than a security-issue. If it is properly escaped, it's harmless. But from a usability point of view, invalid data should normally be rejected.
    You could argue that "properly escaping" can fail, but so can validation. You should always escape correctly, and you should always know exactly how to do that.

    Rule 22: Filter all data before including them in a web page, no matter the origin

    Escaping won't help you here, either.


    I agree that "filtering" must be done. If the input is plaintext, it should be converted to HTML before displayed on a web page. If the input is untrusted HTML, it is far more difficult.

    Another thing that escaping won't catch, is input that is perfectly valid, but which in an underlying layer has different semantics. I believe the book mentions an example using VBscript, which IIRC is typeless. The incoming value might be okay for validation, but once it reaches has gone through the database layer and is returned to the VBscript layer again, it's harmful.


    As data moves between software layers additional escaping may be needed. Typeless or weakly typed languages needs a bit more attention, but it's not that hard. For example PHP (I don't know VBscript):

    function foo($bar) {
        $bar = (int)$bar; ...
    }


    In PHP you cannot force type on the arguments. In this case I don't trust that $bar is an integer, so the first thing I do is to cast it. Now I know it's an integer. If the value cannot be casted to an integer, this will be bad. But if that is a possibility in a production environment, I will just have to handle it more elaborate.

    If validated harmless data becomes harmful by going through the database layer, the database layer has a serious bug. This is normally something I would trust just works. When I create the database layer, I will of course take escaping very serious, as always.

    In short: Remember to escape, and remember the weaknesses of the chosen language.

    Rule 3: In a server-side context, there's no such thing as client-side security


    You kind of chock me here. Are you serious? Of course you are. But this is so basic client/server that it hurts. Anything that comes from the internet is dangerous untill proven otherwise. The experiences programmers knows to identify and keep untrusted data from trusted data, and how to move from the first to the second.

    So generally, I stick with what I said: Escape properly, and you're good to go (in regard to XSS). Including untrusted HTML on a web site may be the exception, that is quite difficult, depending on how advanced HTML is allowed.

    In online discussions, that kind of statement basically means "you win, I have nothing but direct or indirect ad hominem to add".


    I had nothing to add, because (as far as I'm concerned) you didn't add anything I could reply to. But now I've got exactly what I wanted, and now we're having an interesting discussion. You didn't need an entire book to make your point. If anybody doesn't understand what you said, they can now leave the discussion temporarily to study. Buy the book or otherwise, it's their choise.

    And yes, my tone can be arrogant to some people, I'm sorry if I offended you. More subtle advise is too often ignored. This is one of those cases where I just do what works.
    1. Re:Avoiding XSS: Escape and... ? by jani · · Score: 1
      But now I've got exactly what I wanted, and now we're having an interesting discussion.

      No, I don't think so. You fouled it up at the start.

      Yes, you got me riled enough to post that previous entry -- including my ad hominem -- but that's what you got for coming across as an idiot. I don't see anything in your attitude to change that impression, and I expect that this post won't help your impression of me.

      Well, I guess that teaches me for trying to be helpful on Slashdot.
    2. Re:Avoiding XSS: Escape and... ? by dk-software-engineer · · Score: 1

      No, I don't think so. You fouled it up at the start. Uh, you are the one that made a comment that did not add anything to the discussion. How was your feedback? There was no further discussion. But when you finnaly actually said something, there was something to discuss. So who "fouled it up"? We won't agree on this one. Yes, you got me riled enough to post that previous entry -- including my ad hominem -- but that's what you got for coming across as an idiot. My point exactly. By ... "acting the way I did", you finally said what you should have said from the beginning. This is a technical discussion, you need to get technical to add anything. I don't see anything in your attitude to change that impression, and I expect that this post won't help your impression of me. But still, again you are not adding to the discussion. Either you didn't learn anything, or you just dislike me too much to use what you learned. Doesn't matter much, the thread is fubar anyway. Well, I guess that teaches me for trying to be helpful on Slashdot. ...by advertising for a book? Yeah, we slashdotter really love that. If you said what you said in your previous post, in the same post you linked to the book in, it wouldn't be such a pointless advertisement. It would be a relevant comment in the thread AND a good book reference. (Assuming it's a good book, of course.)

    3. Re:Avoiding XSS: Escape and... ? by jani · · Score: 1
      Pot, kettle, black.

      I don't dislike you personally. I dislike your style, I dislike your methods for "discussion" -- which clearly shows that you have no practical people experience, I dislike your attitude, and I dislike your self-satisfaction at "succeeding" with your low tactics. And still, after complaining that I don't add anything even after I did, you're not contributing yourself; just repeating earlier points. That's what's ticking me off, and that's why you're not getting any further technical response. (You surely don't believe that anyone else is reading this by now, do you?)

      If you don't realise that this is a problem with your posting style, then you certainly have no business telling other people how to post. Flaming leads to flaming at least 99% of the time.

      I admit to a certain weakness to over-explanation, and as such, I normally prefer brevity to that. If your first response had been "hey, I looked at that list of rules, and I don't see how they do anything for me that escaping won't solve", you'd have gotten a helpful response instantly. And that's a promise, I'm a sucker for people asking for help.

      If your next response is technical, to the point and steps away from this completely insane avenue we've walked down, you'll get a technical response.

      If not, this is my last post on the topic, because I think I don't have any business adding any more crap, I've already added far more than I should've.

      Feel free to email me for the mud-slinging instead.

      ...by advertising for a book? Yeah, we slashdotter really love that.

      You don't seem to mind the other ones quite as much ...


      If you said what you said in your previous post, in the same post you linked to the book in, it wouldn't be such a pointless advertisement. It would be a relevant comment in the thread AND a good book reference. (Assuming it's a good book, of course.)

      What I "said" in that post added nothing to what was already there, on the website of the book, the infamous third link; it's the typical kind of speculation that anyone with a modicum of programming experience could infer.

      Yes, it's a good book, otherwise I wouldn't spend any time at all promoting it. There is no financial gain for me to be had; even the author only earns a pittance, as anyone in the publishing industry can tell you. The personal gain I have from promoting it, is that if one out of a thousand programmers actually read the points and understand them, and one out of a hundred thousand programmers read the book and understand it, the web will be a safer place, and leave me less hassle in my daily work.
    4. Re:Avoiding XSS: Escape and... ? by dk-software-engineer · · Score: 1
      which clearly shows that you have no practical people experience

      I do. Enough to know that most people behave totally different online. My words needs to be much more extreme to get the exact same meaning, to most people. I am, however, very careful that my words logically doesn't say anything different. It's only the way I say it.

      And I'm repeating earlier points because you seem to not agree, yet still haven't really told me why. We are getting closer, you've told a bit about which situations you think escaping is not enough, but not so much why. I have agreed in some cases, but some are more about programming in general and not so much about XSS.

      I'm sure noone else is reading this, and I strongly disagree that I was flaming, if that is what you are saying. I just responded to an "empty" comment in a language that was hard to ignore. People who post empty comments usually ignore everyone who doesn't agree.

      If your first response had been "hey, I looked at that list of rules, and I don't see how they do anything for me that escaping won't solve", you'd have gotten a helpful response instantly.


      If your first post had been a direct link to the list of rules, and the comment "here is a list of rules about what would not be solved by escaping, see rules number #, # and #.", that would essentially have been my reply. So please, tell me why. I'd love concrete examples.

      ...by advertising for a book? Yeah, we slashdotter really love that.

      You don't seem to mind the other ones quite as much ...


      Huh??

      What I "said" in that post added nothing to what was already there


      You pointed out exactly what you where talking about. That's about the same difference as quoting something relevant from wikipedia, and just pointing to http://www.wikipedia.org/ and say "theres something relevant there". I'm not going to search for it (or pay for it as you suggested), when there's no reason for you not to be more specific.
    5. Re:Avoiding XSS: Escape and... ? by jani · · Score: 1

      My words needs to be much more extreme to get the exact same meaning, to most people.

      Well, in my experience* with online communication mediums, I've found the opposite to be far less problematic and inflammatory. Usually, experienced communicators will ignore outbursts like yours (and followups like mine), while some people do indeed feel provoked to answer. However, those are hardly representative for the constructive responses.

      And I'm repeating earlier points because you seem to not agree, yet still haven't really told me why. We are getting closer, you've told a bit about which situations you think escaping is not enough, but not so much why.

      I thought I was telling you why in the point about rule 16. What you're missing is information isolation; you shouldn't let escaped whateveritis into your middleware, backend or whatever, because of possible unexpected side effects. When you're programming for the web or other user systems, you can't expect to be in full control of the entire data flow, so you have to protect your interfaces as well as your own code. Yes, this is elementary programming practice, but also easily missed.

      In the point about filtering, you again miss the point; filtering is there to avoid divulging information about your system internals.

      In the point you make about type casting, you're not type casting, you're type converting. But if the input is a string, in which the semantics may change in the underlying layers, that doesn't help you at all. In other words, you don't just have to know the language, but you have to know quite a bit about the underlying layers as well. This includes knowing how PHP interfaces with things, either through the various default PHP interfaces (escaped data may be made insecure by PHP itself), or through the PEAR installed modules (now that's a beehive of fun), or through system() calls to ImageMagick binaries ... This reflects back to the point about filtering, in which you have to take care with what you receive from, for instance, the database you just put stuff into, or the PEAR module you just used to simplify your XML handling.

      You pointed out exactly what you where talking about.

      No, I pointed out a small fragment about what I was talking about.

      I could also mention the problem of object encapsulation in Perl, which can add all sorts of nastiness when people assume that their object instance's data structure is unique and inaccessible to other object instances.

      The book itself probably doesn't cover it all, but the rules list shows what the book does cover. And of course the book isn't only about XSS, it covers basic to advanced security for developers in general.

      For instance, one avenue of attack I believe isn't covered directly in the book, is the standard security problem in popular PHP software (image galleries, blogs, bulletin boards, CMS, you name it), which is that they consider code in their include path to be safe, even though it's in a publically available path. The presumably experienced programmers -- I say presumably, because the general code quality otherwise indicates that they're far from newbies -- don't seem to notice that this might be a problem.

      As I hinted at, I could go on and on and on, and Slashdot is just the Wrong Place for it. The Right Place is a book. Perhaps an online, free-of-charge book, but at this point, I could hardly put something like that into motion without being accused of plagiarism**.

      What the recommended book does, is to set people on the right track -- if they're capable and willing -- to dealing with such problems, even if they're not directly covered.

      When I wrote the initial recommendation, I erred on the side of brevity, thinking that the books's official web pages could speak for themselves, instead of letting Wiley's promotional page make the attempt. The rest shoul