Unsafe cors sharing of admin users
The WordPress REST API users endpoint was requested with CORS credentials in a PoC, potentially exposing admin usernames to another site.
- Triaged in 12 days
- Fixed in 2 months
- Disclosed after 4 months
hello,
the following endpoint https://lonestarcell.com/wp-json/wp/v2/users/ has an unsafe sharing of sensitive information of admin usernames
check poc script below :
<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://lonestarcell.com/wp-json/wp/v2/users/", true);
xhr.withCredentials = true;
xhr.send();
}
</script>
</body>
</html>
If another domain is allowed by the policy, then that domain can potentially attack users of the application. If a user is logged in to the application, and visits a domain allowed by the policy, then any malicious content running on that domain can potentially retrieve content from the application, and sometimes carry out actions within the security context of the logged in user. Even if an allowed domain is not overtly malicious in itself, security vulnerabilities within that domain could potentially be leveraged by an attacker to exploit the trust relationship and attack the application that allows access. CORS policies on pages containing sensitive information should be reviewed to determine whether it is appropriate for the application to trust both the intentions and security posture of any domains granted access. Remediation
###Rest API should be visible just for logged admins .
best regards,
Impact
References
###https://portswigger.net/research/exploiting-cors-misconfigurations-for-bitcoins-and-bounties
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the CORS policy on the WordPress REST API users endpoint allowed arbitrary origins with credentials, exposing sensitive user data.
Impact
An attacker might potentially read admin usernames from a logged-in user's session, which could aid further attacks.
What the attacker needed
Victim is logged in; victim visits attacker's page
The fix
The REST API should be restricted to logged-in administrators only.
How it was found
- Create an HTML page with a script that sends a cross-origin request to the users endpoint with credentials.
- Host the page on a domain allowed by the CORS policy.
- Trick a logged-in user into visiting the page.
- The script may potentially read the response containing admin usernames.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
CORS is a browser rule about which sites may read data. The report shows a request to the users list with credentials, suggesting other sites might read it. The fix is to restrict access.
What is CORS?
A permissive cross-origin policy lets another site read responses with the user's credentials.