== A browser sent a request. Did the user mean to send it? ==
The Zen of user intent and action
Covers CSRF, clickjacking
and maybe a teensy bit of social engineering
Outline:
1. Wait, what? - A Synopsis of CSRF
2. CSRF protection
3. CSRF protection in practice
4. Clickjacking
5. Clickjacking protections
== Wait, what? ==
Today, we're going to look at one of the fundamental assumptions of
most programmers, and then show you that it's not true.
The assumption is: given a request that has the correct session
cookie for a user, that request is what the user explicitly requested.
Now let's debunk it. The basic method we're going to do is use some
code to trick a browser into making a request when the user doesn't
realize it, by doing so in the background. To do this, the user does
have to visit my malicious webpage, but this is something that is not
too difficult to do with a little social engineering.
"DON'T CLICK HERE!"
First, GET requests. These are easy. Make an tag with the src
pointing to the page you want to forge a request to. A browser sees
the img tag, attempts to load up the URL, gets some content that's
not an image, and fails out.
GET requests are supposed to be *idempotent*, that is, when one
happens the world is not changed: no users are deleted, no posts
are submitted, no nuclear missiles are launched. So in theory, such
an image tag shouldn't actually make a difference. In practice, many
applications implement their logout function as a plain text link
to logout.php. You can have lots of fun with this!
Next, POST requests. Maybe a little harder to do, since there's no
way I can make an img tag post to another website? Wrong! Here are
two ways I can forge a POST request:
1. Create a