News for hackers. Stuff that matters.
Re:#1 CSRF Is A Vulnerability In All Browsers by homakov on Friday March 30, 2012 @10:33PM (#3779122)
I see some points but >CSRF isn't a browser vulnerability. It's a serverside application vulnerability. you didn't prove this one. CSRF is a browser vulnerability. ANd I don't care about another stuff you said further - you probably right that most popular frameworks have the protection out of box - I know it, no surprise here:). But I did pretty wide audit - only rails' protection looks really elegant. Hm.. probably I'm too much fan of rails, true.

And, please >Baking CSRF protection into the HTTP protocol is the opposite: it creates a "smart middleman" that will in the long term hamper security. Surely, I don't mean "Stop secure your apps from CSRF, it's not your problem". I just want to make browsers think about the issue as millions of developers have to. Because it is their issue, they are in charge. But we are fixing it on the backend(and we will have to for a next 10 years definitely)

Re:#1 CSRF Is A Vulnerability In All Browsers by Xk on Friday March 30, 2012 @10:47PM (#3779155)
CSRF is NOT a browser vulnerability. The browser is doing exactly what it's supposed to do: load content. The browser can not (and should not) attempt to identify the "evil" HTTP requests from the "good" ones. The browser's job is to make requests.

Now, you could argue the browser's job should be to implement security features as well. It does, after all, implement the same-origin policy. But, if you think about it, there is no good way for the browser to fix the CSRF issue. You can ask the user, which is what's suggested, but that never really works. They'll do one of two things: click "okay" every single time, or stop using your browser.

I would guess well over half of all websites do one of the following: (1) load an external JS file, (2) load an external image, (3) load an external CSS file, (4) use an iframe which points to a different origin, (5) use a JS redirect, (6) use a meta redirect, or (7) open a new window.

The proposed "solution" to CSRF stops ALL of these use cases. The user would have to manually approve each and every one of them. Given that well under 1% of alerts would be true attacks, the user would almost definitely "okay" on the attacks as well: they would have been trained by thousands of other alerts that this is an acceptable thing to do.

There was a paper by Barth and Jackson on CSRF defenses where they propose an Origin header, but that's the extent to which security is implemented in the browser. It is fundamentally up to the web application for verifying the user did in fact initiate the request. No amount of code in the web browser can get around this fact.

Re:#1 CSRF Is A Vulnerability In All Browsers by homakov on Friday March 30, 2012 @10:51PM (#3779160)
>I would guess well over half of all websites do one of the following: (1) load an external JS file, (2) load an external image, (3) load an external CSS file, (4) use an iframe which points to a different origin, (5) use a JS redirect, (6) use a meta redirect, or (7) open a new window. The proposed "solution" to CSRF breaks ALL of these uses.

You definitely kidding me. Please point out where in my post I said to deny ALL requests. I was talking about ONLY POST requests. Probably I forgot to add it :) So, I'm talking only about forms sending and GET is ok sure.

Re:#1 CSRF Is A Vulnerability In All Browsers by Xk on Friday March 30, 2012 @10:54PM (#3779168)
Either you do it for everything, or you do it for only POST and you end up missing half of the vulnerabilities. Correct me if I'm wrong, but your CSRF attack used a GET request, did it not? [1]

Web applications make state-changing operations on GET requests. You might not like it, but they do.

[1] <img src="https://mail.google.com/mail/u/0/?logout style="display: none;" />

Re:#1 CSRF Is A Vulnerability In All Browsers by homakov on Friday March 30, 2012 @11:15PM (#3779212)
>Web applications make state-changing operations on GET requests. You might not like it, but they do.

but when developer made a mistake with GET it is 100% his problem - it's out of question. he should be punished :D

Re:#1 CSRF Is A Vulnerability In All Browsers by tptacek on Friday March 30, 2012 @11:23PM (#3779228)
Nonsensical. CSRF isn't God's punishment for REST-lessness.
Re:#1 CSRF Is A Vulnerability In All Browsers by baddox on Saturday March 31, 2012 @04:33AM (#3779820)
You're both just choosing different places to draw the line between developer responsibility and browser responsibility.
Re:#1 CSRF Is A Vulnerability In All Browsers by tptacek on Saturday March 31, 2012 @12:17PM (#3780647)
That is like saying "you're both just suggesting two totally different designs for the HTTP security model".

His model is wrong. Again: I assume he wants to know that, so, bluntness.

Re:#1 CSRF Is A Vulnerability In All Browsers by tptacek on Friday March 30, 2012 @11:12PM (#3779209)
Perfectly solid web apps routinely ask browsers to POST to other domains.
Re:#1 CSRF Is A Vulnerability In All Browsers by pbiggar on Saturday March 31, 2012 @05:06AM (#3779885)
So rather than deny ALL requests, I think it would work if browsers merely stopped passing cookies on cross-site POST form submissions, no?

Then if 3rd party sites wanted to still use form submissions, they could use an auth token in the form (though I'm unsure why they would do this instead of using JSONP).

Re:#1 CSRF Is A Vulnerability In All Browsers by ynniv on Saturday March 31, 2012 @12:27AM (#3779351)
Firefox already blocks off-domain POST requests, unless the 3rd party domain responds to an OPTIONS preflight request.

So, I'm talking only about forms sending and GET is ok sure.

Google's logout CSRF works because the logout link is a GET request. So, no, there is no quick fix.

Re:#1 CSRF Is A Vulnerability In All Browsers by nbpoole on Saturday March 31, 2012 @12:40AM (#3779370)
No it does not.

---

https://developer.mozilla.org/en/http_access_control#Simple_...

A simple cross-site request is one that:

- Only uses GET or POST. If POST is used to send data to the server, the Content-Type of the data sent to the server with the HTTP POST request is one of application/x-www-form-urlencoded, multipart/form-data, or text/plain.

- Does not set custom headers with the HTTP Request (such as X-Modified, etc.)

---

This is actually a big deal, since it means you can send a cross-domain mutlipart-POST with no preflight. That allows for an effective CSRF attack against file upload systems.

And of course, cross-domain POST requests via <form> tags have always worked and will continue to work.

Re:#1 CSRF Is A Vulnerability In All Browsers by akaBruce on Saturday March 31, 2012 @01:13AM (#3779440)
Am I missing something here?

Let's say you're logged into Gmail and Gmail had no CSRF protection anywhere.

You're logged in while visiting my site. In my site, I include a little bit of JavaScript to make a POST request to Gmail telling it to forward copies of all your incoming email to my email address.

This will not work even without CSRF protection. It would only work if Google sends back the header Access-Control-Allow-Origin: mysite or Access-Control-Allow-Origin: * as noted in the section you linked to.

Of course, I could also try to trick you into filling out a form whose method actually is pointed at Gmail's and include all the hidden input tags to set you up for forwarding emails to me, but you would know something fishy is going on because it would redirect you to Gmail.

Re:#1 CSRF Is A Vulnerability In All Browsers by nbpoole on Saturday March 31, 2012 @01:15AM (#3779445)
"This will not work even without CSRF protection."

It actually will work.

What you're describing is what's known as a "simple" request in XMLHttpRequest terms. That means there is no pre-flight necessary. Your browser will simply make the POST as requested and receive the response. It won't make the response available to you since the Access-Control-Allow-Origin header isn't set, but you're a malicious attacker in this example and you don't care what the response is: you just care that you were able to make the request. ;-)

You could even do this by creating an HTML form that POSTs to the right URL and using JavaScript to submit it automatically when the page loads. Same exact thing: no CORS checks.

If a pre-flight were necessary you would be right. The browser would send an OPTIONS request to the server, the server would respond without the appropriate headers, and the POST request would never be sent.

Let me know if any of this needs further explanation!

Re:#1 CSRF Is A Vulnerability In All Browsers by akaBruce on Saturday March 31, 2012 @01:36AM (#3779488)
Oh, I see now. I had assumed that because I couldn't get the response, that the request itself was blocked.

Thanks!

Re:#1 CSRF Is A Vulnerability In All Browsers by tomjen3 on Saturday March 31, 2012 @03:30AM (#3779696)
I would like to know one thing.

Who the hell thought it was a good idea to allow crossdomain XmlHttpRequests? Given that the standard say that post is for modification no other website should ever make thoes requsts.

Re:#1 CSRF Is A Vulnerability In All Browsers by nbpoole on Saturday March 31, 2012 @09:37AM (#3780268)
The CORS standard for 'simple' POSTs is no different than what you can already submit via a form from a technological perspective. In that way, it actually makes a lot of sense.

And the whole point of CORS is that some websites do want to make those requests. ;-)

Re:#1 CSRF Is A Vulnerability In All Browsers by tptacek on Friday March 30, 2012 @11:13PM (#3779210)
"I did pretty wide audit - only rails' protection looks really elegant."

This is handwaving. You were wrong about this. I assume you want to know that, so I'm saying it bluntly.

"I just want to make browsers think about the issue as millions of developers have to. Because it is their issue, they are in charge."

No, the web browsers are not in charge. The secrets and sensitive actions are occurring on the servers, not in the browsers. The servers are what matter. The browser isn't protecting your email. The server is. The browser isn't protecting your bank account. The server is. The browser isn't controlling who is or isn't your Facebook friend. The server is.