Secure Online Highscore Lists for Non-Web Games
Asked Answered
H

10

25

I'm playing around with a native (non-web) single-player game I'm writing, and it occured to me that having a daily/weekly/all-time online highscore list (think Xbox Live Leaderboard) would make the game much more interesting, adding some (small) amount of community and competition. However, I'm afraid people would see such a feature as an invitation to hacking, which would discourage regular players due to impossibly high scores.

I thought about the obvious ways of preventing such attempts (public/private key encryption, for example), but I've figured out reasonably simple ways hackers could circumvent all of my ideas (extracting the public key from the binary and thus sending fake encrypted scores, for example).

Have you ever implemented an online highscore list or leaderboard? Did you find a reasonably hacker-proof way of implementing this? If so, how did you do it? What are your experiences with hacking attempts?

Houser answered 25/8, 2008 at 13:10 Comment(0)
U
42

At the end of the day, you are relying on trusting the client. If the client sends replays to the server, it is easy enough to replicable or modify a successful playthrough and send that to the server.

Your best bet is to raise the bar for cheating above what a player would deem worth surmounting. To do this, there are a number of proven (but oft-unmentioned) techniques you can use:

  1. Leave blacklisted cheaters in a honeypot. They can see their own scores, but no one else can. Unless they verify by logging in with a different account, they think they have successfully hacked your game.
  2. When someone is flagged as a cheater, defer any account repercussions from transpiring until a given point in the future. Make this point random, within one to three days. Typically, a cheater will try multiple methods and will eventually succeed. By deferring account status feedback until a later date, they fail to understand what got them caught.
  3. Capture all game user commands and send them to the server. Verify them against other scores within a given delta. For instance, if the player used the shoot action 200 times, but obtained a score of 200,000, but the neighboring players in the game shot 5,000 times to obtain a score of 210,000, it may trigger a threshold that flags the person for further or human investigation.
  4. Add value and persistence to your user accounts. If your user accounts have unlockables for your game, or if your game requires purchase, the weight of a ban is greater as the user cannot regain his previous account status by simply creating a new account through a web-based proxy.
Understood answered 28/9, 2008 at 8:4 Comment(0)
H
23

No solution is ever going to be perfect while the game is running on a system under the user's control, but there are a few steps you could take to make hacking the system more trouble. In the end, the goal can only be to make hacking the system more trouble than it's worth.

  • Send some additional information with the high score requests to validate one the server side. If you get 5 points for every X, and the game only contains 10 Xs, then you've got some extra hoops to make the hacker to jump through to get their score accepted as valid.
  • Have the server send a random challenge which must be met with a few bytes of the game's binary from that offset. That means the hacker must keep a pristine copy of the binary around (just a bit more trouble).
  • If you have license keys, require high scores to include them, so you can ban people caught hacking the system. This also lets you track invalid attempts as defined above, to ban people testing out the protocol before the ever even submit a valid score.

All in all though, getting the game popular enough for people to care to hack it is probably a far bigger challenge.

Hendrix answered 25/8, 2008 at 13:28 Comment(1)
great line: "All in all though, getting the game popular enough for people to care to hack it is probably a far bigger challenge."Ivanaivanah
J
6

I honestly don't think it's possible.

I've done it before using pretty simple key encryption with a compressed binary which worked well enough for the security I required but I honestly think if somebody considers cracking your online high score table a hack it will be done.

There are some pretty sad people out there who also happen to be pretty bright unless you can get them all laid it's a lost cause.

Junction answered 25/8, 2008 at 13:17 Comment(0)
N
5

I've been doing some of this with my Flash games, and it's a losing battle really. Especially for ActionScript that can be decompiled into somewhat readable code without too much effort.

The way I've been doing it is a rather conventional approach of sending the score and player name in plain text and then a hash of the two (properly salted). Very few people are determined enough to take the effort to figure that out, and the few who are would do it anyway, negating all the time you put into it.

To summarize, my philosophy is to spend the time on making the game better and just make it hard enough to cheat.

One thing that might be pretty effective is to have the game submit the score to the server several times as you are playing, sending a bit of gameplay information each time, allowing you to validate if the score is "realistic". But that might be a bit over-the-top really.

Neumann answered 25/8, 2008 at 13:22 Comment(0)
T
5

If your game has a replay system built in, you can submit replays to the server and have the server calculate the score from the replay.

This method isn't perfect, you can still cheat by slowing down the game (if it is action-based), or by writing a bot.

Talya answered 29/8, 2008 at 0:0 Comment(0)
P
3

That's a really hard question.

I've never implemented such thing but here's a simple aproximmation.

Your main concern is due to hackers guessing what is it your application is doing and then sending their own results.

Well, first of all, unless your application has a great success I wouldn't be worried. Doing such thing is extremely difficult.

Encryption won't help with the problem. You see, encryption helps to protect the data on its way but it doesn't protect either of the sides of the transaction before the data is encrypted (which is where the main vulnerability may be). So if you encrypt the sure, the data will remain private but it won't be safe.

If you are really worried about it I will suggest obfuscating the code and designing the score system in a way which is not completely obvious what is doing. Here we can borrow some things from an encryption protocol. Here is an example:

  1. Let's say the score is some number m
  2. Compute some kind of check over the score (for example the CRC or any other system you see feet. In fact, if you just invent one, no matter how lame is it it will work better)
  3. Obtain the private key of the user (D) from your remote server (over a secure connection obviously). You're the only one which know this key.
  4. Compute X=m^D mod n (n being the public module of your public/private key algorithm) (that is, encrypt it :P)

As you see that's just obfuscation of another kind. You can go down that way as long as you want. For example you can lookup the nearest two prime numbers to X and use them to encrypt the CRC and send it also to the server so you'll have the CRC and the score separately and with different encryption schemes.

If you use that in conjunction with obfuscation I'd say that would be difficult to hack. Nontheless even that could be reverse engingeered, it all depends on the interest and ability of the hacker but ... seriously, what kind of freak takes so much effort to change its results on a game? (Unless is WoW or something)

One last note

Obfuscator for .NET

Obfuscator for Delphi/C++

Obfuscator for assembler (x86)

Peasant answered 25/8, 2008 at 13:45 Comment(0)
F
2

As the other answer says, you are forced to trust a potentially malicious client, and a simple deterant plus a little human monitoring is going to be enough for a small game.

If you want to get fancy, you then have to look for fraud patterns in the score data, simmular to a credit card company looking at charge data. The more state the client communicates onto your server, the potentially easier it is to find a pattern of correct or incorrect behavior via code. For example. say that the client had to upload a time based audit log of the score (which maybe you can also use to let another clients watch the top games), the server can then validate if the score log breaks any of the game rules.

In the end, this is still about making it expensive enough to discourage cheating the scoreboard. You would want a system where you can always improve the (easier to update)server code to deal with any new attacks on your validation system.

Freddie answered 25/8, 2008 at 13:36 Comment(0)
B
2

@Martin.

This is how I believe Mario Kart Wii works. The added bonus is that you can let all the other players watch how the high score holder got the high score. The funny thing about this is that if you check out the fastest "Grumble Volcano" time trail, you'll see that somebody found a shortcut that let you skip 95% of the track. I'm not sure if they still have that up as the fastest time.

Bias answered 29/8, 2008 at 0:36 Comment(1)
Yes, that's an exploit in the game design vs. hacking. Players in one of my mobile games found an exploit that actually made the gameplay more fun by far, i left it in, a few complained about highscores not being real, but the top 20 are the ones smart enough to figure out the exploit and compete with eachother.Edrick
B
2

You can't do it on a nontrusted client platform. In practice it is possible to defeat even some "trusted" platforms.

There are various attacks which are impossible to detect in the general case - mainly modifying variables in memory. If you can't trust your own program's variables, you can't really achieve very much.

The other techniques outlined above may help, but don't solve the basic problem of running on a nontrusted platform.


Out of interest, are you sure that people will try to hack a high score table? I have had a game online for over two years now with a trivially-crackabe high score table. Many people have played it but I have no evidence that anyone's tried to crack the high scores.

Beware answered 28/9, 2008 at 8:15 Comment(0)
R
1

Usually, the biggest defender against cheating and hacking is a community watch. If a score seems rather suspicious, a user can report the score for cheating. And if enough people report that score, the replay can be checked by the admins for validity. It is fairly easy to see the difference between a bot an an actual player, if there's already a bunch of players playing the game in full legitimacy.

The admins must oversee only those scores that get questioned, because there is a small chance that a bunch of users might bandwagon to remove a perfectly hard-earned score. And the admins only have to view the few scores that do get reported, so it's not too much of their time, even less for a small game.

Even just knowing that if you work hard to make a bot, just to be shot down again by the report system, is a deterrent in itself.

Perhaps even encrypting the replay data wouldn't hurt, either. Replay data is often small, and encrypting it wouldn't take too much more space. And to help improve that, the server itself would try out the replay by the control log, and make sure it matches up with the score achieved.

If there's something the anti-cheat system can't find, users will find it.

Riviera answered 23/12, 2012 at 2:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.