Background
As a Roblox developer, it is currently too hard and time consuming to protect data that is in transit between client and server. As it stands, there is no standard way to protect against an exploiter using a remote spy to gather information to cheat/exploit in a game. Although solutions exist in LUA/LUAU, because of the number of computations required (especially RSA), they are very slow.
If this is addressed by Roblox, it would improve my development experience because it would save time by allowing us to use a premade API instead of finding/coding these functions ourselves. Not only would this eliminate mistakes in implementation by inexperienced developers, performance would be greatly improved because the encryption runs in machine code instead of a LUA virtual machine. Furthermore, it would improve client security because the crypto will disable one aspect that exploiters/cheaters use to break security on games: Remote Spy. By encrypting the data and then sending it, all the exploiter will be able to see is what appears to be random data being passed back and forth. Since strong crypto is being used, it will be impossible for an exploiter to decrypt the data directly.
As part of a cryptography API, routines such as the following would be nice:
- RSA or ECC Public Key Crypto: Generate Key Pair, Encrypt, Decrypt
- AES-128 Encrypt/Decrypt
Use Case
A client connects to the server and requests the server’s public key. The client then generates a symmetric key, encrypts it with the server’s public key, and sends it to the server. When the server gets the encrypted information, it decrypts it using it’s private key. This completes the cryptography handshake between client and server. From now on, any information that requires encryption is encrypted using that symmetric key.
Bob develops a private way of detecting cheaters, but it requires the cooperation of the client. In order to prevent exploiters from bypassing his method, Bob chooses to use a LUA virtual machine (such as vLua) to execute the code. The code is compiled on the server when the game starts and the resulting bytecode is sent to the client when the client connects. In order to prevent an exploiter from getting access to the bytecode and decompiling it to discover the method, Bob encrypts the data before calling FireClient. When the client gets the associated OnClientEvent event, the bytecode is decrypted and loaded into the vLua VM for execution, confident that his method is protected. Data that is generated by the protected code is serialized and encrypted before being sent to the server. On the server, the data is decrypted and is analyzed. If the analysis shows the player is cheating, they are removed from the game and a permanent ban is placed.
Due to the encryption, the program/data is impossible to directly decrypt without the session key. This removes the remote spy tool from the exploiter’s toolbox which allows an exploiter to see what data is passed between client and server.