0
\$\begingroup\$

I'm interested in p2p software distribution, and I'm also directly including a modding interface into my game, which is built on my own custom engine.

I was working with a folder inside of the Roaming folder to store the data (resource, saves... etc), and I quickly figured out a malicious programmer could easily modify my program and make or erase (at least) folders.

How would one prevent this kind of modification, without owning the whole distribution process?

Do you really have to trust the provider/source to trust the software? Or could you trust software on the client side using some hash or such?

The only solution I can think of would be having a website on which I put a hash of my game, and any user that gets an instance of my game can verify it was not modified by hashing it and comparing it with the one on my website. But it is definetely not user-friendly at all...

\$\endgroup\$
1
  • 3
    \$\begingroup\$ The short answer for single player games is "you don't" and for multiplayer games, it's "use an authoritative server". At the end of the day, the client side can more or less do whatever it wants. \$\endgroup\$ – Pikalek Jan 23 at 17:19
0
\$\begingroup\$

The only solution I can think of would be having a website on which I put a hash of my game, and any user that gets an instance of my game can verify it was not modified by hashing it and comparing it with the one on my website. But it is definetely not user-friendly at all...

It sounds then like you have your answer: publish the expected hash of your game, and ask users to compare their hash to the published version.

Anything you do client-side to make this more user-friendly is subject to the same risk of tampering: the malicious distributor simply replaces the files responsible for your user-friendly verification flow with a modified version that reports "Everything's OK!" despite their tampering.

You can make your server-side version a little nicer, with simple instructions, and a field to paste a hash to compare and get clearly-explained results automatically, rather than making the user check character-by-character. But that's about it.

In publishing games over a network, we must always be conscious "the client is in the hands of the enemy" - so the server is the only side of the equation we can trust.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you I will follow this scheme then! \$\endgroup\$ – Axel Carré Jan 24 at 7:26
0
\$\begingroup\$

The truth is, you can't always prevent this kind of modification. No matter what you do, the player can always find a way to get past your security. But, if it's a singleplayer game, you can make it more difficult for the hacker by implementing a Binary Formatter or another formatter of some sort, which will make the process much more difficult. If it's a multiplayer game, you can prevent exploiting to some extent by trying to run as much of the game logic as you can on the server side. You can't really trust the data clients give to the server, since they can mess with that data, then pass it to the server.

\$\endgroup\$
2
  • \$\begingroup\$ If you're thinking of the built-in .NET BinaryFormatter type, you should be aware that it comes with security risks of its own, and is not recommended for use anywhere you could have untrusted data. \$\endgroup\$ – DMGregory Jan 23 at 18:26
  • \$\begingroup\$ @DMGregory I know, I said it was an option because he didn’t specify the language he was coding in. \$\endgroup\$ – OKprogrammer Jan 23 at 18:41

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.