📀CSRF Cheat Sheet

Proof-of-Concept Attacks

HTML GET – Requiring User Interaction for Proof-of-Concept

-----------------------------------------------------------------------------

HTML GET (No User Interaction)

-----------------------------------------------------------------------------

HTML POST – Requiring User Interaction for Proof-of-Concept

-----------------------------------------------------------------------------

HTML POST (AutoSubmit – No User Interaction)

-----------------------------------------------------------------------------

JSON GET – Simple Request

-----------------------------------------------------------------------------

JSON POST – Simple Request

-----------------------------------------------------------------------------

JSON POST – Complex Request

-----------------------------------------------------------------------------

A couple things worth noting

XMLHttpRequest

It’s important to note that you do not need to be able to read the response to execute CSRF (this is always the case with basic HTML CSRF). CORS restrictions may mislead people into thinking it is not vulnerable, when it actually is vulnerable to simple requests.

An XMLHTTPRequest is deemed “simple” if it meets certain conditions about the headers that are set. Specifically, it must use GET, HEAD, or POST and the content type can only be set to application/x-www-form-urlencoded, multipart/form-data, or text/plain. The other headers that can be set while keeping the request simple are Cache-Control, Content-Language, Content-Type, Expires, Last-Modified, and Pragma. If it is not deemed simple, it will be pre-flighted with an OPTIONS request to see if the current domain is allowed. By default, XMLHttpRequest will not send credentials, and this must be enabled by setting .withCredentials to true;

Flash

Previously, Flash could be used to set custom headers. This only works with old versions of Flash, and used to be exploitable using CSRF-Request-Builderarrow-up-right. Today, you would need the site to use crossdomain.xml that allows a domain you can forge requests from.

Siverlight

Today, you would need the site to use a clientaccesspolicy.xml or crossdomain.xml that allows a domain you can forge requests from.

Last updated