0
\$\begingroup\$

For example using a class like below to Hold the player positions and only show the players to each other when their Distance is less than something, So the calculations are also used by the client's PC.

public struct SafeFloat {
private float offset;
private float value;

public SafeFloat (float value = 0) {
    offset = Random.Range(-1000, +1000);
    this.value = value + offset;
}

public float GetValue ()
{
    return value - offset;
}

public void Dispose ()
{
    offset = 0;
    value = 0;
}

public override string ToString()
{
    return GetValue().ToString();
}

public static SafeFloat operator +(SafeFloat f1, SafeFloat f2) {
    return new SafeFloat(f1.GetValue() + f2.GetValue());
}
// ...the same for the other operators
}
\$\endgroup\$
  • \$\begingroup\$ We cannot answer questions about why other developers choose to use one method versus another to combat cheating in their games. We can answer questions about problems with a specific method, however, but it's not very clear how you expect this "SafeFloat" to be used to combat anything? \$\endgroup\$ – Josh Sep 22 '17 at 15:37
  • \$\begingroup\$ I believe most wall hacks work by reading the memory and finding the position of each player. But if we hash these positions how is it possible for the cheater to know the positions? \$\endgroup\$ – TheGreatA Sep 22 '17 at 15:39
  • 2
    \$\begingroup\$ So the basis of your prevention theory is "hash the positions?" Not "only show players to eachother when nearby?" \$\endgroup\$ – Josh Sep 22 '17 at 15:40
  • 1
    \$\begingroup\$ Ah security by obscurity, the snake oil for the modern day security expert. \$\endgroup\$ – ratchet freak Sep 22 '17 at 15:41
  • \$\begingroup\$ Yes it is, but I also believe that the Actual positions should be revealed to the client so that it can render them. \$\endgroup\$ – TheGreatA Sep 22 '17 at 15:41
3
\$\begingroup\$

This will not be effective.

Obfuscating the position of players does not help, because at some point the client must un-obfuscate them (or be given the un-obfuscated positions) in order to perform game logic or rendering or whatever. At that moment, a hacker can intercept the positions and do whatever they want. It's just as easy for a hacker to read the player positions post-obfuscation as they do pre-obfuscation, so this technique doesn't even introduce a speed bump.

Hashing, in particular, is a poor choice of obfuscation for this because it's not reversible in general. Your specific hashing method of adding a random number to the position is going to be particularly useless, since the only way to reverse the hash correctly is to cart around the random offset that was added with the "secret" number, which is basically like giving everybody who cares the keys to the castle.

\$\endgroup\$
  • 1
    \$\begingroup\$ It is also going to increase memory pressure in an era where hitting cold cache is one of the worst causes of performance degradation. \$\endgroup\$ – ratchet freak Sep 22 '17 at 15:45
  • \$\begingroup\$ But the hacker can only see the positions when the Game wants him to, Basically the hacker isn't doing anything. The the Random number is not accessible by the hacker because the Hacker doesn't know in which part of the RAM the number is so he can't read it. \$\endgroup\$ – TheGreatA Sep 22 '17 at 15:47
  • 2
    \$\begingroup\$ @TheGreatA No. The hacker can see anything on the client. A hacker will be just as capable of reading the "random number" as they are the position. The techniques for locating the data in RAM all work equally well. The only way to effectively hide this value is to keep it entirely on the server and only send it to the client when the server knows the client can physically see the other character. \$\endgroup\$ – Josh Sep 22 '17 at 15:48
  • 2
    \$\begingroup\$ @TheGreatA Fundamentally, nothing on the client can be trusted, it is all more-or-less trivially readable by a determined user. \$\endgroup\$ – Josh Sep 22 '17 at 15:50
0
\$\begingroup\$

To see how (perhaps even how easily) your implementation(s) can be defeated, compile a simple implementation in a skeleton game, then offer it as a reversing challenge for multiplayer game hackers in communities like MPGH, UnknownCheats, ElitePVPers, OwnedCore, etc.

If I understand your code correctly, then what you've demonstrated here is a way to obfuscate values that will really only defeat basic game hackers who know how to do exact value scans in a program like Cheat Engine.

Either way, here are a handful of considerations for you off the top of my head (as a game hacker):

  • If coordinate data stays in the same memory address on the client, it doesn't matter how much you obfuscate it. All a hacker has to do is scan for changed/unchanged values and they'll find their way to the right value. You could create duplicate dummy data to mix it up a bit, but that's easy to weed through.

  • If the local player structure is the same as the structure coming in from other player data (health, coordinates, etc. all at the same offset) via the server, then a hacker can glean quite a bit of information by hacking what they can for their local player.

  • How good is your network protocol? If that isn't shored up, then a hacker can study inbound/outbound packets and make correlations to discover which bytes are related to coordinates. From there, it's just a matter of finding the sub-routine(s) that handle that data. If it's obfuscated data, then it's simply a matter of tracing code execution to find sub-routines related to de-obfuscation.

  • Advanced reversers don't need to rely on dynamic analysis to find their way to what they need initially. Between custom tools, scripts, etc., they can find their way to code segments of interest--all without having to worry about dealing with your obfuscated value whatsoever.

Suffice it to say, there are multiple ways for game hackers to achieve success--many times the ways of which have absolutely nothing to do with your expectations as a forward-engineer of how your implementation(s) will be targeted.

\$\endgroup\$

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.