(contrived example), you can see how I’d be able to manipulate the cookies and send their login cookie to my site (through a Javascript redirect). Similarly this can be used for phishing by sending the user to a fake login page via a link on the real site.

With XmlHttpRequest, I’d even be able to force the user to perform actions (via HTTP POST/GET) on the site – such as the voting example given in this article.

To make matters worse, many of the new community sites that are springing up encourage the user to enter HTML, and correctly differentiating valid HTML from invalid HTML is a difficult process. This means that you can’t really use stuff like PHP’s strip_tags() function.

Hope this helps!

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    At the moment we’ve got a half-empty glass here. I can’t judge the contents just yet, because if I really want to get to the taste I need the whole thing.
    I’m sorry to say, but I find the half of this article useless. It might start making more sense when part two is out and about, but until then this seems like a very lengthy introduction.

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    thomas:

    I’m sorry that my previous post did not state this, but I am aware of the idea of validating input to protect users.

    That said, I have never really understood why many sites have a tendency to use GET data like in your example, rather than keeping then the use of error code numbers. I know, it is quite annoying to have to look up the different numbers when you want to use something, but it saves the worry of someone injecting HTML into your site. In my opinion, the security benefit outways the simplicity in development.

    I like the check_tags function in the first link that *ban jax* posted. It looks like a beefed up version of strip_tags that fits the needs of most developers that need to allow HTML.

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    bq. I like the check_tags function in the first link that ban jax posted. It looks like a beefed up version of strip_tags that fits the needs of most developers that need to allow HTML.

    The Iamcal code is quite interesting, but it doesn’t guarantee XHTML 1.0 valid code, since it doesn’t check the children of the elements (a tag within a tag). Also, it’s not easily extensible to environments that need a broader tag base: there’s a lot more to XSS in attributes than a few protocols. Especially true if you decide to allow the style attribute (which, as the article points out, can execute JavaScript too! Fun.)

    Shoot me, but I’m not sure why anyone would need image tags for most applications either.

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    Am I being totally short-sighted here, or can all these security holes be resolved in one simple stroke: don’t let your users personalise their space through real code!

    My other half asked me a few days ago to help her style her MySpace stuff (and as it’s the first time I’ve really bothered going there I almost threw up when I saw how s**t it is code-wise) and then gave up after tearing my hair out for ages.

    For a start it clearly says “please don’t use CSS to remove any MySpace ads” so immediately I set about doing just that – and succeeded. I then decided to play a little prank on her by adding “table {display:none}” to her style sheet and promptly destroyed the entire site in preview mode.

    IMO these sorts of places – MySpace in particular – are so shoddily written it’ll take a CSS expert to write code to successfully style the soup of nested tables, divs and junk to get anything worthwhile looking at – and I doubt the majority of the user base will be these CSS experts (I know I’m not) – and certainly from my own experience anybody half web-dev savvy have their own blogs with crisp, clean blogging systems or just written their bloody own!

    I’m all for personalisation and marking your cyber-territory, but surely it’s quicker and easier for the users and safer for the admins to allow personalisation through forms and options. Let the user click the settings they want and the system generates the styles.

    Obviously you’ll still need to filter text input areas to avoid IE’s incompetence, but you’re already running a lot tighter ship.

    Or, I say again, am I being short-sighted?

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    MySpace didn’t get popular because it was well-written 😉 It got popular because it gaves users control.

    However, I think that you do have a point in not letting users customize space through “real code.” Isn’t that what most forums and blogs do right now by not allowing HTML when they can avoid it? BBCode and Textile are much easier to secure than raw web input.

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    Well of course you don’t have to let them use real code. You could let them pick between the options you give them. But you could also just not accept their content, or their photos, or their comments..

    Like the previous poster said, MySpace sold for many millions of dollars, and it was only because “making profiles pretty” really appeals to teenaged girls and the boys who lust for them. People like to do their own thing.

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    “But you could also just not accept their content, or their photos, or their comments..”

    I think that’s a totally different ball game – not accepting customisation through real code has nothign to do with censorship.

    I entirely agree that making “pretty profiles” is the attraction of MySpace and its ilk, but as it’s been mentioned, there are much more secure ways of going about it – allowing real-code submission is just asking for too much trouble.

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    this is important stuff, blogging communities allow other users to view their code, but for web 2.0 and secure programs its important to know that the code can be hacker-proof.

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    As well as allowing javascript URLs in CSS, IE also has a “feature” that lets properties be set using expressions, written in (of course) JavaScript. So you can use:

    Just something else to watch out for…

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    I think MySpace giving their users freedom to edit their templates CSS was a huge mistake. Sure, the default theme is ugly but the things that the majority of people do to their MySpaces is much worse. They just destroy them beyond any level of readability or sanity.

    MySpace would be nicer place without theme editing. Pure Volume is proof of this.

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    Your article makes a good case for the security codes necessary to hold back abuse of the system. The system still needs to be refined so that legitimate users are not kept out in the same stroke we use to stop abusers. Thanks for raising the topic so well…

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    I know the article is about XSS, but the example used points to another problem with a lot of these types of sites, not using a validation scheme for the ‘voting’ script, or scripts that control other types of changes.

    A simple check for a valid random unique id in voteOnAuser.php would kill any chance of a XSS vulnerability such as this from having any effect because the ‘vote’ would automaticaly be rejected.

    And a big applause to #28, if you’re going to allow customization then by all means have complete control over the code yourself.

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    I sure there are two clear strategies to prevent XSS attacks:
    1. Format using tidy and then remove anything unexpected – leave only basic set of tags.

    2. Separate administrating and displaying markup content on different sites (like blogger.com does).

    Correct me if I wrong.

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    Instead of
    one should use
    😉 Makes things valid as well 😀

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    All that customization of web application reminds me of an article on network security.

    Pick your poison, do you want to restrict the user to a know and limited set of features or chase all the hacks that people will find?

    With the first approach you define and design it once; the other approach is a never ending race to ensure your application is safe from the known tricks and hacks.

    Ok, it takes more time to develop the white list; most certainly feels more restrictive from a user standpoint but I guess it depends if you prefer to appear on the front page because you’re application is great or because somebody took control of other people’s account.

    Maybe I’m paranoid, but I’d rather spend time expending my applications then fixing my damaged reputation.

    Cheers!

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    http://kevin.mesiab.com/wordpress/index.php/cragslist-vulnerability/

    Apparently they need to heed the message. 😉 At the time of writing, this hole has not been patched.

  • Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    The ad hoc “tricks”? the article prescribes can fall victim to clever attackers. For instance, if you were to use str_replace(“˜javascript’, ”, $html) your script would still be
    http://www.replicahours.com vulnerable to javasjavascriptcript (this is documented in the XSS cheatsheet posted above, excellent reading for anybody interested in HTML validation).

  • Got something to say?

    We have turned off comments, but you can see what folks had to say before we did so.

    More from ALA

    Designed for a Dead Language

    Every language app in your pocket inherited a teaching method built for Latin. Understanding why that happened is a more useful design lesson than anything the apps themselves can teach you.
    Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    Good designers, bad websites: a proposal

    Designers are good people. Some designs exclude people anyway. Alan Dalton offers a practical fix: accessibility personas that help you recognize problems while you're designing, not after. Homework included.
    Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    “Successful” or “Unsuccessful”: the Post-“Good Design” Vocabulary

    Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    Design for Amiability: Lessons from Vienna

    Computing was born in a Viennese cafĂ©. Between 1928 and 1934, while Hitler plotted and Europe crumbled, a motley crew of mathematicians, philosophers, architects, and economists gathered weekly to puzzle out the limits of reason—and invented Computer Science in the process. What made their collaboration possible wasn't just brilliance (though they had plenty). It was amiability: the careful design of a social space where difficult people could disagree without destroying each other. Longtime Web Dev Notes contributing author Mark Bernstein mines this forgotten history for lessons that might just save today's embattled web from its worst impulses. Spoiler: it involves better coffee service and the looming threat of public humiliation.
    Web Dev Notes Proxy © 2026 | Powered by Cloudflare Worker

    Design Dialects: Breaking the Rules, Not the System

    Design systems aren't component libraries—they’re living languages. Rigid adherence to visual rules creates brittle systems that break under contextual pressure. Fluent systems bend without breaking.