65
loading...
This website collects cookies to deliver better user experience
http://www.example.org/foo.html#bar
and on clicking it the page scrolls down to the section "bar" which has the element with id="bar"
.#
sign.window.location.hash
. These are usually not percent-decoded.<script>
var x = location.hash.split("#")[1];
document.write(x);
</script>
<script>
var x = '<%= taintedVar %>';
var d = document.createElement('div');
d.innerHTML = x;
document.body.appendChild(d);
</script>
var ESAPI = require('node-esapi');
element.innerHTML = "<%=ESAPI.encoder().encodeForJS(ESAPI.encoder().encodeForHTML(untrustedData))%>";
element.outerHTML = "<%=ESAPI.encoder().encodeForJS(ESAPI.encoder().encodeForHTML(untrustedData))%>";
var ESAPI = require('node-esapi');
document.write("<%=ESAPI.encoder().encodeForJS(ESAPI.encoder().encodeForHTML(untrustedData))%>");
document.writeln("<%=ESAPI.encoder().encodeForJS(ESAPI.encoder().encodeForHTML(untrustedData))%>");
.innerHTML
, document.write
and eval()
.location.*
, document.cookie
or JavaScript variables containing user data) is returned by the server, calling such functions can lead to XSS.<
and >
). Do not allow user-supplied data to be returned as the first part of the response (as often happens in JSONP). Do not use eval()
to parse the data.>'>"><img src=x onerror=alert(0)>
.If your application doesn't correctly escape this string, you will see an alert and will know that something went wrong. javascript:alert(0
or data:text/html
,<script>alert(0)</script>
.https
, verify that any unsupported markup is escaped.