Login Process

Started by
8 comments, last by BHXSpecter 10 years, 1 month ago
I am developing a text based game at the moment which I started two years ago, I am just getting back in to it now.
My plan is to have a system where people can try and compete for a high score via an online system, of course to do this the scoring system needs to be secure and not able to be tampered with. I have coded up this part of the game to the point where I am happy with the security of it. Now I am thinking of adding a login type system where the first time the game is run the user creates a username / pass code which is then used in the future to login.
My thoughts on doing this are:
- Username + pass code
- Certificate file + pass code (the certificate file could be portable for use on other computers)
- Just a pass code
- Secret question + pass code
If you have done something like this yourself in the past what level of security did you decide to implement?
Paul
Advertisement

I dabbled with databases used in games. I did username and password and then if the score was higher than the database entry it updated to the new high score, if it was lower it kept the high score and went back to the game.

I've used various, including much more complex versions than those.


Answer these questions, among others:

1> What are you trying to protect?
2> Who are you trying to protect it from?
3> Assuming they are successful, what damage is done? (Or said differently, what do they gain or you lose?)
4> Assuming they are successful, how will you recover?

It seems like you have a single data table you want to protect from people who have the ability to monitor the network connection and see exactly the data that would go across the wire. (They can do this even when the connection is secured through SSL or similar because they control the machine.) If they are successful, it seems they get some bragging rights of being at the top of the score list, or removing others from the score list. And finally, you can probably recover by backing up often, keeping a full log, and removing suspicious entries.

All that correct so far?

If so, do any of those options actually prevent the problem from happening? It seems like all of those options still allow a bad actor could just monitor the network, replay the command sequence with a different value, and give themselves a new score. So I don't think any of those options actually eliminate the problem of people stuffing their score.


If the game is entirely on the client side, and the server has no way to validate the score, then ultimately the user can always stuff their scores with higher numbers. If you validate the score by limiting it to certain rates, then they can stuff their score up to the maximum of those rates. As long as the server only serves as a reporting mechanism for untrusted clients, you need to realize that the client can tell you anything they want.

Adding encryption only makes it so an eavesdropper has more trouble listening or replaying their session or tampering with the other people's connection, it doesn't prevent them from cheating on their own connection.

Upon successful login, the user is given a randomly generated session id that expires after "x amount of time" .

The packet header contains the session id number ( without any user info ), and information can be exchanged based on that number.

If number turns out to be invalid - reject the packet.

If the number is expired - reject the packet.

I cannot remember the books I've read any more than the meals I have eaten; even so, they have made me.

~ Ralph Waldo Emerson

I dabbled with databases used in games. I did username and password and then if the score was higher than the database entry it updated to the new high score, if it was lower it kept the high score and went back to the game.

This is what I have at the moment except without the password part. I want to make it so that the user has to login to the game with a pass code of some sort so that others can't stuff it up for them.

All of those are great, but what prevents a malicious user of sending an incredibly high (but still plausible) false score?

The first for don't help:
- Username + pass code
- Certificate file + pass code (the certificate file could be portable for use on other computers)
- Just a pass code
- Secret question + pass code

A session ID doesn't do anything different, the bad actor can still send up a fake high score.

There is no good way to prevent someone from sending a fake high score as long as the game resides on the client side.

So instead you will need to look for ways to address cheaters. Maybe put them up in a "hall of cheaters" if the score is more than a small percentage above the high score, or if they submit too many scores too quickly, or do other things that appear cheaty. They get their reward and go away satisfied, and your scoreboard remains clean. Otherwise you need to manually go through the scoreboard and take out the trash.

This is what I have at the moment except without the password part. I want to make it so that the user has to login to the game with a pass code of some sort so that others can't stuff it up for them.

Yeah, this isn't the best way (I'm sure), but I took a screenshot of a quick mock-up of what I used to have for my database.

sqlDB.png

In case it won't load: https://www.dropbox.com/s/wfko88w1atc8fcz/sqlDB.png

The method I used was to make a secondary account that could update the scores, make the program login through that user and then compare the fields for the player information (ie. if the program's player info matched a SQL username, if the password matched the SQL saved password, and finally if the security answer matched, check to see if score was higher or lower than the SQL score if higher then update, if lower then do nothing).

It's not related to your question but I see that on your blog, you say that you are using BASIC (not vb). Is there any reason for this?
I hope it doesn't sound rude or something.

UNREAL ENGINE 4:
Total LOC: ~3M Lines
Total Languages: ~32

--
GREAT QUOTES:
I can do ALL things through Christ - Jesus Christ
--
Logic will get you from A-Z, imagination gets you everywhere - Albert Einstein
--
The problems of the world cannot be solved by skeptics or cynics whose horizons are limited by the obvious realities. - John F. Kennedy

The best way I would recommend for the cheating part of submitting high scores is to create a hash checksum of the payload on the client-side. Pass along the checksum with the payload in the high score submission. On the server-side, recreate the hash checksum from the payload and make sure it matches the given checksum. This at least causes a potential cheater to have to determine how the payload is formatted and hashed into the checksum.

For another level of diversion, you could add a shared key that is included in the checksum but not passed in the payload. On the server-side, you just use the same shared key to This will make a potential cheater now have to figure out the shared-key to create the checksum with data not passed across the network.

This doesn't stop all cheating, but puts plenty of burden on the potential cheater. Also, be careful with changing the format of the checksum or the shared-key. It will cause older clients to break high score submission.

The user/password system adds the burden on the user. Unless there are more uses for creating an account for the game, I think creating a login system is a little much for high score submission.


The user/password system adds the burden on the user. Unless there are more uses for creating an account for the game, I think creating a login system is a little much for high score submission.

That is usually the whole point of making an account though. Pretty much the whole point behind FB, Kindle, iPhone, and Android games. In fact some only have a high score, but require you to login with your account while others offer in-game purchases that require your account.

This topic is closed to new replies.

Advertisement