By default, cookies are set to SameSite=Lax, which stops the cookie from being sent during cross-site requests, unless they are initiated by top-level navigations via GET requests. This effectively protects against CSRF attacks launched through POST requests.

But A number of web development frameworks support the override of HTTP methods at the server-side. An attacker can exploit this by altering a POST request to a GET, thereby bypassing the SameSite cookie restrictions and successfully performing CSRF attacks.

How Method Override Works

Method Override is a functionality that allows the HTTP method processed by the server to be different from the one specified in the initial request. Here are some typical ways to override methods:

These techniques are frequently used to emulate PUT, PATCH, and DELETE requests in web forms, which by design, only support GET and POST natively.

Crafting the Exploit

After identifying a potential request on an identified framework, as an attacker it’s trivial to craft this exploit to trigger the malicious GET request e.g.

<script>  
  document.location **=** "https://hazanasec.github.io/send?amount=1000&_method=POST";
</script>

When loaded by the unsuspecting victim, this script bypasses the Lax restrictions and performs the intended action on behalf of the victim.

In conclusion, while the SameSite cookie attribute has added a layer of defense against CSRF attacks, it’s essential to be aware of its limitations and potential workarounds. Method override, in certain circumstances, could be exploited by attackers to bypass these protections