[Plugin] Anti-Cheat System

[PLUGIN + SOURCE CODE] (Now Also Available on Unreal Marketplace):

http://www.macupdate.com/images/icons256/39062.png


Hello Unreal community!

I’m back here at this forum section to share with you more cool things, once again:
I present you ‘SCUE4’: a super straightforward easy to use Anti-Cheat system for UE4 Blueprint developers.

This Anti-Cheat system implements a variety of techniques I’ve learned along the time (while making, playing and cheating games), to invalidate any memory injection into your most important stored values during game runtime.
Just like CheatEngine injects code in your game, this Plugin enables you to fight back and punch the cheater in totally non intrusive ways. There’s no data collected from hardware, no player privacy infringement or anything like that involved.
A great solution to keep cheaters away from your game front-end client with ease.
And best thing is: you don’t need to be an software engineer to use it! I love how far Epic Games allow us to go with Blueprints, it’s amazing.

All you need for a start (very good step forward) to defend your UE4 game project against cheat creators and 100% BLOCK ‘script kiddies’ from cheating on your Windows games ever again with [CHEAT-ENGINE]](http://www.cheatengine.org/).
If you’re making a game based on Windows and you don’t know what Cheat-Engine is, you’d probably like to take a crash course here: [CE-TUTORIAL]](Cheat Engine :: View topic - COMPLETE CheatEngine Tutorial(with pictures) UPDATE JAN 2015)

I will add more details soon, for now you can see the basics of how the tools work in this video:

Another Video: Cheating in Candy Crush with Cheat-Engine: [CandyCrushCheat - Sendvid]](CandyCrushCheat - Sendvid)

http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/SCUE4-Test_zpsuatzirb6.png


º Some features:

  • No DRM; let people play your game offline and still no cheating.
  • Block CheatEngine + 165 other popular debuggers on Windows from reading your game RAM.
  • Special property types, blueprint compatible, blocks memory value injection.
  • No privacy violation; no special user credentials required to run.
  • Detects debuggers trying to attach the process.

Some Drawbacks:

Build for UE4 Windows games only (32bit & 64bit), for now.
Cheaters will complain at you. a lot.


[Requirements]:
° Both Key Generator and the external scanner requires VS2015 runtime dependencies to run; you can find it in Microsoft’s Download Center.
° External scanner also requires .NET 4 which is by default installed on up to date Windows desktops.

[How To Use SCUE4]:

(always backup your projects before installing plugins)
° Close UE4, unzip the files provided into your UE4 game project’s folder. Executable libraries and code will be added to your project’s Plugins folder;
Then right click your .uproject file and choose ‘Generate Visual Studio project files’. Then open the .uproject file; around ~1.6GB of C++ code will be generated, so be patient.
You may have to convert your project to C++ project first, simply adding an empty C++ Class to your game.

° Open your game project in Unreal Editor, click Edit and go to ‘Project Settings…’-> ‘Maps & Modes’; In ‘Game Instance Class’ field, set ‘SafeGameInstance’ class as default.
If you have another custom Game Instance, use it instead, but after installing the Secure-Client plugin you have to re-parent your Game Instance to be a child of SafeGameInstance.
This will activate the anti-cheat system for your game. If you want the anti-cheat tool-set disabled, just replace the default Game Instance again.

Note: Latest versions do not require reparenting GameInstance class anymore. SCUE class was moved to a Subsystem.

° To observe Game-Guard’s behaviour while developing in Unreal Editor, and to activate the anti-debugger that is disabled by default, you have to:

  • Create or re-parent a GameInstance Blueprint from the ‘SafeGameInstance’ class and set it as default in Project Settings.
  • Uncheck the ‘Hide Game-Guard’ and ‘Allow Debugging’ check-boxes from the Details panel.
  • You most likely don’t want to block debugging while developing your game, uncheck it only when packaging in Shipping Mode and ready to publish.

http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/UE4-GI-Options_zpssjrnmnoj.png

° There’s also now a new ‘K-Generator’ toolbar button on your Unreal Editor’s toolbar; you can use it to create custom encryption keys for your Get/Set encryption nodes:

http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/SCUE4-Toolbar_zpsxcc3f2xm.png

° That simple, plugin is ready to use; Whenever you need a Safe Type in your Blueprint code, when creating a property in ‘Variable Type’ search for “Safe” and all available types shows:
(Safe Color Type have been added as well)

http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/UE4-SafeTypes_zpspjynqtzu.png

° The Key Generator creates a simple text file which you can copy new keys from, and paste into your Get/Set nodes if you desire to use custom encryption algorithm; but you don’t have to.
These custom keys are entirely optional, they provide slight increased security for your game code. In case you don’t provide any key, a default internal one is used:

http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/SCUE4-KeyGenerator_zpsehdhewtw.jpg

[FAQ]:

° What is the performance impact in game when using SC Safe Types in Blueprint graphs?

  • As you can see from image below, the Safe Types provided to encrypt Blueprint properties have a very very insignificant impact in your game code;
  • Each call to a Get/Set node has a function footprint ranging from 0.00ms to 0.01 milliseconds. In comparison: a single Tick Event call can sometimes eat up to 4.00ms.

http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/SCUE4-Stats_zpsuz9wwmrq.png

° What about Garbage Collection, how these types deal with GC?

  • The code generates no GC, UE4 will fire GC only when you destroy the Blueprint/Actor that was calling the Get/Set functions/nodes.

° Which Types are Safe Type supported?

  • You can encrypt the usual types used for Blueprint properties, such as:
    Boolean
    Byte
    Integer
    Float
    Name
    String
    Text
    Vector
    Vector 2D
    Vector 4D
    Linear Color
    Rotator
    Transform

° Does Safe Types support SaveGame tag, to be recorded by the Auto-Save Plugin?

  • Yes. Just enable SaveGame tag in advanced tab as usual and you easily get encrypted Save-Game data stored in your .sav files.

° Is networking, replication, supported for Safe Types?

  • The idea is Yes, must be, but I’m still working on multiplayer code to make sure everything is bug-free when running in authoritative servers thus I’m not 100% sure yet.

° Why I mark any Safe Type as ‘editable’, but values in Details panel are disabled and I can’t change them?

  • Because Safe Types are hidden and Unreal Engine’s Editor doesn’t know how to translate their encryption algorithm. Then what Details panel displays there is just a ‘fake copy’
  • of the real value which is possible to change or read only through the Get/Set node functions. If you could change values from Details panel, hackers could use the same route to
  • trace the fake value and use it to change the real, encrypted, one without bothering with any encryption secrets.
  • So to say, the only way you can change encrypted values is really through the Get/Set nodes which you can use in Blueprint graphs and/or its Construction Script to set default values.

° What if the Game-Guard external gets cracked to never return any positives?

  • Then your game itself through the SafeGameInstance class will take over and run an internal Game-Guard system; the class is built to force a crash in the game at this case.
  • This internal built-in code is compiled inside the game and only runs if the external solution have being bypassed. You don’t have to config anything for this, it’s automatic.

[this is part of the tools you get from this system, encrypted data types! I will explain them later. click image to see full size]:

[Types]:

http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/UE4-Anticheat_zpsokwyp241.jpg

[Operators]:

http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/FSBool_Operators_zpsyhf4qxwc.png
http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/FSByte_Operators_zpskfrwjaaq.png
http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/FSInt_Operators_zps6gvuwvbn.png
http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/FSFloat_Operators_zpsatoyzw9r.png
http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/FSName_Operators_zpsjmdomgtj.png
http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/FSString_Operators_zpsuaidxqsz.png
http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/FSText_Operators_zpsi2cldk79.png
http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/FSVector2D_Operators_zpsgqu4x7lp.png
http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/FSVector3D_Operators_zpsgqob7gfc.png
http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/FSVector4D_Operators_zpsfdd3iuyh.png
http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/FSColor_Operators_zpsetpuomej.png
http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/FSRotator_Operators_zpsnjlk6trn.png
http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/FSTransform_Operators_zps04gtqsvg.png


Source of the external scan process (SCUE4x64.exe); You can edit it and recompile to stop crashing the processes that you don’t want it to close;
Updated code in Game-Guard.cpp are courtesy of Jason Bentley:

https://www.dropbox.com/s/3so2x9cf5y…Guard.zip?dl=0

I’ve uploaded a new (1.1.4) version to GitHub for Unreal 4.17;
With correction for typos of some Keyword supposed to show nodes when you search on the Blueprint popup menu.

Also added nodes to get/set the “raw” (encrypted TCHAR array in form of string type) for the usual int, float, text, name, etc in case you need to store them elsewhere manually (custom savegame functions, etc).
String keys are optional, just in case you need to pass a new key when loading a value from a .sav file.

(on screenshot attached, for the key used, “NQoc” is an int “12345”)

Hello? I am a mobile security engineer in Korea. I have a question for you about this plugin. I tested it on mobile with this plugin. We have added our own numbers in each variable type. App Build Result When building with Unreal Editor and PC version, the result will be displayed normally. However, if you build on Android, the result will only show the number 0 on the top logo. Could you suggest the cause and solution? Thank you.
And attached blue print code and result screen.

The plugin seems to be force closing discord and other program which don’t have any cheat type naming any ideas?

No idea. Would have to add debug logs, change source to package as development mode and see what logs say when Discord causes a shutdown.

People are reporting its forcing drivers to shutdown also, is there anyway to enable it on launch so people playing single player can run the game without it?

You should create in c++ some kind of whitelist of things you don’t want the plugin to consider a possible treat.

Or just abort scan functions if unreal Api is playing offline session.

Either way it’s required c++ coder, the plugin as is it’s just a skeleton, generic solution.

Yeah i understand that just letting you know, ill add into the code so it doesn’t scan if running on a listen server.

Any idea why the anti-cheat would crash the engine in a shipping game? as soon as its finishes loading it just kills the engine the logs just say its shutdown?

Never mind seems it was my Intermediate folder it was using old cooked files for the plugin.

Uploaded to GitHub an updated version compatible with Unreal 5 (early access) here:

SCUE5 Plugin (github.com)

Hi, Took plugin from Epic Games, No c++ compiler. Set Game Instance as Child of Safe Subclass.
Set It In Maps settings.
Disabled/Enabled Check in the details Panel, Launch Play in Editor, The Project just get closed.
Try To Open it again, closes immediately. Reboot Pc, Project Opens Again, try to play in editor, immediately close.
Tested On Blank Third Person Template 4.25
Could You Tell me what is going on?)
Also A question about encryption if to save var with Engine system, the value will be encrypted in the file? No need to encrypt it once more? Thank you. Any Video would me so nice.

Awesome plugin, just a couple of clicks and you have awesome Cheat Engine protection.
I have a couple of questions. Why use encrypted variables “safe bool, safe float, etc.” if programs for reading these same variables simply won’t work?

And I was also embarrassed by a couple of warnings:

UATHelper: Packaging (Windows (64-bit)): LogTemp: Warning: {S} :: Initializing Secure-Client Plugin [Anti-Cheat].
PackagingResults: Warning: {S} :: Initializing Secure-Client Plugin [Anti-Cheat].

As I understand it, these warnings simply mean that the anti-cheat is packaged with the game, right?

Yes those warnings were “debug code” I left there, but they are harmless.
I did not understand your second question, there are common shared code online that can read/write any UPROPERTY from any Unreal game out there if you don’t encrypt them.

is there any tutorial on how to use your plugin i dont know where to start to add it on my project

If you have an Integer property, let’s say “Coin”, and you want it to be protected.
Use “Safe Int” type for Coin instead of Integer… That’s all you have to do to protect coin values, as a beginner.

If you want to modify the plugin (which is recommended because the source is public), then you need experience with Unreal and somebody comfortable with C++ to build on limitations. This is a starting point, the plugin is not complete anticheat toolset.

You should also sign your software with certification from Microsoft once you have the plugin modified to fit your codebase, have checksum verifications, etc, etc.

Hello, can you make an event or windows notification about when the game closes if SCUE4 could not close the cheat program and preferably with the name of the process that caused the crash?

or at least display in logs

The external scanner cannot perform blueprint events.

You Must know how to code and download the files to edit the source code.

I found the reason, and now I am faced with it. SCUE4 closes discord if you open the private messages tab with a person who has illegal word keys in their nickname. Discord creates a separate process for this with a “forbidden” nickname and SCUE4 closes it. In my case, the person in their nickname has the word “hack”.
I tried to remove the hack keyword from the Anti-Cheat Settings, but it seems that changing the keywords in any way has no effect. I added, changed, even cleared all keywords, but nothing changed.
Can you whitelist Discord or something?

Unfortunately I don’t know C++, so I can’t do anything.