I am newbie to website security and currently trying to understand Same-Origin-Policy in some depth. While there are very good posts on stackoverflow and elsewhere about the concept of SOP, I could not find updated information on whether chrome and other browsers allow cross-domain XHR post requests to be sent from the first place.
http://stackoverflow.com/questions/5938842/cross-domain-ajax-post-in-chrome http://stackoverflow.com/questions/5938842/cross-domain-ajax-post-in-chrome
I tested that on my website trying to change user info on my server from a different domain. Details below:
- My domain: "www.mysite.com"
- Attacker domain: "www.attacker.mysite.com"
- User (while logged in to www.mysite.com) opens www.attacker.mysite.com and presses a button that fires a POST request to www.mysite.com server...The submitted hidden form (without tokens in this case) has all the required information to change the user s info on www.mysite.com server --> Result: CSRF successful attack: The user info does indeed change.
- Now do the same but with javascript submitting the form through JQuery .post instead of submitting the form--> Result: Besides chrome giving the normal response:
No Access-Control-Allow-Origin header is present on the requested resource
, I found that no change is done on the server side...It seems that the request does not even pass through from the browser. The user info does not change at all! While that sounds good, I was expecting the opposite.
According to my understanding and the post linked above, for cross-domain requests, only the server response should be blocked by the browser not sending the post request to the server from the first place. Also, I do not have any CORS configuration set; no Access-Control-Allow-Origin headers are sent. But even if I had that set, that should apply only on reading the server response not actually sending the request...right?
https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
So is it that chrome has changed its security specs to prevent the post request to a cross domain from the first place? or am I missing something here in my understanding to the same-origin-policy?
Either way, it would be helpful to know if there is a source for updated security measures implemented in different web browsers.