How to XSS attack – JS injection in url

Some websites validate some bits and pieces but fail in other cases assuming that user will not pass anything strange there.

French OS Con website is and example of that XSS security risk.

If you go to this wage:

You will see there is a link go back to previous post. Unfortunately this post’s id is take straight from the requested URL (GET parameter) without any cast or validation. It is an common case of XSS errors where page number, date or id is passed around in links and it is not validated properly.

All you have to do is add your URL encoded javascript string and replace ‘ret’ GET parameter to inject JavaScript into the web page. You just have to prefix it with double quotes to get out of the URL definition:

Result as always is execution of the XSS:

XSS example image

How to prevent XSS attacks like this?

To prevent this mistake developers should validate, cast or escape all instances of values passed form GET, POST and COOKIES.

Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

Comments are closed.