Skip to content

Instantly share code, notes, and snippets.

@gabemarshall
Created October 5, 2015 17:16
Show Gist options
  • Save gabemarshall/54788bef54823e6a1c25 to your computer and use it in GitHub Desktop.
Save gabemarshall/54788bef54823e6a1c25 to your computer and use it in GitHub Desktop.
Dom based xss example
var debug = document.getElementById("subnav")
function _Debug_(p) {
p = p.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var r = new RegExp("[\\?&]" + p + "=([^&#]*)"),
results = r.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
if(location.search){
debug.innerHTML += _Debug_("param"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment