Securing a Rails App against Firesheep with HTTPS
blog.documentcloud.org
blog.documentcloud.org
in your nginx config you do this for https setup: # needed for HTTPS proxy_set_header X-FORWARDED-PROTO https;
then if you want, you can check in rails that certain controllers received https requests.
using nginx as proxy means your rails app only ever deals with plain text http.
the only issue, with all http -> https transitions is making sure that things you are storing in sessions are placed in your forms if you go from a http page to an https page on form submission. If not you will lose state if you are storing sessions in the cookies.
The part about relative urls is right. Using cdns etc makes things harder if they don't support your ssl cert.
At CarWoo! once you login we do everything behind https. For our user creation form you can be on an http page, but it submits to https.
We created partials that represent our sign up forms (we have many kinds of landing pages) that automatically take important things out of the session and put them in the form if needed. These things are not security risks, but are important for the correct functionality of the app.
A javascript keylogger was inserted into pages served over plain HTTP. Here's the source: http://www.hackerzvoice.net/node/105
With a little more tact and obfuscation, I bet an attacker could get away would doing that on a large scale for quite some time.
See http://dev.chromium.org/sts to fix this.
Fixing the problem for some is certainly better than not fixing it and waiting for the perfect solution that might never appear.
Especially if the fix is this easy to implement.
My setup 1) Linode $20/mo REE box (will bump up in production) 2) Nginx 3) RoR 3.0.3 4) SSL Through Geotrust. It is a "chained" cert but i don't believe this is the bottleneck.
thanks in advance...
http://journal.paul.querna.org/articles/2010/07/10/overclock...
Basically, unless you are certain you need it 4096 bit security, use a 2048 bit key (1024 is not secure anymore) and only include the minimum number of intermediate certs you can get away with. OSCP stapling doesn't seem worth it if it cause you to over flow the initial TCP window.
OCSP stapling is the best answer, although one can only staple a single response and many chains these days require two responses.
So a better answer is to get a CA which issues certificates with 24-48 hour validity and doesn't use an out of band revocation system. If you can find such a thing, please tell me where.
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
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...