No description, website, or topics provided.
Clone or download
Latest commit 177fe51 May 23, 2012
Type Name Latest commit message Commit time
Failed to load latest commit information.
csrf Making it the interface less annoying. May 22, 2012
README.txt clean up May 23, 2012
csrf.fxp Making it the interface less annoying. May 22, 2012
csrf.swf Making it the interface less annoying. May 22, 2012
csrf_payload.html Making it the interface less annoying. May 22, 2012


This is a tool for testing CSRF against web services.  This is a complete test in that it can be used to create PoC exploits to exploit real victims and real systems in a real world scenario.  After all if it didn't work in the real world it wouldn't be a useful test.

Why is is this tool needed?
It is posible to use HTML/JS to perform a valid JSON request using parameter padding (,  however while on a recent pentest the application I was testing was checking that incoming requests had a content-type of application/json.  Well as far as I know only Flash can do this. Flash has the unique ability to set arbitrary headers, including setting the content-type to an arbitrary value.  Flash can also set the body of the HTTP request to an arbitrary value.

Limitations of flash:
A content-type of "multipart/form-data" is forbidden, which means “cross-site file upload” exploits like this: no longer work. There are also a number of HTTP headers that are off limits:  But this is blacklist,  not a whitelist approach,  so this tool is able to set strange http headers used by a target system. Such as “are-you-a-hacker: nope!”.  This tool can only send GET and POST requests.  Unfortunately Flash cannot set PUT or DELETE requests,  as these HTTP methods are off-limits for cross-site requests. 

You just need the csrf.swf and csrf_payload.html files. You can run it locally using the file:// URI,  or you can use this copy which was uploaded to and{'test':1}

I wanted a flexible tool so that I didn't have to load up Flex Builder every time I wanted to test a PoC.  So I wrote a simple JavaScript interface that allows the user to build arbitrary http requests.  You specify the request in the fragment part of the url.  There are two special variables,  they are “url” and “body”. The url must always be set,  if the “body” variable is set then the request type is POST.  ALL other variables are assumed to be HTTP header elements.

The body, url and all http header elements of the request are assumed to be urlencoded and are passed though unescape() before being set. If you where testing a traditional POST CSRF request from your local system it would look like this:

In a real world attack scenario this would be placed into an iframe and originate from https. It is useful for CSRF attacks to originate from HTTP because the referer will be omitted from the victim’s request.

<iframe width=0 height=0 src="https://some-attacker/csrf_payload.html#url="></iframe> 

But you could make a request like that with just HTML/JS.  Here is a very simple JSON POST HTTP request:

Notes on debugging:
A good method of debugging protocol interactions is load up wireshark.  Make the request with the original client,  and save that request to a file.  Try and recreate that request using the CSRF Request Builder and save that request to a file.  Then use a diff tool like meld to compare both of the requests.  Try and make them as identical as possible and hopefully the CSRF PoC will work for you.