News for hackers. Stuff that matters.
Re:Securing a Rails App against Firesheep with HTTPS by jashkenas on Friday February 04, 2011 @02:32PM (#2180782)
If anyone sees any gaping holes in this scheme, or has a more elegant solution to the HTTP-for-anonymous/HTTPS-for-logged-in-users pattern, I'd love to hear the critique.
Re:Securing a Rails App against Firesheep with HTTPS by EricButler on Friday February 04, 2011 @02:58PM (#2180902)
As a commenter mentioned above, the weak point here is the fact that you only enforce HTTPS after the user has logged in. Since your login page is served insecurely, an active attacker could modify it to steal passwords. A well known tool to do this is SSLStrip: http://www.thoughtcrime.org/software/sslstrip/

The Tunisian government recently took advantage of Facebook's insecure login page to steal passwords for _everyone in the country_: http://blog.jgc.org/2011/01/code-injected-to-steal-passwords...

Protocol-relative URLs may be useful while migrating to HTTPS, but should not be needed long-term. All content should only be served securely.

Once a site is fully functional over HTTPS, adding the HSTS header is an important last step to further mitigate active attacks. http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security

Re:Securing a Rails App against Firesheep with HTTPS by jashkenas on Friday February 04, 2011 @05:31PM (#2181583)
Thanks for the example. Looks like we'll give up attempting to serve any HTTP pages in the future, and do as you recommend -- I don't see any way of getting around the login-form-phishing hack you describe.
Re:Securing a Rails App against Firesheep with HTTPS by Jeema3000 on Friday February 04, 2011 @11:51PM (#2182481)
Well here's one way I think would work, but it's not ideal and still not 100% foolproof:

A) Keep a running counter between the server and client. B) If, at any point, there are two active sessions both associated with the same user login, delete both sessions (thus logging out both the legitimate user and the attacker).

Session hijacking is still possible with this method, but only for the duration of one request (as long as you, the legitimate user, remember to log out at the end).

The main disadvantage is that if the request or response gets messed up, the session will be lost. Even if someone does something as simple as click a link twice before the response comes back, the session will be lost. So, yea, kind of a major usability drag...

Although... you could probably eliminate most lost session situations by using the counter method and allowing some leeway in it (say 2 or 3 requests off) to take into account double link click scenarios. That might be a good compromise...

Re:Securing a Rails App against Firesheep with HTTPS by oomkiller on Saturday February 05, 2011 @04:50AM (#2182834)
Why don't you just run the whole site under SSL? That and add the STS header as an easy fix for people messing with the HTTP redirect to SSL. Might be a minuscule amount of extra load for your servers, but it has not degraded my Facebook experience noticeably (I have SSL enabled).