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:

http://www.froscon.de/index.php?id=41&mid=132&ret=15

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:

http://www.froscon.de/index.php?id=41&mid=132&ret=%22%3Cscript%3Ealert%281%29%3C/script%3E

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.

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

No Responses to “How to XSS attack – JS injection in url”

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Website:
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>