DOM based XSS

Wikipedia definition : DOM-based vulnerabilities occur in the content processing stages performed by the client, typically in client-side JavaScript. The name refers to the standard model for representing HTML or XML contents which is called the Document Object Model (DOM)
JavaScript programs manipulate the state of a web page and populate it with dynamically-computed data primarily by acting upon the DOM.

simply that type occurs on the javascript code itself that the developer use in client side for example
"A typical example is a piece of JavaScript accessing and extracting data from the URL via the location.* DOM, or receiving raw non-HTML data from the server via XMLHttp Request, and then using this information to write dynamic HTML without proper escaping,entirely on client side."
Here is the url :
xss_r/?name="><script>alert("xss")<%2Fscript>

DOM based XSS Demo

Suppose the following code is used to create a form to let the user choose his/her preferred language.
A default language is also provided in the query string, as the parameter “default”. we will use the following code for demonstration purposes:

Code:-

<select>
<script>
document.write("<OPTION value=1>"+document.location.href.substring
(document.location.href.indexOf("default=")+8)+"</OPTION>");
document.write("<OPTION value=2>English</OPTION>");
</script>
</select>
The page is invoked with a URL such as: http://www.some.site/page.html?default=French


A DOM Based XSS attack against this page can be accomplished by sending the following URL to a victim:


Quote: http://www.some.site/page.html?default=&...script&gt;


The original Javascript code in the page does not expect the default parameter to contain HTML markup, and as such it simply echoes it into the page (DOM) at runtime. The browser then renders the resulting page and executes the attacker’s script:
alert(document.cookie)

Now we've discussed all types of XSS.

DOM based XSS DOM based XSS Reviewed by Unknown on 12/12/2015 Rating: 5
Powered by Blogger.