Protection against automation

2019-02-07 01:27发布

One of our next projects is supposed to be a MS Windows based game (written in C#, with a winform GUI and an integrated DirectX display-control) for a customer who wants to give away prizes to the best players. This project is meant to run for a couple of years, with championships, ladders, tournaments, player vs. player-action and so on.

One of the main concerns here is cheating, as a player would benefit dramatically if he was able to - for instance - let a custom made bot play the game for him (more in terms of strategy-decisions than in terms of playing many hours).

So my question is: what technical possibilites do we have to detect bot activity? We can of course track the number of hours played, analyze strategies to detect anomalies and so on, but as far as this question is concerned, I would be more interested in knowing details like

  • how to detect if another application makes periodical screenshots?
  • how to detect if another application scans our process memory?
  • what are good ways to determine whether user input (mouse movement, keyboard input) is human-generated and not automated?
  • is it possible to detect if another application requests informations about controls in our application (position of controls etc)?
  • what other ways exist in which a cheater could gather informations about the current game state, feed those to a bot and send the determined actions back to the client?

Your feedback is highly appreciated!

7条回答
我欲成王,谁敢阻挡
2楼-- · 2019-02-07 01:48

I wrote d2botnet, a .net diablo 2 automation engine a while back, and something you can add to your list of things to watch out for are malformed /invalid/forged packets. I assume this game will communicate over TCP. Packet sniffing and forging are usually the first way games (online anyways) are automated. I know blizzard would detect malformed packets, somehting i tried to stay away from doing in d2botnet.

So make sure you detect invalid packets. Encrypt them. Hash them. do somethign to make sure they are valid. If you think about it, if someone can know exactly what every packet means that is sent back and forth they dont even need to run the client software, which then makes any process based detection a moot point. So you can also add in some sort of packet based challenge response that your cleint must know how to respond to.

查看更多
姐就是有狂的资本
3楼-- · 2019-02-07 01:51

Just an idea what if the 'cheater' runs your software in a virtual machine (like vmware) and makes screenshots of that window? I doubt you can defend against that.

You obviously can't defend against the 'analog gap', e.g. the cheater's system makes external screenshots with a high quality camera - I guess it's only a theoretical issue.

Maybe you should investigate chess sites. There is a lot of money in chess, they don't like bots either - maybe they have come up with a solution already.

查看更多
贪生不怕死
4楼-- · 2019-02-07 01:53

I have no deeper understanding on how PunkBuster and such softwar works, but this is the way I'd go:

Iintercept calls to the API functions that handle the memory stuff like ReadProcessMemory, WriteProcessMemory and so on.

You'd detect if your process is involved in the call, log it, and trampoline the call back to the original function.

This should work for the screenshot taking too, but you might want to intercept the BitBlt function.

Here's a basic tutorial concerning the function interception: Intercepting System API Calls

查看更多
狗以群分
5楼-- · 2019-02-07 01:53

I don't know the technical details, but Intenet Chess Club's BlitzIn program seems to have integrated program switching detection. That's of course for detecting people running a chess engine on the side and not directly applicable to your case, but you may be able to extrapolate the apporach to something like if process X takes more than Z% CPU time the next Y cycles, it's probably a bot running.

That in addition to a "you must not run anything else while playing the game to be eligible for prizes" as part of the contest rules might work.

Also, a draconian "we might decide in any time for any reason that you have been using a bot and disqualify you" rule also helps with the heuristic approach above (used in prized ICC chess tournaments).

All these questions are easily solved by the rule 1 above:

* how to detect if another application makes periodical screenshots?
* how to detect if another application scans our process memory?
* what are good ways to determine whether user input (mouse movement, keyboard input) is human-generated and not automated?
* is it possible to detect if another application requests informations about controls in our application (position of controls etc)?

I think a good way to make harder the problem to the crackers is to have the only authoritative copies of the game state in your servers, only sending to and receiving updates from the clients, that way you can embed in the communication protocol itself client validation (that it hasn't been cracked and thus the detection rules are still in place). That, and actively monitoring for new weird behavior found might get you close to where you want to be.

查看更多
Melony?
6楼-- · 2019-02-07 01:54

The best protection against automation is to not have tasks that require grinding.

That being said, the best way to detect automation is to actively engage the user and require periodic CAPTCHA-like tests (except without the image and so forth). I'd recommend utilizing a database of several thousand simple one-off questions that get posed to the user every so often.

However, based on your question, I'd say your best bet is to not implement the anti-automation features in C#. You stand very little chance of detecting well-written hacks/bots from within managed code, especially when all the hacker has to do is simply go into ring0 to avoid detection via any standard method. I'd recommend a Warden-like approach (download-able module that you can update whenever you feel like) combined with a Kernel-Mode Driver that hooks all of the windows API functions and watches them for "inappropriate" calls. Note, however, that you're going to run into a lot of false positives, so you need to not base your banning system on your automated data. Always have a human look over it before banning.

查看更多
爷的心禁止访问
7楼-- · 2019-02-07 02:09

A common method of listening to keyboard and mouse input in an application is setting a windows hook using SetWindowsHookEx. Vendors usually try to protect their software during installation so that hacker won't automate and crack/find a serial for their application. Google the term: "Key Loggers"... Here's an article that describes the problem and methods to prevent it.

查看更多
登录 后发表回答