Forum Moderators: coopster
Today I saw a video on youtube in which a hacker showed how can we put javascript code in the URLs of website e.g
www.example.com/data.php?url=''<iframe src="javascript:alert('visit hacker site')">.php
this will show a popup with the hacker url, you can misguide users by such trick hurting your competitors. e.g using such things in blogs and forums and when visitors click they see your message....
also he showed another technique like
www.example.com/ddd/''</title><script>alert('again hacker')</script>.html
I wanted to ask that on which kind of websites such attacks can work and what should we do to block such attacks? also how danger such attacks can be? can we use more lethal code in the url ?
please share your wise words. thank you
so my question is how to block it for inbound links.
htmlentities() in php. There is a good reference here [ha.ckers.org] of attacks.
www.example.com/login.php?url=''<iframe src="javascript:alert('xss hack')">
it will show the popup in the iframe, try it on your domain, similarly something like
www.example.com/store/xss-hack-code.php
will also work.
How will you block such attacks? this sort of attacks can be used by people to post your website link on their dummy blogs or send emails to people with this hack link. remember, when people do the XSS hack they convert the link to HEX format so it is not easy for the user to realized the code in the URLs. e.g I know that flickr is renown for the photo-sharing so I find an xss hack which shows my site ad and email this link to lots of people or post on famous blogs. when users click they see a false advertisement popup on of my website while they believe it has come out from flickr website.
[edited by: jatar_k at 1:32 pm (utc) on April 1, 2008]
[edit reason] please use example.com [/edit]
How will you block such attacks?
I believe having mod_security installed under Apache can certainly help against XSS attacks. It took me ages to figure out why my site was returning a "403 Not Acceptable" error for certain URLs. The reason: I was using 'site' as a GET param in the URL and mod_security was having none of it!
Attackers tend to target known scripts. If you are using well known scripts then make sure they are up to date!