Link Details

Link 6897 thumbnail
User 111696 avatar

By bloid
via ivanuzunov.net
Published: Nov 16 2006 / 10:55

The best way to avoid XSS is to HTMLEncode while displaying the user input data. But sometimes the user is allowed to add HTML content to the web site. In this case HTMLEncoding is not an option. The solution is to replace all the potentially malicious data.
  • 8
  • 0
  • 807
  • 141

Comments

Add your comment
User 206038 avatar

samus replied ago:

0 votes Vote down Vote up Reply

When I read that last line about replacing the potentially malicious data, I almost groaned. I thought here is another article that is going to show how to use black listing and how to clean up the data when something bad comes up. That is about the worst way to handle your input. However what the article does show is more of a white listing approach. Encode everything and then decode what is allowed. It actually seems kind of reasonable as long as the list of allowed tags is small.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (8)



Voters Against This Link (0)