On this page, 10 sections
An anti-cheat provider for FiveM, the multiplayer modification framework for Grand Theft Auto V, needed its detection engine to catch cheaters without punishing honest players. We ran the security side of the engine end to end: the threat model and plan, the heuristics and the logic behind every detection, the scanning that finds weaknesses in the servers it protects, the testing against real cheat techniques, and the security of the anti-cheat itself.
Game anti-cheat is security engineering under unusual pressure. The attackers are numerous, motivated and quick to adapt, the defender often runs on hardware it does not control, and every false positive bans a real person from something they care about. This is how the engine was built to handle that.
The problem
FiveM lets communities run their own role-play and game servers with custom scripts, called resources, written mostly in Lua and JavaScript. That flexibility is what makes the platform popular, and it is also what makes it hard to defend. A server is a collection of scripts from many authors, some bought, some free, some leaked, and each one can trust the player's game client more than it should.
Cheaters exploit both halves. On the client side they inject code to run menus, teleport, spawn weapons and vehicles, give themselves health or money, and see through walls. On the server side they look for scripts that accept whatever the client sends, and call those server events directly to grant themselves items, money or admin powers. A server owner usually sees only the result: an economy wrecked overnight or a player flying across the map.
Starting with a threat model
Before writing a single detection, we mapped what the engine was defending against and where it could see it. Every cheat technique was placed in one of a few categories, because each needs a different kind of defence.
- Client tampering: injected code, mod menus and executors running inside the game client.
- Server event abuse: legitimate server events called by a client with forged or out-of-range values, or called when they should not be callable at all.
- State manipulation: position, health, armour, weapons and vehicles changed in ways the game would never produce.
- Resource weaknesses and backdoors: server scripts that trust the client, and scripts that ship with hidden remote access.
- Ban evasion: players returning under new accounts after being removed.
The plan that came out of it set one principle above all others: the server is the source of truth. The client can be modified, so anything the engine learns only from the client is a hint, never proof. Detections that matter are confirmed against what the server itself knows.
The heuristics
Most cheats are not caught by recognizing the cheat. They are caught by noticing that something happened which the game cannot do. That is what the heuristics were built around.
Movement and position
The engine tracks how far and how fast each player moves between server ticks and compares it with what is possible for their state: on foot, in a vehicle, in an aircraft, falling. A distance covered faster than any legitimate means allows is a teleport or speed cheat. Allowances are made for the server's own teleports, respawns and vehicle types, which is where most false positives come from if nobody plans for them.
Health, armour and damage
Health and armour that rise without a legitimate source, damage that never registers, and damage dealt at rates or ranges no weapon allows all point to modified clients. Each is checked against the events the server saw.
Weapons, vehicles and entities
A player holding a weapon they were never given, or spawning vehicles, objects or explosions at rates no ordinary play produces, is flagged. Rate limits on entity creation also stop the server-crashing spam that some cheats rely on.
Server event validation
This is where most real damage happens, so it got the most attention. Sensitive server events are checked for who may call them, how often, with what values and in what game state. An event that grants money, for example, is only valid from the right place, in the right context, within the right range, at a sane rate. Calls that fail those checks are logged with the full payload.
Trap events
Some events exist only to be called by cheats. Menus often scan a server for events with tempting names and call them blindly. Decoy events that no legitimate script ever calls are a near-certain signal, with almost no false positive risk.
Client integrity signals
Client-side checks look for signs of injection and tampering and report them to the server through authenticated heartbeats. A client that stops reporting, reports inconsistently or fails integrity checks raises suspicion. Because the client can lie, these signals add to a player's score rather than banning on their own.
Scoring instead of instant bans
A single anomaly is not proof. Lag, desync and unusual but legitimate scripts all produce odd readings. So detections feed a score with confidence attached, and the response scales with the evidence.
- Low confidence signals are logged for review and nothing happens to the player.
- Repeated or combined signals raise the score and alert server staff.
- High confidence detections, such as a trap event fired or a confirmed server event exploit, lead to removal, with the evidence kept so staff can review and reverse a mistake.
That graded response is what lets a server run strict detection without banning its own community.
Free weekly email
Get The Compliance Brief every Tuesday
One email a week from Jacob Masse: the security and compliance stories that changed something that week, and what each one means if you sell software to enterprise buyers. Five stories, a take on each, five minutes to read.
Free. Unsubscribe in one click, and replies reach Jacob directly. Read the latest issue or browse the archive.
Scanning the server's own scripts
Many server compromises are not cheats at all. They are weaknesses in the scripts the server runs. We built scanning that reads a server's resources and flags the patterns that get servers exploited:
- Trusted client input: server event handlers that hand out money, items or permissions based on values the client sends, with no validation.
- Exposed admin functions: commands and events that grant elevated access without checking who is asking.
- Backdoors: code that fetches and runs instructions from a remote address, obfuscated blocks with no reason to be hidden, and the known patterns left in leaked or resold resources.
- Unsafe data handling: database queries built from player input and secrets written into script files.
Each finding came with the line of code, why it mattered and how to fix it, so a server owner could act on it rather than just worry about it.
Testing against real techniques
Detection logic that has never met an attacker is a guess. Every heuristic was tested in a controlled environment against the techniques it was meant to catch: teleporting, spawning, event abuse, health and weapon manipulation and entity spam. It was also tested against ordinary play, to measure how often it fired on honest players. Thresholds were tuned from those results, not chosen by instinct. When cheat developers changed their methods, the same process ran again.
Securing the anti-cheat itself
An anti-cheat is a target. If it can be switched off, forged or turned against the servers it protects, it is worse than nothing. The security work covered the product, not just its detections:
- Authenticated communication between game clients, servers and the provider's backend, so heartbeats and reports could not be forged or replayed.
- Licence and key handling that kept server keys out of client-visible code and allowed revocation.
- Tamper resistance so the engine could tell when its own components were removed or altered.
- Privacy in the ban data. Identifiers were collected only to the extent needed to detect cheating and ban evasion, access to ban records was limited, and records were kept no longer than necessary.
The result
- A threat model and plan that covered client tampering, server event abuse, state manipulation, resource backdoors and ban evasion.
- Server-authoritative heuristics for movement, health, weapons, entities and server events, plus trap events that catch menu users with almost no false positives.
- Confidence scoring and graded responses, so strict detection did not mean banning honest players.
- Resource scanning that found unsafe and backdoored scripts, with the exact line and the fix.
- Detections tested against real techniques and tuned against real play.
- An anti-cheat that was itself hard to forge, switch off or misuse, with ban data handled with care.
What we would tell another anti-cheat team or server owner
Trust the server, not the client. Anything learned only from the client can be faked. Confirm what matters on the server.
Most exploits are in your own scripts. Validate every server event as if a cheater wrote the client, because one did.
Score, do not snap-ban. False positives cost communities more than most cheats do.
Test against attackers and against honest players. Both numbers matter.
Secure the defender. An anti-cheat that can be forged or disabled is an attack surface of its own.
Common questions
How does FiveM anti-cheat detect cheaters?
The most reliable methods are server-side: checking movement, health, weapons, entity creation and server events against what the game can actually do, plus trap events only cheats call. Client-side integrity checks add evidence but can be bypassed on their own.
Why do FiveM servers get exploited even with an anti-cheat?
Often because a server script trusts values the client sends, or contains a backdoor from a leaked or resold resource. Scanning and fixing the server's own scripts closes the gap an anti-cheat cannot.
How do you avoid banning innocent players?
Combine signals into a confidence score, respond in steps from logging to removal, keep the evidence for review, and tune thresholds against ordinary play as well as against cheats.
The same skills behind this work, finding how a system can be abused and building the checks that stop it, are what we bring to penetration testing, code security reviews and ongoing security leadership for software companies. Our other case studies include training labs built for a CTF platform and security run for an aviation marketplace.
Book a free call if your product has users trying to break it. We will tell you where to look first.
Users trying to break your product? Penetration testing starts from $3,500 for one app or API.
See penetration testingOr book a free call