From what I know, there is no documented way to generate PUT or DELETE
requests across domains (yet). Of course, if you're building your app to
include XSRF tokens in POST requests, you may as well add them to
PUT/DELETE as well. I'm wondering if we wouldn't want it for GET as well
then, the next Flash/plug-in bug may be just around the corner.
Robert
On Thursday 10 February 2011, Ben Darnell wrote:
> XSRF is a write-only attack - the attacker performs a request for its
> side effects but cannot directly see the result.
Generally, that is what one would expect. Unfortunately, there were
quite a few bugs in the past (some of them still unfixed) that would
allow an attacker to disclose data by reading the result of a GET
request from another domain in a browser.
> Since GETs should
> not have side effects they don't need XSRF protection.
> Additionally, an XSRF token in GET requests can leak out in
> referrers, etc.
True for general browsing, but if you generate XMLHttpRequests against
some api anyway, adding a header solves this problem.
Robert
Hey Ben,
On Thursday 10 February 2011, Ben Darnell wrote:
> XSRF is a write-only attack - the attacker performs a request for itsGenerally, that is what one would expect. Unfortunately, there were
> side effects but cannot directly see the result.
quite a few bugs in the past (some of them still unfixed) that would
allow an attacker to disclose data by reading the result of a GET
request from another domain in a browser.
That's true, but depending on the specific use case, there may be ways
to secure this. With rich browser apps, the server could hand out a
single session token as a response to an authentication request. That
way we're basically doing cookies without the browser including it
automatically.
> If cross-domain GETs (with the
> user's cookies) are possible then the entire web security model kind
> of falls apart.
Depending on the vulnerability, only certain data types can be read. We
were able to write a three line JavaScript that extends the Object
prototype and then adds a script tag to "execute" JSON from another
domain, collecting the objects that are returned. This worked in certain
versions of chromium and chrome release.
My point is not that these aren't vulnerabilities in the browsers (they
are), so it is fair to say a web application should not have to protect
against it. But if we're building defense in depth (by having PUT and
DELETE XSRF protected when there aren't vulnerabilities yet that would
allow exploitation), as a service developer I want to try to defend
against common vulnerabilities. I see this is not generally possible,
but specific to the web application, its API and workflow.
Robert