Jump to content

Recommended Posts

Hey guys!

 

I'm creating a simple php game and I'm not sure how much security to add.

 

For instance If I have a system that submits the users score to my mysql database do I need to do something with this value so it can not be tampered with? I don't want someone to be able to change the value and cheat.

 

I was looking into using a secret key or token but I'm kind of confused as to how to implement them.

 

Thanks for the help

Link to comment
https://forums.phpfreaks.com/topic/266889-how-to-securely-send-game-data/
Share on other sites

Depends on the data, depends where it's going. Sometimes you just escape it, sometimes you have to actually encrypt or encode it. There is no blanket answer.

 

The problem you face is that the app has to communicate with your server, and (theoretically) someone could watch the data being sent and then fake their own version. Here you would probably encrypt it; SSL should be adequate for that. So make sure your server is set up for an SSL site and... that's about it.

 

Disclaimer: I don't develop apps, I've never had to tackle this problem before. So find yourself an experienced app developer (maybe here on phpfreaks) and ask what they would do.

The problem you face is that the app has to communicate with your server, and (theoretically) someone could watch the data being sent and then fake their own version. Here you would probably encrypt it; SSL should be adequate for that. So make sure your server is set up for an SSL site and... that's about it.

 

This seems like the best, and easiest way to go.

 

If you don't want to (or for some reason can't) use SSL, you will have to encrypt the data manually. Both ends of the connection will have to know how to encrypt/decrypt the data.

The problem you face is that the app has to communicate with your server, and (theoretically) someone could watch the data being sent and then fake their own version. Here you would probably encrypt it; SSL should be adequate for that. So make sure your server is set up for an SSL site and... that's about it.

 

This seems like the best, and easiest way to go.

 

If you don't want to (or for some reason can't) use SSL, you will have to encrypt the data manually. Both ends of the connection will have to know how to encrypt/decrypt the data.

 

It shouldn't be possible to send the same "encrypted" data twice, so it should encrypt the data sent depending on something numbers or messages you send it first. Only case it can use the same data again then is if you send the same data to it first. This alone makes it much harder to cheat. Make sure people can't spam your server to get the same data sent twice, and that it's no easy way to tell what you've done with the data, so anyone sniffing sits there confused, giving up instead of putting a lot of effort into hacking just a mere game. It depends on your game though, how big it is.

If you have encryption libraries available in the app you're programming, you'd probably be best to do that. The attacker would have to decompile the application to get at the public key. It's possible to make decompiling very difficult, from what I've read and understand.

 

If the application has to run on the client, there will always be potential to break it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.