[Mod] anticheat [anticheat]

User avatar
rnd
Member
 
Posts: 207
Joined: Sun Dec 28, 2014 12:24
IRC: ac_minetest
In-game: rnd

[Mod] anticheat [anticheat]

by rnd » Mon Aug 29, 2016 07:51

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


Licenses : LGPL
Depends : default

Download: https://github.com/ac-minetest/anticheat/archive/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


For historical references: password for source zip https://github.com/ac-minetest/anticheat/commit/87548a1e2b1d8898ba7af35b0760aa8dd18db972#diff-f17873c546b60c89a58266936c735ad0 file is z4t3uhVit7_4tjmlE_OP
Last edited by rnd on Fri Sep 08, 2017 08:14, edited 15 times in total.
 

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

Re: anticheat

by Calinou » Mon Aug 29, 2016 09:27

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: 207
Joined: Sun Dec 28, 2014 12:24
IRC: ac_minetest
In-game: rnd

Re: anticheat

by rnd » Mon Aug 29, 2016 09:42

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?
 

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

Re: anticheat

by Calinou » Mon Aug 29, 2016 09:49

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: 5539
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: anticheat

by rubenwardy » Mon Aug 29, 2016 10:18

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
 

User avatar
rnd
Member
 
Posts: 207
Joined: Sun Dec 28, 2014 12:24
IRC: ac_minetest
In-game: rnd

Re: anticheat

by rnd » Mon Aug 29, 2016 10:22

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

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

Re: anticheat

by rubenwardy » Mon Aug 29, 2016 10:29

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
 

User avatar
rnd
Member
 
Posts: 207
Joined: Sun Dec 28, 2014 12:24
IRC: ac_minetest
In-game: rnd

Re: anticheat

by rnd » Mon Aug 29, 2016 12:22

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.
 

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

Re: anticheat

by rubenwardy » Mon Aug 29, 2016 12:39

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
 

User avatar
rnd
Member
 
Posts: 207
Joined: Sun Dec 28, 2014 12:24
IRC: ac_minetest
In-game: rnd

Re: anticheat

by rnd » Mon Aug 29, 2016 12:49

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.
 

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

Re: anticheat

by SaKeL » Fri Oct 21, 2016 22:35

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: 207
Joined: Sun Dec 28, 2014 12:24
IRC: ac_minetest
In-game: rnd

Re: anticheat

by rnd » Sat Oct 22, 2016 09:14

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.
 

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

Re: anticheat

by SaKeL » Sat Oct 22, 2016 09:22

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: 207
Joined: Sun Dec 28, 2014 12:24
IRC: ac_minetest
In-game: rnd

Re: anticheat

by rnd » Sat Oct 22, 2016 11:14

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
(66.51 KiB) Not downloaded yet
Ubuntu-2016-10-22-13-17-44.jpg
(89.9 KiB) Not downloaded yet
linux_lubuntu.jpg
(76.7 KiB) Not downloaded yet
 

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

Re: anticheat

by SaKeL » Sat Oct 22, 2016 15:45

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: 650
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: anticheat

by SaKeL » Sat Oct 22, 2016 16:35

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
Location: New Hampshire U.S.A
In-game: ExeterDad

Re: anticheat

by ExeterDad » Sat Oct 22, 2016 16:48

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: 650
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: anticheat

by SaKeL » Sat Oct 22, 2016 16:59

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: 207
Joined: Sun Dec 28, 2014 12:24
IRC: ac_minetest
In-game: rnd

Re: anticheat

by rnd » Sat Oct 22, 2016 17:58

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.
 

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

Re: anticheat

by bigfoot » Sun Oct 30, 2016 21:59

Can I please see the code?

+1 for open source!
God's not dead, He's surely alive!
My Stuff | My User Page | Check out my website!
<bigfoot547> I major in existing. | <RedPanda246> Not every day is good, but there is good in every day.
Stay elusive ⓐⓝⓓ ⓣⓐⓛⓚ ⓘⓝ ⓒⓘⓡⓒⓛⓔⓢ!
 

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

Re: anticheat

by red-001 » Tue Nov 01, 2016 22:35

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: 5539
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: anticheat

by rubenwardy » Tue Nov 01, 2016 23:05

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
 

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

Re: anticheat

by red-001 » Tue Nov 01, 2016 23:15

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
Location: Somewhere between polar bears and penguins.
GitHub: bigfoot547
IRC: bigfoot547 or bigfoot
In-game: bigfoot547 or bigfoot

Re: anticheat

by bigfoot » Tue Nov 01, 2016 23:59

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.
God's not dead, He's surely alive!
My Stuff | My User Page | Check out my website!
<bigfoot547> I major in existing. | <RedPanda246> Not every day is good, but there is good in every day.
Stay elusive ⓐⓝⓓ ⓣⓐⓛⓚ ⓘⓝ ⓒⓘⓡⓒⓛⓔⓢ!
 

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

Re: anticheat

by maikerumine » Wed Nov 02, 2016 00:41

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. :)
 

Next

Return to WIP Mods



Who is online

Users browsing this forum: Gibeinumo and 4 guests