Repository navigation
Anti Cheat Features
ServerGuard ships with several rules that detect and (optionally) escalate to auto-ban. Each rule fires events to the admin Discord channel and accumulates strikes if its countAsViolation flag is true.
event → log line → admin Discord post → strike (if rule counted)
→ auto-ban (if strikes ≥ threshold)
violationThreshold (default 3) sets how many strikes for the same rule before auto-ban fires. Rules with countAsViolation: false still log + post events but never lead to ban.
When auto-banned, the player is also kicked. Pardon via sg pardon <steamid>.
The player connected without the companion plugin (or it failed to respond in time).
-
Triggered by: No
ServerGuard_ManifestRPC reply withincompanionTimeoutSeconds. - Default: Not counted (already kicked at the door).
-
Setting:
requireCompanion: true(keep ON).
The companion's reply failed signature verification. Usually means the player's client.yaml has a wrong sharedSecret (common new-player issue).
- Default: Not counted.
- Public Discord wording: "wrong password".
A mod listed in required_mods wasn't in the player's manifest.
- Default: Not counted.
The player ran a mod not in required_mods or allowed_mods (and allowUnlisted: false).
- Default: Not counted.
The player ran a mod listed in banned_mods.
- Default: Not counted.
A required mod's DLL hash didn't match the pinned |sha256 suffix. The player has the right mod but a different version.
- Default: Not counted.
A SteamID tried to register more distinct character names than characterLimit allows. Stops alt-character abuse on single-character servers.
- Default: Counted.
-
Setting:
characterLimit: 1(raise for free-character servers). -
Resetting a player: the registered names live in
registrations.yamland the strikes inviolations.yaml, and both are kept in memory while the server runs. To let someone start over, runsg unregister <steamid>(orsg unregister <steamid> <character>for one name),sg pardon <steamid>, andsg unban <steamid>if they were auto-banned. Hand-editing the two files also works — they are hot-reloaded — butsg unbanalone is not enough: the next login still counts as a strike against the old names.
The player typed a cheat-flagged console command (or devcommands itself). Blocked client-side by the companion; reported here.
- Default: Counted.
-
Setting:
enableDevcommandGate: true. -
Notes: Blocked even when this toggle is
false— the toggle only controls server-side accounting.
The player moved faster than speedCheckMaxMetersPerSecond for speedCheckConsecutiveStrikes consecutive samples.
- Default: Counted.
-
Settings:
enableSpeedCheck,speedCheckMaxMetersPerSecond(default 70 since 2.0),speedCheckSampleSeconds(default 1),speedCheckConsecutiveStrikes(default 3),speedCheckTeleportToleranceMeters(default 60). - False-positive defenses: Vertical motion is ignored (jumping/falling doesn't count). Big single-sample jumps (portal/stone) reset the strike counter. Lag spikes need to sustain for N seconds before flagging.
- Tuning: Modded mounts and skills may legitimately push speed higher — raise the threshold rather than disabling.
Server-side check on Inventory.AddItem:
-
IllegalItem— item name not in ObjectDB (catches spawned junk or mods the server doesn't run). -
StackOverflow— stack exceedsm_maxStackSize * inventoryCheckStackTolerance. -
Default: Both not counted.
-
Settings:
enableInventoryCheck,inventoryCheckLogOnly(defaulttrue— just log, don't reject),inventoryCheckStackTolerance(default 1.0). -
Caveat: Catches items flowing through server-authoritative paths. Client-side
spawncheats are caught byDevcommandAttemptinstead.
The player tried to cancel an attack-recovery animation with an emote — the classic Valheim attack-spam exploit.
- Default: Not counted.
-
Setting:
enableAnimationCancelGate: true. - Notes: The companion blocks the cancel client-side (the emote silently fails). This toggle controls server-side accounting.
-
Sheathing is not part of this rule. Holstering your weapon mid-attack is ordinary play — weapon swaps, picking up items, opening chests and building all do it — so it is neither blocked nor reported. Servers still running an older companion on some clients are covered too: the server discards
sheathereports on arrival.
Valheim 1.0 keeps its own record of cheating, built for achievements: every item that
came out of spawn (and everything crafted, smelted, cooked or looted from it) carries
a hidden "cheated" mark; a piece built with nocost or with marked materials is marked;
a creature hit by a player in god, ghost or fly mode is marked. The item mark is saved in
the character file, so gear spawned in a single-player world arrives on your server
still marked. ServerGuard reads all of this.
-
CheatedItem — the client reports every marked item in the player's inventory on
spawn, whenever the set changes, and every minute. What happens is
cheatTaintPolicy:log(default) posts to the admin channel;stripalso removes the items on the spot (the player sees "cheat-spawned item(s) removed by server policy");violationalso records a strike. The character's permanent "used dev commands" mark and thebypasscheatcheckskey (which switches the game's marking off) are each reported once per session. -
Bypass key — the console command
yesiuseddevcommandsbutiwantmyachievementsanywaysets thebypasscheatcheckskey on the character, after which the game marks nothing that character does — so items spawned in single-player arrive unmarked and every rule above is blind for them.cheatTaintBypassPolicydecides what to do:log(default) posts to the admin channel once per session;kickalso disconnects the player with a message explaining why. The key is saved in the character file, so a kicked player is refused until they log in with a character that has never run the command. Nothing is written to the character and no strike is recorded. -
CheatedBuild — a placed piece was marked. The client says so in its build report,
the build log gets a
cheatedcolumn, and the server checks the piece itself in the world a few seconds later so a lying client is contradicted by the world state. - DebugFly — the player's character reports debug fly. Read by the server directly; nothing to trust.
Owners are exempt. Moderators are reported unless cheatTaintExemptModerators: true —
and since a moderator can never be granted fly or debugmode, a flying moderator is
always reported. All three rules start as informational in countAsViolation.
Every player sees a one-time notice panel on their first login after launching the game
(not on a relog) explaining that cheat detection is on and what the consequence is under
the server's current cheatTaintPolicy. Change its wording with cheatTaintNoticeTitle and
cheatTaintNoticeText (see Configuration).
Limits: this is the game being honest about itself. A modified client never sets the
mark — attestation is still what keeps those out. Valheim also auto-marks any item over
10000 total damage, so add such modded weapons to cheatTaintIgnoredItems. And a
crafting station built with nocost marks everything crafted at it, forever — if an
owner builds event infrastructure with cheats, expect the players who use it to show up
in the log.
The companion's periodic skill report contained a level above skillCapMaxLevel + skillCapTolerance.
- Default: Not counted.
-
Settings:
enableSkillCap,skillCapMaxLevel(default 100),skillCapTolerance(default 5). - Tuning: Some modded skill systems legitimately allow higher caps — raise the max.
| If you want… | Do this |
|---|---|
| Soft launch / log-only mode |
enforce: false. All rules log and post events but nobody gets kicked. |
| Strict server, fast escalation | All countAsViolation: true, violationThreshold: 2. |
| Lenient anti-cheat | Default values. Most rules are informational; only DevcommandAttempt, SpeedHack, CharacterNameLimitExceeded escalate. |
| Hash-pinned modpack | Use ` |
Several rules are enforced by the companion plugin (DevcommandAttempt, AnimationCancel, SkillOverflow). A player could in theory modify the companion to disable these checks. Two defenses:
-
requireCompanion: true— no companion at all = kicked. -
Hash-pinned
required_mods— modifying the companion changes its DLL hash →HashMismatchkick.
The mods_for_allowed_mods.yaml exported by the companion is hash-pinned by default, so this happens automatically.
- Configuration — every anti-cheat setting.
- Discord Integration — where violation events appear.
-
Admin Commands —
sg whois,sg violations,sg pardon.