Automated detection of CSRF

I’ve been finishing the OWASP Top 10. One of the things I profess I know little about is automated tools. Up until recently, they’ve created more work (false positives, false negatives) than is actually justified in running the tool. However, they are getting better.

After discussions with Jeremiah Grossman of White Hat Security and WASC fame, I was a little surprised to find that none of the tools can detect CSRF vulnerabilities. This is doubly surprising in that of all the attacks, this one is tractable given a flexible enough engine.

The basic game plan is this:

a) Watch an action take place
b) Determine what changed so you can create a signature of the attack
c) Create a pre-canned request from (a) but add in your CSRF locator strings
d) Go.

Now, how to exploit the CSRF? It will need something like a eggshell site of pre-canned CSRF attack payloads. Most CSRF attacks start with a XSS, so the game plan has to be … find a XSS and insert the eggshell in there. This is not hard, just requires that the victim browser has access to the eggshell site, or the CSRF attack is small enough to be self contained by the hosting site itself (as in the Samy worm).

However, it is fun to read professionals dismissing the potential of CSRF. This list either shows ignorance about how many apps work, or worse, ignorance of how you can easily submit a form from a GET request, creating a POST request. All it requires is sufficient payload space to include a link to a vulnerable reflected or persistent XSS to start obviating the HTML stream. Once that’s done, CSRF is all but in the can.

Interesting. We need to do more, not less CSRF promotion in our camp. However, on the other hand, our defenses are woeful, so maybe leaving it in a less than well understood state is a good idea. Hard to say. What do you think?

Comments

One response to “Automated detection of CSRF”

  1. Martijn Loth Avatar

    Interesting blog-topics here, Andrew!

    I’m going to have to go with the “mass-positive” over the “mass-negative”; successful CSRF attacks are difficult enough to detect program-wise, informing the masses of these possibilities should be our front line of defense.

    The way I see it: we’ve stood at this crossroad before.
    At a certain point in history the security-scene stood before the same decision regarding things like sql-injections: “should we risk exposing our vulnerable sides to people who could possibly have malicious intentions?”.
    While such knowledge is still not as widespread as I had hoped, we are finally bringing the topic of security to the lovable, but ignorant public. We should not stop now.

    [optimism]Besides, the more people know about these vectors, the more people will be able to pitch in useful ideas.[/optimism]

Leave a Reply

Your email address will not be published. Required fields are marked *