I own an RPG multiplayer game written in Java, where players can fight each other in the game.

Recently I planned to invent a new feature, where the last 15 seconds of your fight and the "knockout" will be saved and a gif will be created of the fight's ending and automatically uploaded and can be linked to your account and viewed on the game's website gallery.

Strategy I planned to use:

  1. Server sends a start-recording packet to the client to start recording the graphics buffer
  2. Client will clear the buffer and only keep the latest 15 seconds (X frames) of the current fight.
  3. When the fight ends, server sends stop-recording packet, this packet will contain a pre-signed URL generated by the server in which the client will use to upload the gif that the client will create in this step. the presigned URL will have the user's ID encoded so that way it is linked, and a record will be created in the database aswell on the presign or on upload callback.

Might use AWS S3 as my storage.

What is the issue?

People can reverse-engineer my client, and can basically start fights and upload any gifs that they would want to, pornographic and unrelated content.

Is there a way, besides image-processing to solve this issue?


Since the whole process takes place on the client side, there is no 100% secure implementation of what you are planning to do. If the client can do it, a malicious user can do it as well.

Good news is, that the incentive for an attacker does not seem to be high for executing such an attack. This means, that it is most likely sufficient to make the attack difficult enough, so that the attacker loses interest before succeeding. With a limited profit motive, this threshold should be achievable with reasonable effort.

I recommend the following measures:

  • Obfuscate the Java client to make reverse engineering more difficult. There are tools available for that, no need to re-invent the wheel.
  • Sign the video files with a "hidden" key (either in the client code or fetched on demand from a server) and verify the signature on the server-side.
  • Perform plausibility checks (was the right codec used, is the video 15 seconds long, etc.)
  • Only allow uploads from registered accounts and ban accounts misusing this feature.
  • Provide an easy way for users to report misuse, so that you can react in time.

Combining all those measures will make exploitation more difficult, and only the really stubborn attackers will succeed. Given the limited profit motive, that's most likely secure enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.