HackTricks-wiki / hacktricks

Welcome to the page where you will find each trick/technique/whatever I have learnt in CTFs, real life apps, and reading researches and news.
http://book.hacktricks.xyz/
Other
9.06k stars 2.7k forks source link

CSRF bypass changing content type #117

Closed martinbydefault closed 3 years ago

martinbydefault commented 3 years ago

When reading this section: https://github.com/carlospolop/hacktricks/blob/master/pentesting-web/csrf-cross-site-request-forgery.md#content-type-change I'm not sure if this is correct. It says that:

You can change to POST Content-Type to application/json, application/x-url-encoded or form-multipart and maybe you will be able to bypass the CSRF token.

Instead of application/json, shouldn't be text/plain?

As far as I know, the three content types that doesn't trigger CORS Preflight Request are (reference: MDN):

carlospolop commented 3 years ago

Hi @martinbydefault,

Thank you for your info! Actually the original idea of that part of the post was to indicate that a different content-type may trigger a different behaviour in the server. However, I have added your information in that part of the post and in the CORS page, so thanks!