GithubHelp home page GithubHelp logo

grimanticheat / grim Goto Github PK

View Code? Open in Web Editor NEW
935.0 26.0 261.0 7.2 MB

Fully async, multithreaded, predictive, open source, 3.01 reach, 1.005 timer, 0.01% speed, 99.99% antikb, "bypassable" 1.8-1.20 anticheat.

License: GNU General Public License v3.0

Java 100.00%

grim's Introduction

GrimAC

This project is considered feature complete for the 2.0 (open-source) branch of this project. If you would like a bugfix or enhancement and cannot sponsor the work, pull requests are welcome. Feel free to contact DefineOutside for consulting estimates if desired. You can join the discord for jar releases & changelogs.

Test server with bufferless alerts: test.grim.ac

GrimAC is an open source Minecraft anticheat designed for 1.20 and supports 1.8-1.20. It is free while in beta. It will eventually become paid and/or will include offering additional subscription based paid checks. Geyser players are fully exempt.

Compiling through terminal/command prompt

  1. git clone https://github.com/GrimAnticheat/Grim.git (or click the green code button, download ZIP, then unzip it.)
  2. cd Grim
  3. gradlew build
  4. The final jar is located in build/libs

API Information

Grim's API allows you to integrate Grim into your own plugins. For more information, check out the API's GitHub repository here.

Grim supremacy

Here are the main cores that make Grim stand out against other anticheats

Movement Simulation Engine

  • We have a 1:1 replication of the player's possible movements
  • This covers everything from basic walking, swimming, knockback, cobwebs, to bubble columns
  • It even covers riding entities from boats to pigs to striders
  • Built upon covering edge cases to confirm accuracy
  • 1.13+ clients on 1.13+ servers, 1.12- clients on 1.13+ servers, 1.13+ clients on 1.12- servers, and 1.12- clients on 1.12- servers are all supported regardless of the large technical changes between these versions.
  • The order of collisions depends on the client version and is correct
  • Accounts for minor bounding box differences between versions, for example:
    • Single glass panes will be a + shape for 1.7-1.8 players and * for 1.9+ players
    • 1.13+ clients on 1.8 servers see the + glass pane hitbox due to ViaVersion
    • Many other blocks have this extreme attention to detail.
    • Waterlogged blocks do not exist for 1.12 or below players
    • Blocks that do not exist in the client's version use ViaVersion's replacement block
    • Block data that cannot be translated to previous versions is replaced correctly
    • All vanilla collision boxes have been implemented

Fully asynchronous and multithreaded design

  • All movement checks and the overwhelming majority of listeners run on the netty thread
  • The anticheat can scale to many hundreds of players, if not more
  • Thread safety is carefully thought out
  • The next core allows for this design

Full world replication

  • The anticheat keeps a replica of the world for each player
  • The replica is created by listening to chunk data packets, block places, and block changes
  • On all versions, chunks are compressed to 16-64 kb per chunk using palettes
  • Using this cache, the anticheat can safely access the world state
  • Per player, the cache allows for multithreaded design
  • Sending players fake blocks with packets is safe and does not lead to falses
  • The world is recreated for each player to allow lag compensation
  • Client sided blocks cause no issues with packet based blocks. Block glitching does not false the anticheat.

Latency compensation

  • World changes are queued until they reach the player
  • This means breaking blocks under a player does not false the anticheat
  • Everything from flying status to movement speed will be latency compensated

Inventory compensation

  • The player's inventory is tracked to prevent ghost blocks at high latency, and other errors

Secure by design, not obscurity

  • All systems are designed to be highly secure and mathematically impossible to bypass
  • For example, the prediction engine knows all possible movements and cannot be bypassed

grim's People

Contributors

aoelite avatar ayazjenkins avatar ayouuuu avatar booky10 avatar bram1903 avatar c0dingnoobi avatar caoli5288 avatar chrommob avatar deepsourcebot avatar definepvp avatar gnewl avatar hmoodyxd avatar i2021 avatar iflamingoz avatar jamestheflash22 avatar jaren8r avatar jonesdevelopment avatar jtjava avatar machinebreaker avatar maledictytb avatar maninmyvan avatar midnighttale avatar mwhunter avatar nuym avatar ruviolence avatar samb440 avatar scarfacered avatar usernugget avatar vytskalt avatar z7087 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grim's Issues

Lag compensated block placing/breaking

Good way to debug this is clumsy, placing water by the player and running around. The server sees the player in water while the client hasn't gotten the update.

Either we need to try and lag compensate this or give leniency with high ping. Lag compensation is preferred to hurt players who ping spoof, but lenience is also good. Maybe a combination would be best.

1.8 clients would theoretically break the movement checks due to a bukkit feature

The lastX, lastY, and lastZ would be overwritten when the vanilla 1.8 client sends their regular movement packet every tick, and bukkit would skip over the move event because the client did not move enough. We don't intentionally support 1.8 clients but there's no reason to try and break them due to bad anticheat design.

Not sure if this would actually break anything, but it might and it's bad to have hidden issues.

Separate bounding box check

While working on #17 I discovered that the check with bounding boxes is 100% accurate to all (!) 20 decimal places. Making a new check with the bounding boxes could take some work off the main "god" check.

Seems to demolish these cheats 100%:

  • Click teleport
  • Probably noclip, although I haven't tested
  • Probably phase, although I haven't tested

Air jump bypass

I don't have a check to see if a player can actually jump

As a bonus this would help with optimization

False positive while going onto a slab while falling off of a slab

[19:46:59 INFO]: P: 0.16731866059006817 0.0 0.004921687037204756
[19:46:59 INFO]: A: 0.18913012954817532 0.0 -0.001963555887414259
[19:46:59 INFO]: P: 0.18933632740596407 0.5 -0.0019635558495455356
[19:46:59 INFO]: A: 0.20124539274729614 0.5 -0.001963555887414259
[19:46:59 INFO]: P: 0.10337764677124169 0.0 0.0
[19:46:59 INFO]: A: 0.10987999720293828 0.0 0.0
[19:46:59 INFO]: P: -0.04153612641930719 0.0 0.0019635558495455356
[19:46:59 INFO]: A: -0.13882112796977708 0.0 0.003927111774828518
[19:46:59 INFO]: P: -0.12065905577168302 0.0 0.0019635558495455356
[19:46:59 INFO]: A: -0.07294139130340227 0.0 0.0
[19:46:59 INFO]: P: -0.06587985210345686 -0.0784000015258789 0.0
[19:46:59 INFO]: A: -0.03982600427752914 -0.07840000152587923 0.0
[19:46:59 INFO]: P: -0.01637433853404514 -0.1552320045166016 -3.9271115527947625E-4
[19:46:59 INFO]: A: -0.0021489355873427485 -0.15523200451660202 -3.9271116293093655E-4
[19:46:59 INFO]: P: 0.004695416397083983 -0.230527368912964 -3.9271115527947625E-4
[19:46:59 INFO]: A: 0.019596065273844943 -0.23052736891296366 -3.9271116293093655E-4
[19:46:59 INFO]: P: 0.0238688939369878 0.41999998688697815 -3.9271115527947625E-4
[19:46:59 INFO]: A: 0.03742848518709252 0.4641593749554449 -3.9271116293093655E-4

[19:46:59 INFO]: P: -0.07625963400390194 0.33319999363422365 0.0019635558495455356
[19:46:59 INFO]: A: -0.17807647886945688 -0.07840000152587923 0.003927111774828518
[19:46:59 INFO]: P: -0.06123382989496545 0.24813599859094576 3.9271115527947625E-4
[19:46:59 INFO]: A: -0.10064913706855805 -0.15523200451660202 4.3780006672022864E-4
[19:46:59 INFO]: P: -0.07531789607351144 0.16477328182606651 4.3780005862265677E-4
[19:46:59 INFO]: A: -0.0915907173720143 -0.23052736891296366 0.0
[19:46:59 INFO]: P: -0.08813296205311552 0.08307781780646721 4.979149334598718E-4
[19:46:59 INFO]: A: -0.08334755521059378 -0.0358406250445551 0.0
[19:47:00 INFO]: P: 0.017763442118485365 0.0030162615090425808 -0.002639853282121617
[19:47:00 INFO]: A: 0.1321591253349652 0.0 -0.005279706667352002
[19:47:00 INFO]: P: 0.10766328042143822 0.0 -0.002639853282121617
[19:47:00 INFO]: A: 0.15804681346639882 0.0 -0.002639853333676001
[19:47:00 INFO]: P: 0.15674859783623907 0.5 -0.002639853282121617
[19:47:00 INFO]: A: 0.18425801198077352 0.5 -0.002639853333676001
[19:47:00 INFO]: P: 0.08558474435947948 0.0 0.0
[19:47:00 INFO]: A: 0.10060488622696084 0.0 0.0

Players don't slight jump when on low liquid

Line numbers on Mojang mappings:
LivingEntity line 1778
LivingEntity line 1797

Relies on horizontal collision so we will need to see if the player is touching a wall. Currently, the swim hop is simply implemented incorrectly and in the wrong place.

Implement check for speed using the player's theoretical input

To check for speed, look at the player's theoretical input and see if it is greater than 1.001. It shouldn't be greater than 1.0 and 0.001 allows for players to go 0.1% faster before being flagged. In zero-latency, this seems like enough of a buffer, although it's probably not. I'll know better when the rest of the anticheat is done.

Entity pushing is weird/not lag compensated

Sometimes, for optimization, collision doesn't run, which is good! We should just be able to use the player's real movement with collision for optimization. I'm currently looking at how collisions actually work in-game.

It messes up badly since the position of mobs aren't lag compensated (do they really need to be? Can we just lookup nearby collision and add leniency in case there is some?)

Not too sure right now. It's not a major issue but it definitely will cause issues as everything else becomes more precise.

Swimming onto ladders is slightly off

[09:57:27 INFO]: P: 928.9205272065011 0.0 40996.14192568121
[09:57:27 INFO]: A: 0.0 0.0 -0.09709538523429728

Unsurprisingly checking the collisions of more than half a million blocks (on the next tick) crashed the server.

Predicting inputs with collisions

Fun bug being caused by input prediction:

  • Player slightly moves and runs into a wall
  • Input is registered as 0
  • Compounded by jumping out of liquid causing 0.3 vertical movement
  • Player banned for fly cheats

No fall is not blocked

It can also be used to bypass the protection in #15

Not too difficult to patch. Best method might be to correct the player's movement packet for them. Would help bypasses in other plugins that believe the player's onGround boolean.

Player velocity packets not implemented

My first idea would be to send a keepalive packet to the player before the velocity packet to know when it is applied, but this could probably be exploited with a client to delay velocity for up to thirty (?) seconds.

hmm... one source is saying that this is a 1.12+ only behavior so I might not want to use this mechanic to implement velocity, just in case I want to add legacy support.

Another fun but performance costly/bug-filled implementation would be to rerun all the calculations with the velocity packet to see if it is closer. This could error with small velocity packets. We could ignore small velocity packets but that's a hacky mess.

I'm really not sure, I'll see if anyone has solved this issue before me. If they did, it's probably not public :(

A bad prediction can affect subsequent predictions

For example, if the anticheat believes that someone jumps and they didn't, then the anticheat will flag them 5+ times.

Each check should be independent to one another, to the best degree possible.

Will introduce some bypasses and we will need scale like
y = (x - 0.03)^2

to stop people from flinging themselves into the air every twenty ticks, while the anticheat is like: oh this person is flagging once every 20 ticks I guess they just have a bad connection and aren't cheating.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.