Bruce Schneier | |||||||||||||||
Schneier on SecurityA blog covering security and security technology. « Friday Squid Blogging: Close-Up of a Long-Finned Squid Tentacle | Main | Clickjacking » October 6, 2008New Cross-Site Request Forgery AttacksCSRF vulnerabilities occur when a website allows an authenticated user to perform a sensitive action but does not verify that the user herself is invoking that action. The key to understanding CSRF attacks is to recognize that websites typically don't verify that a request came from an authorized user. Instead they verify only that the request came from the browser of an authorized user. Because browsers run code sent by multiple sites, there is a danger that one site will (unbeknownst to the user) send a request to a second site, and the second site will mistakenly think that the user authorized the request. Paper here. Posted on October 6, 2008 at 5:42 AM • 26 Comments • View Blog Reactions To receive these entries once a month by e-mail, sign up for the Crypto-Gram Newsletter. Interesting how new attack vectors are still found every now and then. Couldn't this be fixed completely client-side, by having the browser tag the tabs that have been opened from a link on the authenticated site, and not send the authenticating information if the tab hasn't been tagged? The tag should probably be erased as soon as the user types anything in the address bar, or follows a link to another domain (in other words, when the user is re-using the browser tab). Posted by: Sparky at October 6, 2008 7:57 AM This may fix the problem, but will undoubtedly break some usage patterns. Posted by: Bahbar at October 6, 2008 8:18 AM Am I missing something? This isn't new. I'd say it's quite old. Consider CSRF in combination with XSS. It's been used alot. And no, it can't be solved very well in the browsers. Use a seperate browser for ie. Facebook and do all your pr0n smurfing on another browser. Using server side tokens is the way to go to mitigate CSRF, and make sure all your XSS vulns are taken care of, or your site will be used to CSRF someone else's. Posted by: TheSchmurph at October 6, 2008 8:21 AM This ain't a new attack vector, but in times of ubiquitious tabbed browsing and persistent logins it has a far greater reach then it did a couple of years ago. Posted by: Kaukomieli at October 6, 2008 8:31 AM @sparky, ironically, many of the solutions you suggest are not possible due to the security built into the browser. OWASP suggests a similar solution (including a unique value in each page that is validated on the next request) but it doesn't solve the problem. It just raises the bar. Posted by: wally at October 6, 2008 9:04 AM well... a new random "request-scope" ID would raise the bar quite a bit, wouldn't it? I don't think one tab in a browser is allowed to read data in a tab from another browser. Barring a browser bug, or a way to predict the next "request-scope" ID, I'd think its a pretty good solution. Posted by: bex at October 6, 2008 9:31 AM New to academia, not new to the field -- which is pretty normal; academia is terrible at coming up with "new" anything for computer/network security. Anyway, the major references are 2004 to 2006.
Posted by: Tod at October 6, 2008 9:36 AM I, too, have been reading about this attack vector for a while. For example, I remember a case from last December... Posted by: Wicked Lad at October 6, 2008 10:03 AM @TheSchmurph So, it is a serious server-side issue that cannot be solved on the client side without breaking many legitimate usages. There was a long discussion on what can be done CSRF in November 2006, when passwords of many MySpace users were stolen. (See Bug 360493 on mozilla.org). Posted by: Dmitry at October 6, 2008 10:07 AM @Dmitry, Well, of course it's naive to think that no-porn is safe! (it is bad for the psyche, and the warrior-spirit! :) It's naive to think that "proper" sites are safe, yes..., having in mind all the ads (now, that's a good point of entry). It's merely an example. If don't want your Facebook sending weed ads to your friends, use it in a another browser (and don't click on stupid links you receive). Won't mitigate evil flash ads, but it sure as phlegm will raise the bar a considerable bit. On that particular site. Point being; I don't mind pr0n sites, or other I'm-not-logged-into-sites for that matter, CSRFing eachother. So, they get their own browser. All in all, the problem is architechtural - and not "fixed" easily, most certainly not on the client-side. It's just exploiting what people tend to forget - the web is stateless. Posted by: TheSchmurphster at October 6, 2008 10:24 AM Couldn't this be solved completely by servers always checking the referer header to make sure anything sensitive originates from one of their own pages? Posted by: Kevin at October 6, 2008 10:57 AM This is also a usability issue which can adversely impact users in the absence of a malicious attacker. A simple example would be a user that has two accounts on a single web site: 1) Log in as User1 Posted by: Neal Lester at October 6, 2008 11:09 AM @Kevin: no, because the referrer header can always be forged. Posted by: GCU Prosthetic Conscience at October 6, 2008 11:20 AM @Kevin No. @Nead Lester, That'd be a very badly written site to not even kill the session at step 3. Besides... How could your example Posted by: TheSchmurph at October 6, 2008 11:21 AM Hi, This attack is far from new. It's been known to the web application security community for a couple of years alongside cross-site scripting and SQL Injection. OWASP has been talking about it for a while now. And recently the new PCI-DSS v1.2 included it in requirement 6. I have noticed that this blog doesn't cover web application security issues, or only rarely. That's surprising because web apps are one of the primary targets and source of data breaches. For such a prominent blog to ignore web app security issues is perhaps an indication that most of the security community hasn't woken up to the dangers posed by insecure web applications. Posted by: webappster at October 6, 2008 12:03 PM @webappster Posted by: posted a comment at October 6, 2008 12:30 PM @webappster: This blog is not a news site. There are plenty of those already out there with varying quality. Posted by: Kaukomieli at October 6, 2008 3:03 PM Great post. These kinds of threats are popping up all the time. Good that the companies involved, like ING Direct and the NYTimes took action quickly, but the point is to be proactive, not reactive. Ah, well. Good blog post on the related topic: If security is not built in, it's not there http://www.pcis.com/web/vvblog.nsf/dx/if-security-isnt-built-in-its-not-there Posted by: jnarvey at October 6, 2008 3:52 PM @Wicked Lad
Completely prohibiting cross-site posting would prevent the XSRF attack, but there are many cases where sites need to communicate across domain names. A more reasonable approach is to have the cross-site policy on web-servers, which specifies what domains are trusted and do not accept post request having an untrusted referrer. Posted by: Dmitry at October 6, 2008 4:56 PM The solution to this problem is to require each critical request to have a session id that isn't stored in the cookies but only in script space and hidden in form. This isn't a browser bug, it's a website design issue. Posted by: BW at October 7, 2008 3:29 AM @ Dmitry, "HTTP is a stateless protocol, but saying that the web is stateless is not exactly correct due to cookies." And "that is the rub" as they say. Back in 1995 I gave a short talk at Kingston University about bolting state onto statless protocols specifficaly HTTP and not checking the 'where from' / 'who by' / 'why' of each state change. The response was at best a yawn. It is only well after a decade are some (but not most) people waking up to the issues. The simple fact is that you realy have to understand the implications of overlaying a state based protocol onto a statless protocol, especially when it is done in an ad hoc way like "cookies" or any other of the mishmash attempts by self taught "code cutters" in the name of expediency. If you think about things in a general way you will realise that all of the security problems with state based protocols on statless protocols apply virtually across the board. That is a generlisation of an attack against say TCP on IP will probably work against some other protocol on say HTTP. I fully expect to see a lot more of these attacks as time goes on. Eventually people will wake up and realise it's time to replace the "ad hoc" mishmash of "I invented it and it works for me" protocols with those designed specifficaly to deal with security issues, and they might even decide that HTTP is nolonger fit for purpose. Posted by: Clive Robinson at October 7, 2008 4:11 AM Completely old news, as is the incredibly easy fix that most competent developers implemented straight away, a long time ago. Posted by: Shane at October 7, 2008 1:44 PM A bank has implemented a feature, in its website, that prevents users from double-clicks, back and refresh. Primarily aimed at preventing multiple-submits (in cases like fund transfers etc). Though this feature was not meant to counter CSRF, its design is so robust that CSRF attacks are ineffective against its site. Reason being it addresses the fundamental flaw. CSRF is successful because most of the URL's are predictable or static and remains the same across "logged in" sessions. Posted by: Maneesh at October 9, 2008 7:30 PM A bank has implemented a feature, in its website, that prevents users from double-clicks, back and refresh. Primarily aimed at preventing multiple-submits (in cases like fund transfers etc). Though this feature was not meant to counter CSRF, its design is so robust that CSRF attacks are ineffective against its site. Reason being it addresses the fundamental flaw. CSRF is successful because most of the URL's are predictable or static and remains the same across "logged in" sessions. If one addressed this fundamental flaw then it provides protection against CSRF and also the recently discovered clickjacking (aimed at cross domain attacks) Posted by: Maneesh at October 9, 2008 7:32 PM Post a comment
Powered by Movable Type. Photo at top by Steve Woit.
Schneier.com is a personal website. Opinions expressed are not necessarily those of BT. |
|
Comments