The earlier ID was assigned to a Cross-Origin Resource Sharing (CORS) bypass vulnerability in Open Graph API. This is an important feature to let a website share information with another website. In this post, we will discuss how a website can bypass this feature using various techniques. CVE-2105 is a critical issue because it can be exploited by a hacker to hack a website or a web application. The medium severity of this issue is CVSS 6.5.

Cross-Origin Resource Sharing (CORS)

Cross-origin resource sharing (CORS) is a mechanism that allows a web page to request data from a server on another domain. CORS is supported by Chrome, Safari, and Firefox.
A cross-origin request is an HTTP request sent to the origin server that makes a request that crosses domains. The response to the request must be either approved or denied.
A site has the ability to allow or deny cross-origin requests according to its own policy.

How Does CORS Work?

Cross-Origin Resource Sharing (CORS) is a web standard that allows one website to request resources from another website on the same domain. There are some limitations for the different types of requests that a website can make in CORS. For example, if your website wants to share images with another webpage, you must send a preflight OPTIONS request before requesting any data. The browser will then respond with a response code telling you whether or not the request was successful. If the request is successful, the browser sends an Access-Control-Allow-Origin header that tells the target website which domain it's allowed to access from.

Cross-Origin Resource Sharing (CORS) Bypass

Cross-Origin Resource Sharing (CORS) is a standard, which defines how a browser can send data to another domain. This feature is important, because it allows a website to share information with other websites. However, this feature has been exploited by an attacker to execute malicious code in the target site. A hacker exploits this vulnerability by sending a specially crafted request to the target website. The Cross-Site Scripting (XSS) vulnerability CVE-2105 exists in Open Graph API and can be executed by a hacker in order to exploit the CORS bypass vulnerability.

How to Bypass CORS in Open Graph API?

If you are a developer of a website or web application and want to know how to bypass CORS in Open Graph API, then there are various techniques that can be used.
One technique is to use the JS code below:
var og = new XMLHttpRequest();
og.open('GET', 'http://www.example.com/data.json');
og.send();
This will send the data in JSON format to the server and bypasses the CORS security feature of Open Graph API. The downside of this technique is that it does not work in cross-origin requests with HTTPS connections by default, which means it cannot be used for all websites. Another technique is to use the HTTP header X-Access-Control-Allow-Origin as shown below:
HTTP/1.1 200 OK Content-Type: text/plain; charset=utf-8 X-Access-Control-Allow-Origin: https://www.example.com Allow: GET, HEAD, OPTIONS
Content type can be text/plain, text/* or application/*

Timeline

Published on: 11/09/2022 22:15:00 UTC
Last modified on: 11/10/2022 00:33:00 UTC

References