AntiHacker
Comprehensive host security: blocks native Netcode/voice crash exploits (LobbyGuard integration), scrap deletion, remote grab abuse, lightswitch/terminal trolling, ban evasion, and economy exploits.AntiHacker v2.0.7
A comprehensive host-side security and Quality-of-Life mod for Lethal Company. AntiHacker protects your lobbies from malicious players, prevents ban evasion, blocks low-level Netcode & voice crash packets (integrating LobbyGuard protections), stops game-breaking server RPC exploits (including remote scrap deletion, item vacuuming, and ship tampering), provides instant ship recovery tools, and adds convenient ship management commands.
🛡️ Anti-Cheat, Low-Level Packet & Lobby Security
- Low-Level Netcode Packet & Crash Protection (LobbyGuard Integration):
- Pre-
HandleIncomingDataPacket Validation (BatchGuard): Inspects raw Netcode packet batches beforeFastBufferReaderis constructed, blocking the nativeUnsafeUtility.MemCpycrash caused by oversized/negativeMessageSizevalues, bad/duplicateConnectionRequestMessagepayloads, and packets from unknown/kickedtransportIds. - Host-Only Message & SceneEvent Firewall (
BatchGuard): Blocks remote clients from sending internal host-only Netcode messages (DestroyObjectMessage,CreateObjectMessage,ChangeOwnershipMessage,ParentSyncMessage,TimeSyncMessage,ClientRpcMessage, etc.), host-onlySceneEventMessagetypes (Load,Unload,Synchronize), or duplicateSynchronizeCompletejoin events. ClientRpc-via-ServerRpcSpoof Prevention (BatchGuard.OnRpcHandle): Blocks remote clients from invoking[ClientRpc]handlers disguised inside aServerRpcMessage.- Lag-Safe Early & Deferred Message Handling (
BatchGuard.OnMessage&OnDefer): Drops leftover queued messages from disconnected clients, silently drops pre-approval messages (eliminating NGO'sMessage received from senderId=X before it has been acceptedwarning spam without kicking slow-connecting players), and drops server-side deferred lookups for already-despawnedNetworkObjectIds without false-kicking lagging clients. (See LOBBYGUARD_REVIEW_AND_DESIGN.md for engineering notes on why lag-sensitive kicks were avoided). - RPC Array & String Length Guard (
LengthGuard): Injects bounds checks into all__rpc_handler_*methods so malformed array, string, orNativeArraylengths cannot cause out-of-memory crashes. - Dissonance Voice Codec Crash Guard (
VoiceGuard): Validates voice handshake and client state codec parameters (Opus48kHz /Identity44.1kHz) before the host broadcasts them, preventing audio decoder buffer crashes. - Packet & Message Flood Protection: Automatically disconnects clients exceeding
2,000packets/sec or20,000batched messages/sec.
- Pre-
- Unspoofable Socket-Verified Steam ID (
SteamNetworkingSockets):- Queries
SteamNetworkingSockets.Internal.GetConnectionInfodirectly from the underlying Facepunch transport connection (alongside Steam lobby join events) to determine the cryptographically proven Steam ID for every client. Anyone attempting to join with a spoofed Steam ID in their connection payload is rejected and autobanned.
- Queries
- Ban Evasion Prevention: When you kick a player from your lobby, they are immediately added to the ban list and blocked from reconnecting.
- Duplicate & Impersonation Protection: Blocks clients attempting to connect using a Steam ID that is already active in the session.
- Persistent Blocklist: Kicked/banned Steam IDs are automatically saved to
AntiHacker_KickList.txtso repeat offenders stay blocked across game restarts. - Built-in & Custom Blacklists: Includes a built-in blacklist of known griefers, plus a configurable
ExtraBlacklistsetting to add your own comma-separated Steam IDs. - Dynamic Vanilla Lobby Detection: If AntiHacker is the only mod installed, your lobby can appear in the vanilla server list. If other mods are present, it marks the lobby as modded (can also be forced to vanilla via
ForceVanillaLobby).
🔒 Server RPC Guards (Host-Side Exploit Prevention)
Cheaters often send unauthorized Server RPCs to crash or ruin the lobby. AntiHacker inspects incoming network calls from remote clients:
- Scrap Deletion & Unheld Throw Exploit Protection:
- Blocks remote clients from invoking
ThrowObjectServerRpcorPlaceObjectServerRpcon items they are not currently holding on the server. - Prevents hackers from remotely stripping
isInShipRoom = falseon scrap before ship takeoff (which causes vanillaRoundManagerto despawn all scrap upon orbit). - Blocks malicious re-parenting of scrap onto outdoor moon objects/enemy nests.
- Automatically enforces
isInShipRoom = trueandisInElevator = trueif an item is dropped inside the ship's inner cabin, preventing spoofed outside drops.
- Blocks remote clients from invoking
- Ship Scrap Lock (
LockShipScrapUntilCompany):- Remote clients cannot pick up items with scrap value (
scrapValue > 0) once they are inside the ship cabin, unless the ship is at the Company Building (71 Gordion) to sell. Host can always move scrap at any time. - Utility/fun exceptions that remain grabbable inside the ship: Keys, Whoopie Cushions, Easter Eggs, Homemade Flashbangs, Clipboard/Sticky Note, and Dead Player Bodies.
- Remote clients cannot pick up items with scrap value (
- Ship-Item Grab Rate Limiter (
MaxShipGrabsPerSecond):- Limits how fast remote clients can grab items marked inside the ship (default: 3 grabs/sec).
- Rate limiting is automatically disabled while on the Company Building moon so your crew can quickly unload scrap at the counter.
- Client grab animations are cleanly rejected without desyncing player hands.
- Ship Furniture, Light Switch & Terminal Protection:
- Light Switch Lockout: Remote clients cannot move or store the ship Light Switch in build mode.
- Terminal Protection: Prevents remote clients from moving or storing the ship Terminal.
- Protected Upgrades: Prevents remote clients from storing essential ship equipment (
Teleporter,Inverse Teleporter). - Void Placement Blocking: Blocks remote clients from placing objects below
y <= -100(void/hiding exploits) or outside ship bounds.
- ChangeLevel Exploit Protection: Prevents malicious clients from sending invalid moon/level IDs (a common exploit used to freeze the ship in permanent hyperspace). Attackers are immediately autobanned and disconnected.
- Credit & Economy Safeguards: Validates all client-initiated credit changes (
SyncGroupCreditsServerRpc,BuyItemsServerRpc,BuyVehicleServerRpc,BuyShipUnlockableServerRpc). Drops illegitimate balance increases and autobans negative or wildly manipulated credit amounts. - Unlockable & Storage Validation: Prevents remote clients from requesting invalid unlockable IDs.
- Ship Lever Protection (
AllowClientStartEnd): Host-configurable option to prevent clients from pulling the start/landing lever or manually ejecting the crew. When disabled, client lever attempts are safely ignored. - Hidden Debug RPC Blocking: Instantly blocks and autobans clients attempting to invoke internal debug RPCs (
Debug_EnableTestRoomServerRpc,Debug_ToggleAllowDeathServerRpc,Debug_ReviveAllPlayersServerRpc). - Spam & Flooding Rate Limiting: Limits object placement and storage RPCs to prevent lag machines and physics desyncs.
💻 Terminal Commands
Type these directly into the ship terminal:
| Command | Who | Description |
|---|---|---|
fixship |
Host only | Clears a stuck travel lock left behind by an exploited or interrupted ChangeLevel, re-enabling the start lever and terminal. |
money <amount> |
Host only | Disabled by default; recovery tool only (enable with EnableMoneyCommand). Intended solely for repairing credits a hacker has tampered with. Sets group credits (e.g. money 500). Can also adjust relatively (e.g. money +250 or money -100). |
clean all |
Host only | Automatically sends all eligible ship furniture/decor to storage (skips items containing scrap, light switch, and the terminal). |
clean <name> |
Host only | Sends specific furniture matching the name to storage (e.g. clean bunk, clean table). |
🛠️ Quality of Life & Build Controls
- Ship Recovery Hotkey (
F9): Host can press F9 at any time to clear a stuck ship travel lock (travellingToNewLevel), restore lever interaction, and reset terminal cooldowns. - Move / Store Terminal (
F8): Allows the host to store the ship terminal away or un-store it! Pressing F8 toggles the terminal into storage, or unstores it straight into placement mode with rotation restored. - Unstore Item Hotkey (
F6): Grabs the first item from storage and immediately enters placement mode. - Ship Lights Hotkey (
F7): Toggles the ship light switch from anywhere on the ship. - Advanced Furniture Rotation:
- While placing an object in build mode, use the Arrow Keys to rotate it in 90° increments along the X and Z axes (Up/Down for pitch, Left/Right for roll).
- Press End to reset rotation back to standard default orientation (fixes upside-down items!).
- Contextual Teleport (
F5, Optional):- Disabled by default and intended only for getting out of trouble caused by hackers (e.g. being stranded or teleported away). When enabled via
EnableTeleport, pressing F5 inside the ship uses the inverse teleporter; pressing it outside beams you back to the ship.
- Disabled by default and intended only for getting out of trouble caused by hackers (e.g. being stranded or teleported away). When enabled via
⚙️ Configuration
Configuration is located at BepInEx/config/com.invertigo.antihacker.cfg:
[AntiHacker]
LockShipScrapUntilCompany(default:true): When enabled, remote clients cannot pick up items with scrap value inside the ship unless parked at the Company Building.MaxShipGrabsPerSecond(default:3): Max rate at which remote clients can grab ship items per second.PersistKickList(default:true): Whether kicked players remain blocked across game restarts.ForceVanillaLobby(default:false): Forces your server to appear in the vanilla server list regardless of other mods.ExtraBlacklist(default:""): Comma-separated list of Steam IDs to ban on startup.AllowClientStartEnd(default:true): Iffalse, only the host can pull the start/stop lever. Remote client attempts are ignored.EnableMoneyCommand(default:false): Enables the host-onlymoneyterminal command. Off by default; only for fixing credits tampered with by hackers.RecoveryKey(default:F9): Key to un-freeze a stuck ship travel state.
[Hotkeys]
MoveTerminalKey(default:F8): Hotkey to store or unstore the terminal.UnstoreKey(default:F6): Hotkey to unstore the first item in storage and enter build mode.LightSwitchKey(default:F7): Hotkey to toggle ship lights.RotationTipEveryTime(default:false): If true, displays the rotation hint popup every time you place an object.EnableTeleport(default:false): Enable contextual F5 teleportation. Off by default; only for resolving issues caused by hackers.TeleportKey(default:F5): Hotkey for contextual teleportation.
📦 Installation
- Mod Manager (Recommended): Install via r2modman or the Thunderstore Mod Manager.
- Manual Installation: Place
AntiHacker.dllinside yourBepInEx/plugins/directory.
📜 Credits & License
- AntiHacker is developed by invertigo.
- Third-Party Credits: Low-level Netcode packet validation, bounds checking, and voice codec guards (
BatchGuard,LengthGuard,VoiceGuard) are adapted from LobbyGuard by Rethunk-Tech / Mort, licensed under the MIT License. See LICENSE for full notice details.
