Дима Рубинштейн (dimrub) wrote in gotchas,
Дима Рубинштейн

Using SSL session IDs for authentication

A coworker reminded me of a problem I solved a while ago, so I decided to mention it here just to save myself solving it all over again a few years from now.

SSL session ID is a mechanism in SSL/TLS that allows to optimize away the SSL handshake (which is the heaviest part of SSL performance-wise) in repeated connections. It works as follows: when a certain client connects first to an SSL server, the server issues as part of the handshake a random 32-bit number which is the session ID. When the client is trying to reconnect to the same server, it sends that session ID as part of the Client Hello packet. If the server recognizes that session ID, it skips the handshake and uses the key agreed upon during the previous handshake. The servers keep the session ID, depending on configuration, for a number of hours or even days.

There are sites out there, that use this optimization feature as a way to authenticate their clients. It works as follows: when the client first arrives (without the session ID), it is forwarded to an authentication application, then back to the main site. At this point, if the client reconnects without presenting the session ID given to it during the authentication, it is forwarded again to the authentication application, and so on. This is broken in many ways, but there are apps out there that work this way. Proxy and client developers should be aware of that.
Tags: networking, ssl
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your IP address will be recorded