From: miniduikboot Date: Thu, 27 Feb 2025 22:48:00 +0000 (+0100) Subject: Add new cheat category for InvalidObject checks X-Git-Tag: v1.10.3~6 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=fff9713697a9e074e83d04ce12b78e862f84df1b;p=rhonda%2Fimpostor.git Add new cheat category for InvalidObject checks For some network objects, like PlayerControl, we expect that there is an PlayerInfo object associated to them. If there isn't, throw an exception in this AC category --- diff --git a/docs/Server-configuration.md b/docs/Server-configuration.md index 0a882ba..c1cae38 100644 --- a/docs/Server-configuration.md +++ b/docs/Server-configuration.md @@ -25,19 +25,20 @@ Impostor has an Http Server that is used by recent versions of Among Us to conne Impostor has an Anticheat that makes it possible to kick cheaters from games automatically. Note that the anticheat is tuned on the vanilla version of the game, so client-side modifications could trigger the Anticheat if you're playing with them. -| Key | Default | Value | -|----------------------------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **Enabled** | `true` | Whether the anticheat should be enabled. | -| **BanIpFromGame** | `true` | When anticheat is enabled and a player is caught hacking, they will be kicked from the server. If this value is set to `true`, the player will be banned instead and will not be able to rejoin that specific game. | -| **AllowCheatingHosts** | `"Never"` | Configure whether hosts are allowed to cheat. "Never" forbids it, "Always" allows it. "IfRequested" allows hosts to cheat if they connect with the DisableServerAuthorityFlag set. | -| **EnableGameFlowChecks** | `true` | Enable checks that check if certain actions are done in the appropriate order or at the appropriate moment in the game. This includes changing cosmetics while in game or murdering too fast. | -| **EnableMustBeHostChecks** | `true` | Enables checks that check if players are the host before they can do actions that require them to be host of the game. This includes starting the game and spawning objects. | -| **EnableColorLimitChecks** | `true` | Enables checks that checks if players request colors that are already in use. | -| **EnableNameLimitChecks** | `true` | Enables checks that checks if player names have a length that is possible to set using the user interface. | -| **EnableOwnershipChecks** | `true` | Enables checks that check if players are allowed to perform a certain action on themself or another player. | -| **EnableRoleChecks** | `true` | Enables checks that check if players have the correct role when performing certain role abilities like venting or murdering. | -| **EnableTargetChecks** | `true` | Enables checks that check if certain packets to everyone that should only have been sent to certain players or vice versa. This includes sending votes or network objects. | -| **ForbidProtocolExtensions** | `true` | If disabled allows players to send network packets that go beyond the network packets sent by the vanilla game. This is necessary for most mods that need all players to install it. | +| Key | Default | Value | +|-------------------------------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **Enabled** | `true` | Whether the anticheat should be enabled. | +| **BanIpFromGame** | `true` | When anticheat is enabled and a player is caught hacking, they will be kicked from the server. If this value is set to `true`, the player will be banned instead and will not be able to rejoin that specific game. | +| **AllowCheatingHosts** | `"Never"` | Configure whether hosts are allowed to cheat. "Never" forbids it, "Always" allows it. "IfRequested" allows hosts to cheat if they connect with the DisableServerAuthorityFlag set. | +| **EnableGameFlowChecks** | `true` | Enable checks that check if certain actions are done in the appropriate order or at the appropriate moment in the game. This includes changing cosmetics while in game or murdering too fast. | +| **EnableMustBeHostChecks** | `true` | Enables checks that check if players are the host before they can do actions that require them to be host of the game. This includes starting the game and spawning objects. | +| **EnableColorLimitChecks** | `true` | Enables checks that checks if players request colors that are already in use. | +| **EnableInvalidObjectChecks** | `true` | Enables checks that check if network objects are spawned properly. | +| **EnableNameLimitChecks** | `true` | Enables checks that checks if player names have a length that is possible to set using the user interface. | +| **EnableOwnershipChecks** | `true` | Enables checks that check if players are allowed to perform a certain action on themself or another player. | +| **EnableRoleChecks** | `true` | Enables checks that check if players have the correct role when performing certain role abilities like venting or murdering. | +| **EnableTargetChecks** | `true` | Enables checks that check if certain packets to everyone that should only have been sent to certain players or vice versa. This includes sending votes or network objects. | +| **ForbidProtocolExtensions** | `true` | If disabled allows players to send network packets that go beyond the network packets sent by the vanilla game. This is necessary for most mods that need all players to install it. | ### Compatibility diff --git a/src/Impostor.Api/CheatCategory.cs b/src/Impostor.Api/CheatCategory.cs index bbc8740..9972268 100644 --- a/src/Impostor.Api/CheatCategory.cs +++ b/src/Impostor.Api/CheatCategory.cs @@ -26,6 +26,9 @@ public enum CheatCategory /// A packet was sent to a player that should be broadcasted, or vice versa. Target, + /// A packet was sent on an invalid network object, like a PlayerControl without PlayerInfo. + InvalidObject, + /// Legacy category for unsorted anticheat checks. Other, } diff --git a/src/Impostor.Api/Config/AntiCheatConfig.cs b/src/Impostor.Api/Config/AntiCheatConfig.cs index 2576664..b675855 100644 --- a/src/Impostor.Api/Config/AntiCheatConfig.cs +++ b/src/Impostor.Api/Config/AntiCheatConfig.cs @@ -24,6 +24,8 @@ public bool EnableTargetChecks { get; set; } = true; + public bool EnableInvalidObjectChecks { get; set; } = true; + public bool ForbidProtocolExtensions { get; set; } = true; } } diff --git a/src/Impostor.Server/Net/Client.cs b/src/Impostor.Server/Net/Client.cs index 20cd05e..2463037 100644 --- a/src/Impostor.Server/Net/Client.cs +++ b/src/Impostor.Server/Net/Client.cs @@ -73,6 +73,7 @@ namespace Impostor.Server.Net CheatCategory.Ownership => _antiCheatConfig.EnableOwnershipChecks, CheatCategory.Role => _antiCheatConfig.EnableRoleChecks, CheatCategory.Target => _antiCheatConfig.EnableTargetChecks, + CheatCategory.InvalidObject => _antiCheatConfig.EnableInvalidObjectChecks, CheatCategory.Other => true, _ => LogUnknownCategory(category), };