Cross Site Scripting (XSS)

XSSHello everyone!
Today we are going to cover some basics about a common vulnerability found in web applications.
Due to this, a user (attacker) can inject a (client-side) script into the web page.
Interesting? then…carry on reading..

But, what is Cross-site scripting (XSS) ?
XSS is an attack technique which allows (or rather I should say, “forces”) a web site to execute and display malicious code on a user’s web browser.
The intended victim of an attacker is a user and not the server. The server is a just a host while the malicious code executed is on that user’s (victims’s) web browser.
Attacker uses the server just to perform the attack.
So, what is the exploit code for this kind of attack?
Generally, the code is written in JavaScript (a JavaScript malware?) or it could simply be in HTML, executed on a user’s web browser! (These two are most commonly used)
Let us now try understanding this with an example:
Consider http://xss_vulnerable.com/ is a site vulnerable to XSS attack.
An attacker first needs to identify and locate this vulnerability. After this, he can perform many acts including
  • Account hijacking
  • Cookie stealing
  • Intranet hacking
  • History stealing
  • even..keystroke recording and much more..
They basic idea behind is to make a web server display back the input provided. So, one of the most common vectors for this is via a search box.
_
Here, let me show you a quick example I wrote for this little article:
A simple search box for providing user input and then displaying the results accordingly


Now, what if we replace our input? with a javascript/html code?
Lets try injecting a simple alert box,

And the end result is…

By looking at the source code of the page

we can cleary see, our input was injected into that web page and executed an harmless alert dialog box.
An attacker can now perform much advanced XSS attacks to exploit users (cookie stealing, etc) and spread that link.
Most users fall for this attack as the URL contains the REAL web site domain name.
So, these were some basics about Cross-site scripting (XSS) attack. Hope you all have enjoyed this small post.
Stay tuned for more posts regarding various XSS categories (Non-persistent, persistent and DOM-Based), preventing XSS attacks, etc
Share:

0 comments:

Post a Comment

DISCLAIMER

The information provided on hottechtips.blogspot.com is to be used for educational purposes only. The website creator is in no way responsible for any misuse of the information provided. All of the information in this website is meant to help the reader develop a hacker defense attitude in order to prevent the attacks discussed. In no way should you use the information to cause any kind of damage directly or indirectly. The word “Hack” or “Hacking” on hottechtips.blogspot.com should be regarded as “Ethical Hack” or “Ethical hacking” respectively. You implement the information given at your own risk.