Note that there are some explanatory texts on larger screens.

plurals
  1. POSecurity: How vulnerable is this authentication/encryption scheme?
    primarykey
    data
    text
    <p>I have a client-server game, where the client connects to a server and stays connected during the game (approx 5-60 min).</p> <p>I want new clients to be able to register securely, as well as allowing existing clients to authenticate with no worries that the login credentials are exposed.</p> <p>The thing is that for performance reasons it would be best to stick with a simple and cheap encryption like RC4 for the game session, but a symmetric key does not make it easy to secure the registration procedure.</p> <p>Since I will want to keep a separate login server anyway, my idea is like this:</p> <ol> <li>Client sends a HTTPS request to the login server with credentials (or registration information)</li> <li>The login server collects the user information, and generates a temporary RC4 session encryption key</li> <li>The user information + RC4 session + timestamp + digest (I can rely on both servers to be synchronized timewise) with a secret symmetric key, shared between game server and login server. </li> <li>The packaged data + RC4 session encryption key + ip address to the game server is sent as a reply to the HTTPS request to the client.</li> <li>The client opens a connection to the game server, sends an initial unencrypted hello message with the encrypted user information as a payload.</li> <li>The game server unpacks the data packaged in (3). It now knows the user and the RC4 encryption key it is supposed to use.</li> <li>If the timestamp indicates that the login credentials has expired, an error is returned to the client (who is then to retrieve new information). If the decrypted user data cannot be verified with the digest a different error is returned. </li> <li>If everything checks ok, the server sends an unencrypted LOGIN_OK, and the RC4 encrypted communication starts.</li> </ol> <p>Possible security concerns:</p> <ul> <li><p>The game server 100% trusts the user info it has decrypted. This makes the servers completely decoupled which is nice, but if the key is compromised, users could completely fake their user info. This could be alleviated somewhat by rotating these keys, so that every day or month has a new key. Both game and login servers could get this from a third server that manages their keys. It might be overkill since: a) in case of a break-in where source code is exposed on the servers, they can be restarted with a new key b) a good enough key + encryption should make brute force attacks hard (suggestions on algorithm?)</p></li> <li><p>RC4 isn't the most secure algorithm, but I make sure to throw away the first 512 bytes or so and each key is only valid for a limited time, e.g. 24h.</p></li> <li><p>Doesn't seem susceptible to man-in-the middle from what I can see: SSL secures the RC4 session key, in (5) the RC4 session key sent to the game server is encrypted as well. All that is possible is DoS and to cause the user request a key again. If the data in (2) is cached until it expires, this should not create a new packet.</p></li> <li><p>The encryption in (3) could be improved by adding random bits to the key. Those random bits are sent together with the encrypted packet, and presented to the game server in (5). In (6) the game server adds those random bits to his key and uses the result to decrypt the data. This way and attacker cannot see when the packed data changes.</p></li> </ul> <p>Are there any vulnerabilities I'm overlooking here?</p> <p><strong>A summary of payloads created:</strong></p> <ul> <li>Client login-credentials (protected by SSL), sent to login server</li> <li>User info + timestamp + temporary game server session key + digest encrypted by login server using a secret key shared with game server, given to the client that - without modifying it - passes it to the game server. Ought to be temper resistant because: a) client does not know the secret key b) has timestamp to avoid resending same data c) digest to verify content was encrypted correctly</li> <li>temporary game server session key sent by the login server to the client together with the encrypted payload. Protected by SSL.</li> <li>Client game server login packet, consists of encrypted packet received by login server.</li> </ul> <p><strong>A summary of encryption keys:</strong></p> <ul> <li>Temporary game server session key: randomly generated by login server for encrypted game server &lt;-> client communication. Generated by login server, given to client and game server.</li> <li>Secret user info encryption key. Shared between game server and login server, used pass user info to game server with client as messenger. Client does not possess this key.</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload