As we all know that what is the SOP? As its very popular. But my
question arises when, pentesting this functionality.
AS SOP provide the website to call the resources only from its domain.
Ex. http: //example.com/ have the SOP functionality then Only
resources can call from this (example.com) domain.
Before you go ahead and try to pentest, you need a more than vague understanding of how it works. Mozilla's MDN webdocs provide a very good starting point.
How the attacker might get damage this? I think its very simple
functionality. So i want to know about what vulnerabilities can arise
here?.
The same-origin policy (SOP) is a browser-level security control that dictates how a document or script belonging to one origin can interact with a resource from some other origin. Basically, SOP prevents scripts running under one origin from reading data from another origin. There may be cases where an app needs to allow other origins for resource access. This is achieved by using Cross Origin Resource Sharing. There can be potential security issues due to CORS mis-configurations. There are basically two ways in which CORS allows cross origin communications:
- Access Control Headers: For every cross domain request the resource server issues access control headers in response which indicate if the requested access can be provided. TO gain a full understanding of how and when these headers are used and how they are interpreted by the browsers, I point you back to the MDN references.
Recently the guys at PortSwigger came up with a blog post, highlighting vulnerabilities arising due to CORS mis-configurations.
- HTML5 postMessage API: The Window.postMessage() method, introduced in HTML5, allows JavaScript code running on different origins to communicate with each other in a bidirectional manner. e.g. This API can be used for communication between an iframe and its parent document.
This blog post highlights potential security issues in postMessage API implementations.
Recommended reads:
Why is the same origin policy so important?
How does CSRF correlate with Same Origin Policy