Suppose you created an online game in HTML5/JavaScript. All the code would be downloaded into the user's browser, and they would run the game.
How do you stop someone from copying the game onto their computer, and injecting functions and modules to cheat? For example, they could write a function that auto-aims at the nearest enemy sprite for example.
Is there any fundamental way to protect people from doing this sort of thing by designing your game code in a certain way?
This kind of attack can be used to exploit possible security flaws on the client-side. The attacker can change the data, hijack the session and make arbitrary JavaScript changes on the page, therefore compromising the security of the original code.
Security Through Obscurity The bottom line here is that there's no such thing as 'unhackable' code. No matter how hard a programmer tries, there's always going to be a vulnerability somewhere.
Perhaps the most obvious motivation for players to cheat is to attain ranks and status conferred by winning the game. These players will use aimbots, wallhacks, and other tools because they just want the glory of being a winner.
Hacking for Computer Science Professionals As a result, "white-hat hacking" has become very prevalent. These are trained computer science professionals who want to aid businesses with improving their security by conducting planned hacks to find points of weakness in their system.
What is stopping someone from copying the game onto their computer, and injecting functions and modules to cheat?
Nothing.
Is there any fundamental way to protect people from doing this sort of thing by designing your game code in a certain way?
Nope.
This is why most JavaScript games rely heavily on a server state, to prevent cheats.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With