The XSS is basically a way to redirect the user to another webpage without the user knowing about this.
There are two types of XSS :
* Reflective
* Stored
Reflective XSS:
This is the most common type of XSS.In this case the code is not stored on the server-side. Let me show you a demo of this. Let us assume there exists a web page with a search box in it. http://www.search.com/Now type anything in the box and look at the URL. If we type “hacking”. The URL becomes as follows:
Now in the URL, you can see q=hacking. Also look at the source code of the green box highlighted above. It is as follows:
<input type=”text” id=”searchbox” value=”hacking”>
Now Suppose this website is vulnerable to XSS , if we make the URL as:http://www.search.com/search?q=”><script>alert(“hacked”
The html code of the box would become as follows:
<input type=”text” id=”searchbox” value=””><script>alert(“hacked”)</script>. Now what has happened is that, we have manually closed the input box and written our own script box. So if you give this link to someone then “hacked” would pop up on the screen.
This link is also very good http://ha.ckers.org/xss.html , once you get the hang of XSS.
Now when you give this link to someone, they will actually goto http://www.yoursite.com thus fooling the user :poc.
The following is a POC- Proof Of Concept.
http://www.google.com/search?btnI&q=allinurl:http://www.yahoo.com/
In this case it is going to goto http://www.yahoo.com even though the URL starts from http://www.google.com. You can also encode the URL so that the user doesn’t see the last part of the URL. You can learn how to do that here : http://pc-help.org/obscure.htm
You can goto http://www.xssed.com and check out the XSS vulnerabilities in all the websites and use it to your advantage.
Eg. you can make one phishing site of GMAIL and you can give the victim a link with http://www.google.com/(link which is vulnerable to XSS) which will re direct the user to your phishing site. The User wont know as he will mostly see the starting part of the URL, thus he is fooled. You can’t use the above link ( given for POC) for your phishing page.:p Guess Why!
Try using some other XSS vulnerability from xssed.com or try finding your own XSS vulnerability on some website.
STORED XSS:
In this type of XSS, the Malicious Code is stored on the server. Eg . Take the case of a guest book which takes user input , stores it in database and displays it to other users. If the code is “Buggy” , a hacker can insert a javascript there so that every time any user opens that page, the script is executed, without the user knowing.
Reflective XSS is more common on the internet as the developers are more careful when something is being written to the server database :p
Interesting Information:
XSS is a very dangerous vulnerability. Bank Websites take utmost care to see that their code is not vulnerable to XSS as they are the most targeted. Just Imagine if a bank URL re directs to some hacker’s phishing page. All the user’s details are lost!
The best video tutorial of XSS is here: http://infinityexists.com/videos/episode13/. You can either watch it online or download it.
The toughest part about XSS is finding a vulnerable piece of code and filter evasion. Many sites have code such that malicious code is filtered out from the user input, so the thrill is in finding a way to evade this filter!.
This link is also very good http://ha.ckers.org/xss.html , once you get the hang of XSS.