[Mod] anticheat [anticheat]

User avatar
rnd
Member
Posts: 220
Joined: Sun Dec 28, 2014 12:24
GitHub: ac-minetest
IRC: ac_minetest
In-game: rnd

[Mod] anticheat [anticheat]

by rnd » Post

A cheat detection mod that detects fly, noclip and too fast resource mining


Licenses : LGPL
Depends : default

Download: https://github.com/ac-minetest/antichea ... master.zip

Image since 09/08/2017 :)
----------------------------------------------------------------------------------------------------------

Who is this for:
Server admins who want to run serious survival servers, free of "ill fly around and noclip underground to get 999 mese/diamonds in 5 minutes while being undetected".

Does it work:
Yes, its being used in practice on @test@ Just Test II [SERVER] with 40-50 players.

Features:
Spoiler
0. what it does:
- succesffuly detect noclip/fly. Its just a matter of time when someone noclipping/flying is detected. If boneworld mod is installed it will also monitor the speed of resource acquiring.

- players cant know when they are being watch since intervals are randomized
- lag resistant (see CHECK_AGAIN in settings)

1. moderators can:
-see full reports with coordinates of location as cheats occur
-use /crep to see cheat reports
-use /crep 1 to see a list of players together with their various statistics
-use /cdebug to see even suspected cheats to be verified later
-use /cchk NAME to check someone immediately
-use /watch NAME to spectate suspect/detected cheater, /unwatch to return to normal

managing moderators:
-edit names inside anticheatsettings.moderators in settings.lua
-Any player with kick privileges is moderator and is additionaly ignored by cheat checks. Use this for admin only - cheaters can then see who moderators are.

2. this mod works well with basic_vote mod. After cheater has been positively detected anyone can use /vote to kick, remove interact or kill cheater. Vote in this case is cast anonymously, under the name #anticheat.
For historical references: password for source zip https://github.com/ac-minetest/antichea ... 936c735ad0 file is z4t3uhVit7_4tjmlE_OP
Last edited by rnd on Fri Sep 08, 2017 08:14, edited 15 times in total.
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT

User avatar
Calinou
Moderator
Posts: 3169
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

Re: anticheat

by Calinou » Post

Naj wrote:Looks nice !

Seems that source of anticheat_routines.bin is missing in github
It looks like it's a proprietary mod: https://github.com/ac-minetest/antichea ... ua#L78-L79

I urge the mod author to actually release the source code of it, it's not a security threat at all. (We don't allow proprietary mods in Mod Releases, by the way.)

User avatar
rnd
Member
Posts: 220
Joined: Sun Dec 28, 2014 12:24
GitHub: ac-minetest
IRC: ac_minetest
In-game: rnd

Re: anticheat

by rnd » Post

Source is provided - just not for the sensitive part of checking. complete source - making it easy for cheaters to see what they should look for kinda defeats the purpose of it. So we have 2 possibilities:
1. weaken it by providing full source
2. play it smarter

What license do you suggest?
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT

User avatar
Calinou
Moderator
Posts: 3169
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

Re: anticheat

by Calinou » Post

rnd wrote:Source is provided - just not for the sensitive part of checking. complete source - showing cheaters what they should look for kinda defeats the purpose of it. So we have 2 possibilities:
1. weaken it by providing full source
2. play it smarter

What license do you suggest?
The license used currently is fine (GPLv3+), but it's nothing if the full source code isn't available. Also, random server-side checks are not really weakened by providing source code…

But a binary-only mod only makes it harder to fix and improve.

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: anticheat

by rubenwardy » Post

Correction: play it dumber, and have no one use your mod. I personally would not use a mod with hidden code.

Looks like it uses find_nodes_in_area and line_of_sight to detect fly and noclip, along with get_player_controls
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
rnd
Member
Posts: 220
Joined: Sun Dec 28, 2014 12:24
GitHub: ac-minetest
IRC: ac_minetest
In-game: rnd

Re: anticheat

by rnd » Post

i certainly agree to show full source to certain trusted people for review, just not to publish it openly.
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: anticheat

by rubenwardy » Post

Yeah, under the GPL license anyone that downloads this mod can demand to see the source of the bin file, and you'd be legally obligated to comply
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
rnd
Member
Posts: 220
Joined: Sun Dec 28, 2014 12:24
GitHub: ac-minetest
IRC: ac_minetest
In-game: rnd

Re: anticheat

by rnd » Post

For now ill just include source but encrypted with password. Anyone trustworthy can see it.

I still didn't find any good example of open source anti cheat system, either they are long time abandoned or empty.
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: anticheat

by rubenwardy » Post

If you write the server/client in the correct way using client side prediction / server side reconciliation, there is no need to use anti cheat, as the algorithms include it - the server simulates movement on its end, as well as on the client, to make sure there's no problems. But Minetest doesn't do this, and it's a little late to do add this
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
rnd
Member
Posts: 220
Joined: Sun Dec 28, 2014 12:24
GitHub: ac-minetest
IRC: ac_minetest
In-game: rnd

Re: anticheat

by rnd » Post

Right, that seems to be nicely explained here:
http://gabrielgambetta.com/fpm2.html

Btw there is strange bug in minetest where:

minetest.get_node(player:getpos()).name

does not always return name of node at player feet position, for player positions where pos.y<0 it actually returns node 1 below player feet position. Another thing:

When player jumps and then lands on floor with sneaking sometimes player:getpos() will report player y-position not at integer.5 ( 4.5 for example), but something like integer.49888...288 ( strangely this number is always the same). This causes minetest.get_node(player:get_pos()).name to read position 1 block down again - making it unnecessarily difficult to read correct position without rounding it first.
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT

User avatar
SaKeL
Member
Posts: 743
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: anticheat

by SaKeL » Post

Whats wrong ? I do have "anticheat_routines.bin" in the mod folder..

Code: Select all

2016-10-21 23:56:38: ERROR[Main]: ModError: Failed to load and run script from /home/juraj/.minetest/mods/anticheat/init.lua:
2016-10-21 23:56:38: ERROR[Main]: /home/juraj/.minetest/mods/anticheat/init.lua:94: attempt to call local 'anticheat_routines' (a nil value)
2016-10-21 23:56:38: ERROR[Main]: stack traceback:
2016-10-21 23:56:38: ERROR[Main]: 	/home/juraj/.minetest/mods/anticheat/init.lua:94: in main chunk
line in init file:

Code: Select all

local anticheat_routines=loadfile(minetest.get_modpath("anticheat").."/anticheat_routines.bin")
check_noclip, check_fly, check_player = anticheat_routines(minetest,cheat,CHECK_AGAIN,punish_cheat);

User avatar
rnd
Member
Posts: 220
Joined: Sun Dec 28, 2014 12:24
GitHub: ac-minetest
IRC: ac_minetest
In-game: rnd

Re: anticheat

by rnd » Post

only reason i can think of:

Code: Select all

string.dump(function)
Returns a binary representation of the given function, so that a later loadstring on that string returns a copy of the function. Function must be a Lua function without upvalues.
-> maybe binary made on windows can't be loaded on linux. In this case someone needs to do it on linux.
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT

User avatar
SaKeL
Member
Posts: 743
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: anticheat

by SaKeL » Post

i have linux, i could try it out if you give me some indication on what needs to be done.

EDIT: found some examples on how to do it, will try to do it on example lua files but eventually i will need the source.

User avatar
rnd
Member
Posts: 220
Joined: Sun Dec 28, 2014 12:24
GitHub: ac-minetest
IRC: ac_minetest
In-game: rnd

Re: anticheat

by rnd » Post

i was curious so i installed minetest 0.4.14 under linux ubuntu from and gave it a try. Did:
0. installed minetest using Synaptic Package manager under Lubuntu
Image
1. extracted https://github.com/ac-minetest/antichea ... master.zip into home/$name/.minetest/mods, renamed folder names: anticheat-master to anticheat
Image
2. run minetest game in singleplayer with "anticheat" mod checked
3. it runs ok, with anticheat mod working:
Image
Attachments
Ubuntu-2016-10-22-13-29-12.jpg
Ubuntu-2016-10-22-13-29-12.jpg (66.51 KiB) Viewed 1903 times
Ubuntu-2016-10-22-13-17-44.jpg
Ubuntu-2016-10-22-13-17-44.jpg (89.9 KiB) Viewed 1903 times
linux_lubuntu.jpg
linux_lubuntu.jpg (76.7 KiB) Viewed 1903 times
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT

User avatar
SaKeL
Member
Posts: 743
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: anticheat

by SaKeL » Post

Weird..i try to remove my anticheat folder from my mods folder and clone it again..i dont see any other solution at this point...hope that will work

FYI: im using daily builds, not sure what is in the synaptic repositories atm

User avatar
SaKeL
Member
Posts: 743
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: anticheat

by SaKeL » Post

nope...

- removed the mod
- clone it again
- not working

- removed the mod
- downloaded the .zip file
- not working

- each time i have created new map with only default mods and anticheat mod enabled

Seems like there is something else on my machine what is causing this not to work since it works on rnd's machine.

User avatar
ExeterDad
Member
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad
Location: New Hampshire U.S.A

Re: anticheat

by ExeterDad » Post

I'm assuming the bin file is compiled lua. Does compiled lua need to be run with identical lua versions? This is just a guess btw. I know to decompile lua, version IS important in many cases.

Edit: Just found this.
Lua programs that have been precompiled for one version will not load in a different version.

User avatar
SaKeL
Member
Posts: 743
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: anticheat

by SaKeL » Post

Found the problem, just adjust the minetest.conf file with:

Code: Select all

#    Prevent mods from doing insecure things like running shell commands.
secure.enable_security = false
This will open vulnerability for any mod to run shell commands on your server or pc. Maybe it would be better to use "request_insecure_environment()" function in your mod so people can include it in the "secure" list instead of disabling the security for all mods ;)

Code: Select all

#    Comma-separated list of trusted mods that are allowed to access insecure
#    functions even when mod security is on (via request_insecure_environment()).
#secure.trusted_mods =

User avatar
rnd
Member
Posts: 220
Joined: Sun Dec 28, 2014 12:24
GitHub: ac-minetest
IRC: ac_minetest
In-game: rnd

Re: anticheat

by rnd » Post

indeed, in [0.4.12-dev] Mod security it says

Code: Select all

But the following things shouldn't work:
    Using some insecure functions like require(), os.execute(), or debug.getlocal().
    Running compiled Lua bytecode.
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT

User avatar
bigfoot
Member
Posts: 203
Joined: Fri Sep 02, 2016 23:31
GitHub: bigfoot547
IRC: bigfoot547 or bigfoot
In-game: bigfoot547 or bigfoot
Location: Somewhere between polar bears and penguins.

Re: anticheat

by bigfoot » Post

Can I please see the code?

+1 for open source!

red-001
Member
Posts: 205
Joined: Tue Jan 26, 2016 20:15
GitHub: red-001
IRC: red-001

Re: anticheat

by red-001 » Post

It's trivial to decompile lua bytecode. If someone is going to take the time to try and find a weakness in an anticheat system, compiling lua to bytecode isn't going to do much to stop them.

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: anticheat

by rubenwardy » Post

I spent an hour or so trying to decompile it using unluac, hex editors, and other tools. I don't understand the obscurity side of lua though
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

red-001
Member
Posts: 205
Joined: Tue Jan 26, 2016 20:15
GitHub: red-001
IRC: red-001

Re: anticheat

by red-001 » Post

AFAIK Lua JIT uses a different format for bytecode so you need a decompiler that written for Lua JIT.

User avatar
bigfoot
Member
Posts: 203
Joined: Fri Sep 02, 2016 23:31
GitHub: bigfoot547
IRC: bigfoot547 or bigfoot
In-game: bigfoot547 or bigfoot
Location: Somewhere between polar bears and penguins.

Re: anticheat

by bigfoot » Post

I think that you should make the mod open-source because:
  1. Your license assumes that your code is open-source (GPL v3.0)
  2. This defeats the whole purpose of the linux operating system
  3. With your license you would have to give the code when someone asks (see #1)
  4. This is not allowed in mod releases
And for what?
If you don't want cheaters to analyze the code to cheat undetectably, the cheater would go to the next server. I mean, the server list shows the mod list! If I were a cheater and I saw an anticheat mod, I would not go on that server.

That is all.
Cheers, bigfoot547.

User avatar
maikerumine
Member
Posts: 1420
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: anticheat

by maikerumine » Post

bigfoot547 wrote:I think that you should make the mod open-source because:
  1. Your license assumes that your code is open-source (GPL v3.0)
  2. This defeats the whole purpose of the linux operating system
  3. With your license you would have to give the code when someone asks (see #1)
  4. This is not allowed in mod releases
And for what?
If you don't want cheaters to analyze the code to cheat undetectably, the cheater would go to the next server. I mean, the server list shows the mod list! If I were a cheater and I saw an anticheat mod, I would not go on that server.

That is all.
Cheers, bigfoot547.
For what it's worth,

The code is pretty solid and has done a great job deterring cheaters on the Just Test 2 server. :)
Talamh Survival Minetest-->viewtopic.php?f=10&t=12959

Post Reply

Who is online

Users browsing this forum: Bing [Bot], birdlover32767 and 35 guests