The vulnerability you are talking about is CSRF , but it can be protected.
You can protect against POST being sent outside of an AJAX request (for example, in HTML form) by sending and checking the X-Requested-With: XMLHttpRequest header. It is also not possible to pass through the domain via AJAX due to the fact that this header is not in a secure list (without CORS ).
However, in the past there were some exploits through plugins, such as flash, where headers can be set that were not accessible through the browser (for example, Referer ), therefore, to protect against this, it is recommended to use the synchronizer token template , which includes setting the marker in hidden field to be checked, as well as cookies for all destructive requests. By destructive, I mean requests that modify, represent, or delete things (that is, what should be a POST).
See here for more details: http://www.html5rocks.com/en/tutorials/cors/
source share