X
X
X
X
All systems operational · 200 Tbps+ DDoS protection active
Sign Up Sign In 08505574494

FiveM DDoS Protection: Complete Four-Layer Guide

HomepageArticlesFiveM ServerFiveM DDoS Protection: The Complete...
FiveM DDoS Protection: The Complete Four-Layer Guide

There is no single fix for protecting a FiveM server against DDoS; the defence is built across four separate layers: real network-level scrubbing that covers UDP, the rate limiters inside server.cfg, server-side validation in your scripts, and a firewall at the operating system level. Miss one and an attacker simply routes around the others. And a significant share of what FiveM owners call "DDoS" is not a classic volumetric attack at all — it is an event or state bag flood triggered from inside by a connected player, and no network filter can see that. This guide works through all four layers in order.

Why FiveM servers are such easy targets

Three structural reasons, all specific to FiveM:

  • Your IP is already public. To appear in the in-game server list, your server has to publish its address. Unlike a website, "hiding the real IP" is limited from the start.
  • Game traffic runs over UDP. The standard protection tools of the web world are built for HTTP/HTTPS and do not cover the game port.
  • The motivation is competitive, not commercial. In the roleplay scene, knocking a rival offline at prime time is used directly as a way to win players. The attacker is often not a professional but a member of a competing community.

Industry data backs this up: gaming absorbs roughly 19% of all DDoS attacks, and 56% of network-layer attacks are UDP floods. FiveM's exposure concentrates exactly where conventional web protection cannot see.

The attack types aimed at FiveM

Four attack types against FiveM servers: volumetric UDP flood, netcode amplification, HTTP flood and event flood

Lumping all of these together as "DDoS" is the most common reason people spend money on the wrong solution. Each is stopped somewhere different.

1. Volumetric UDP flood

High-volume packets sent at the game port (default 30120) to saturate the link or the network equipment. The good news: this is the easiest type to filter — with a provider that has real scrubbing, it is usually stopped before you notice.

2. Netcode / amplification attacks

Volume may be low, but packets are chosen to be expensive for the server to process. The result is not a saturated link but a CPU spike and degraded tick time. Players say "the server is lagging" while traffic graphs look normal.

3. HTTP flood

Targets the server list registration, the txAdmin interface, or your own web API. The game port is fine, but your server vanishes from the list or your panel will not load.

4. Event and state bag flood

The most insidious, and here the attacker is inside your server as a legitimate player. A poorly protected net event is triggered thousands of times per second, or state bags are stuffed. No network-level protection can see this, because the traffic comes from a legitimate player and looks normal. The defence for this layer lives in your server.cfg and your script code.

Ports and attack surface

Before building defences you need to know what is open. FiveM's baseline configuration:

  • 30120 TCP + UDP — game traffic, server list registration and client connections. Opened in server.cfg with endpoint_add_tcp "0.0.0.0:30120" and endpoint_add_udp "0.0.0.0:30120". Both are required; opening only one causes connection problems.
  • txAdmin interface — served on a separate web port. Leaving it fully exposed to the internet is unnecessary risk; restrict it to your own IP where possible.
  • Database port (3306) — should never face the internet. MySQL should run over a local connection.
  • SSH — administrative access; key-based authentication and restricted access are essential.

The rule is simple: every port you do not use should be closed. Configure the firewall default-deny and open only what is needed.

Network-level protection: what to look for in a provider

Only your provider's infrastructure can stop volumetric attacks; no setting inside your server absorbs a 100 Gbps flood. Which makes hosting choice a security decision in FiveM.

The right questions — and "how many Gbps" is not one of them:

  • Which layer does protection operate at? L3/L4 only, or L7 too?
  • Are UDP floods covered? For FiveM this is the decisive question. If not, everything else is detail.
  • What happens during an attack? Is the IP null-routed, or is traffic scrubbed and the legitimate portion delivered? Null-routing is not protection — the attack stops because your server stops too, which is exactly what the attacker wanted.
  • How fast does it engage? Automatically, within seconds? With 90.6% of attacks ending in under 10 minutes, a process that runs through support tickets is structurally too late.
  • Is there neighbour isolation? Attack frequency is high on game-hosting infrastructure; without reserved resources, an attack on a neighbour lands in your tick time.

We covered what capacity figures mean in practice in our DDoS protection capacity guide, and the general mechanics in what is a DDoS protected server.

Why Cloudflare alone is not enough

This is the most widely misunderstood point in the FiveM community. Cloudflare's standard services are built for HTTP/HTTPS traffic. They protect your website, forum or panel — but because game traffic flows over UDP on port 30120, the game port is not behind that protection.

The common scenario: an owner moves the domain to Cloudflare, believes they are protected, and the game server goes down when an attack arrives. The attacker was not hitting the domain — they were hitting the server's IP and game port directly.

For the full explanation see does Cloudflare protect game servers — the UDP reality. In short: valuable for the web side, insufficient for the game port.

Hardening server.cfg: rate limiters

This is the layer most owners do not know exists — and the most effective defence against event floods. A FiveM server has built-in rate limiters using a token bucket algorithm. Each limiter has a rate (tokens per second) and a burst (maximum tokens).

The main limiters and their documented defaults:

  • challenge (handshake / connection): 4 tokens/s · 10 burst
  • netEvent: 50 tokens/s · 200 burst
  • netEventFlood: 75 tokens/s · 300 burst
  • stateBag: 75 tokens/s · 125 burst
  • stateBagFlood: 150 tokens/s · 175 burst
  • rcon: 2 tokens/s · 5 burst

You change them like this:

set rateLimiter_netEvent_rate 40
set rateLimiter_netEvent_burst 150

How should they be tuned? The defaults are reasonable for most servers. Changing them carries risk in both directions: too loose and you stay exposed to floods; too tight and legitimate players can no longer trigger events and your scripts break. The correct method is to log a normal busy evening first, see your real event volume, and set the limit a sensible margin above it.

The challenge limiter is directly effective against connection floods; lowering it helps when an attacker exhausts the server with repeated connection attempts.

Identity, connection and privacy settings

Other security variables configured in the same file:

sv_endpointPrivacy

set sv_endpointPrivacy true — hides player IP addresses from the public reports the server outputs. This matters for stopping one player on your server from harvesting other players' IPs and attacking them. On roleplay servers, player-targeted attacks are more common than people assume.

sv_scriptHookAllowed

Defaults to false and should stay that way. In the official documentation's words, enabling it is not recommended — it makes the server vulnerable to security issues.

sv_authMinTrust and sv_authMaxVariance

Both take an integer from 1 to 5. sv_authMinTrust (default 1) expresses how unlikely it is for a user's identity to be spoofed by a malicious client; sv_authMaxVariance (default 5) expresses how likely the identity is to change. Tightening them makes connection attempts with throwaway accounts harder — but overly strict values can lock out legitimate players, so change them gradually.

Connection timeouts

On the Enhanced edition, sv_clientConnectingTimeoutMilliseconds (default 60,000 ms) and sv_clientConnectedTimeoutMilliseconds (default 120,000 ms) limit how long half-open and dead connections hold resources. Lowering the first helps on servers seeing connection floods.

sv_pureLevel

Not directly a DDoS control but important for integrity. Level 1 blocks most modified client files while allowing known graphics mods and audio files; level 2 blocks all modified client files. In practice, starting at level 1 and testing with real players generates far less support load than jumping straight to 2. Note that pure mode is not an anti-cheat — it does not replace server-side permission checks, secure events or logging.

rcon_password

If you do not use RCON, keep it disabled. If you do, set a strong and unique password; a default RCON password hands over the entire server.

The script layer: the most neglected defence

Network protection and rate limiters stop volume; but a single badly written script lets an attacker take your server down with one player. The core principle of Cfx.re's official security guidance is blunt: nothing on the client can be trusted, because a cheating client can manipulate it.

Registering events correctly

  • AddEventHandler — use this when the event is only triggered within the same context (server-to-server or client-to-client). It cannot be triggered over the network, so it cannot be abused that way.
  • RegisterNetEvent — required when the event crosses contexts (client → server). But that also means cheating clients can trigger it.

To verify server-side that a call really came from the server, the official documentation recommends the check if source ~= 65535 then return end; the server sends netid 65535 for its own events.

Server-side validation

On every net event, validate these using server-side methods, never the value sent by the client:

  • The player's money and inventory
  • Position coordinates (are they actually near the reward point?)
  • Job and permission state — via IsPlayerAceAllowed()
  • Quantity limits (a client can claim "1000 items")

The classic mistake is processing a client-sent "I completed the job, give me the reward" event without validation. A client triggering that hundreds of times per second wrecks your economy and hammers your database.

State bags

State bags share data between resources and are open to abuse. Enforce size limits on updates (there is a 16 KB ceiling), monitor changes with onStateBagChange, and log suspicious activity.

ACE permissions

Apply least privilege: grant permissions such as state_bag.write and entity.control only to groups you trust. A permission left open to everyone is enough for one malicious player to lock up the server.

OneSync, capacity and resource load

OneSync, the server-side synchronisation system, supports up to 2048 players (free up to 48 slots; higher tiers require a subscription through the Cfx portal). Its security-relevant feature is entity and player culling: by default, data for entities outside a 424-unit radius around each player is not transmitted. This meaningfully reduces both bandwidth and processing load.

Routing buckets let you split the world into isolated instances where players only see entities in their own bucket — valuable for both performance and isolation on multi-mode servers.

One caveat: scope events carry scaling performance costs. The official documentation recommends preferring state bags for triggering updates where possible.

Firewall and operating system

At the server level:

  • Configure the firewall default-deny; open only 30120 (TCP+UDP) and your management access.
  • Do not expose txAdmin or database ports to the internet; restrict by source IP if you must.
  • Apply per-source UDP packet rate limits. A legitimate FiveM client does not exceed a few hundred packets per second; sources well above that can be filtered.
  • Disable root and password login over SSH and move to key-based authentication.
  • Keep system updates and automatic security patches enabled.

If you have just taken delivery of a server, follow our first 10 steps to secure a new VDS.

Monitoring and what to do during an attack

Since most attacks end within minutes, preparation is everything. Set up in advance:

  • Threshold alerts on bandwidth, packet rate and CPU — you need to notice an attack in minutes, not hours.
  • Tick time and resource load monitoring (resmon), so a "lag" complaint can be attributed to network or script.
  • Regular, tested backups.

When an attack hits:

  • Do not reboot in a panic — it usually makes things worse and risks player data.
  • Confirm your provider's protection is actually engaged.
  • Identify the target port and protocol: game port, web, or is CPU climbing while traffic looks normal? If it is the third, the problem is in your scripts, not the network.
  • If an event flood is suspected, check player logs — the attack usually comes from a connected player.
  • After it ends, archive the logs and record the vector used. That is your preparation for next time.

Eight common mistakes

  • Treating Cloudflare as game-port protection. Valuable for the web, not for UDP game traffic.
  • Counting a null-routing provider as "DDoS protected." The attack stops because the server does.
  • Trusting "anti-DDoS scripts" downloaded from forums. A script cannot stop a network-layer attack.
  • Never touching rate limiters — or the opposite, tightening them without measuring and locking out real players.
  • Leaving the txAdmin panel open to the internet.
  • Not validating net events server-side. One unprotected event is enough to take the server down with one player.
  • Enabling sv_scriptHookAllowed.
  • Hosting on shared resources. A neighbour's attack lands in your tick time.

Nubitro FiveM servers

Nubitro FiveM infrastructure: 200 Tbps+ DDoS protection including UDP, Ryzen 9 9950X, NVMe M.2 SSD, Istanbul location

The first of the four layers above — network-level protection — depends entirely on your provider. Nubitro's infrastructure provides 200 Tbps+ DDoS protection as standard, and it covers UDP traffic as game servers require.

Servers run on AMD Ryzen 9 9950X processors in Istanbul, Turkey, with NVMe M.2 SSD storage and 1 Gbps unmetered traffic. Because resources are assigned through hardware partitioning, an attack on a neighbouring customer does not land in your tick time — in a DDoS context, that design decision matters as much as the protection itself.

Review the plans on our FiveM server hosting page, see ESX vs QBCore vs Qbox for the framework decision, and our game server hosting guide for general sizing. For everything else, visit the Nubitro homepage.

Frequently Asked Questions

Can I hide my FiveM server's IP?

Not really. Appearing in the server list requires publishing your address. Proxy or tunnel setups that mask the real IP exist, but they add latency and a configuration mistake causes leaks. For most servers the right approach is not hiding the IP but running on a protected one.

Does the free Cloudflare plan protect FiveM?

No. Standard Cloudflare services are for HTTP/HTTPS; game traffic flows over UDP on port 30120 and falls outside that protection. Use it for your website and forum — the game port needs network-level protection.

Traffic looks normal but the server lags. Is this DDoS?

Probably not a classic volumetric attack. Two possibilities: a netcode/amplification attack, or an event/state bag flood from inside. Measure with resmon to find which resource is eating tick time, and check the logs of players connected at that moment.

Should I lower the rate limiter values?

Not without measuring. The defaults are reasonable for most servers. Observe your real event volume over a normal busy evening first, then set the limit a sensible margin above it. Over-tightening blocks your own players, not the attacker.

Will an anti-cheat protect me from DDoS?

No — these are different problems. Anti-cheat deals with cheating clients; volumetric attacks are stopped at the network layer. But good server-side validation and rate limiting reduce both cheating and event floods — that is where they overlap.

Should I shut the server down during an attack?

Usually not. Shutting down is the attacker achieving their goal, and it risks player data. If protection is working, you may see some added latency but the service stays up. Shutting down is only worth considering if data integrity is at risk.

I run a small server — would I be a target?

Yes. In the FiveM scene the motivation is competitive rather than commercial; a member of a rival community can buy an attack to take a 30-player server down at prime time. Size offers no protection.

Summary

  • FiveM defence has four layers: network protection, server.cfg, script code and firewall.
  • Your IP is published in the server list, and game traffic runs over UDP.
  • Gaming takes ~19% of DDoS attacks; 56% of network attacks are UDP floods.
  • The four attack types are stopped in different places: volumetric, netcode, HTTP and event/state bag floods.
  • Event floods come from inside and no network filter can see them.
  • The default port is 30120 and both TCP and UDP must be open.
  • Null-routing is not protection; scrubbing is required.
  • 90.6% of attacks end within 10 minutes, so protection must be automatic.
  • Cloudflare's standard services do not cover the game port.
  • FiveM's token-bucket rate limiters are the most effective internal defence against event floods.
  • sv_endpointPrivacy true hides player IPs; sv_scriptHookAllowed should stay disabled.
  • Trust nothing from the client; validate everything server-side.
  • Apply least privilege to ACE permissions.
  • On shared resources, a neighbour's attack lands in your tick time.
Powered by WISECP
💬
Top