Fix ∞ velocity exploit (@bartico6, @tlworks)

This commit is contained in:
Lucas Nicodemus 2021-01-28 00:17:55 -08:00
parent f4cc14fb8e
commit 355a7f02f5
4 changed files with 34 additions and 3 deletions

View file

@ -12,7 +12,14 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Do not forget to sign every line you change with your name. (@hakusaro)
* If there is no section called "Upcoming changes" below this line, please add one with `## Upcoming changes` as the first line, and then a bulleted item directly after with the first change.
## Upcoming Changes
## Upcoming changes
* This could be you!
## TShock 4.4.0 (Pre-release 16)
* Patched protocol issue. Thanks to Off (@tlworks) and @bartico6 for contributions, including packet captures, packet analysis, exploit proof-of-concept testing, patch testing, and detailed reproduction steps. (@hakusaro)
* Disabled debug by default. (@hakusaro)
## TShock 4.4.0 (Pre-release 15)
* Overhauled Bans system. Bans are now based on 'identifiers'. (@QuiCM)
* The old Bans table (`Bans`) has been deprecated. New bans will go in `PlayerBans`. Old bans will be converted automatically to the new system.
* All old ban routes in REST are now redirected. Please use `/v3/bans/*` for REST-based ban management.

View file

@ -135,6 +135,30 @@ namespace TShockAPI
var pos = args.Position;
var vel = args.Velocity;
if (Single.IsInfinity(vel.X) || Single.IsInfinity(vel.Y))
{
TShock.Log.ConsoleInfo("Bouncer / OnPlayerUpdate force kicked (attempted to set velocity to infinity) from {0}", args.Player.Name);
args.Player.Kick("Detected DOOM set to ON position.", true, true);
args.Handled = true;
return;
}
if (Single.IsNaN(vel.X) || Single.IsNaN(vel.Y))
{
TShock.Log.ConsoleInfo("Bouncer / OnPlayerUpdate force kicked (attempted to set velocity to NaN) from {0}", args.Player.Name);
args.Player.Kick("Detected DOOM set to ON position.", true, true);
args.Handled = true;
return;
}
if (vel.X > 50000 || vel.Y > 50000 || vel.X < -50000 || vel.Y < -50000)
{
TShock.Log.ConsoleInfo("Bouncer / OnPlayerUpdate force kicked (attempted to set velocity +/- 50000) from {0}", args.Player.Name);
args.Player.Kick("Detected DOOM set to ON position.", true, true);
args.Handled = true;
return;
}
if (pos.X < 0 || pos.Y < 0 || pos.X >= Main.maxTilesX * 16 - 16 || pos.Y >= Main.maxTilesY * 16 - 16)
{
TShock.Log.ConsoleDebug("Bouncer / OnPlayerUpdate rejected from (position check) {0}", args.Player.Name);

View file

@ -28,7 +28,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Re-Logic, Pryaxis & TShock Contributors")]
[assembly: AssemblyProduct("TShockAPI")]
[assembly: AssemblyCopyright("Copyright © Re-Logic, Pryaxis & TShock Contributors 2011-2020")]
[assembly: AssemblyCopyright("Copyright © Re-Logic, Pryaxis & TShock Contributors 2011-2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View file

@ -57,7 +57,7 @@ namespace TShockAPI
/// <summary>VersionNum - The version number the TerrariaAPI will return back to the API. We just use the Assembly info.</summary>
public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version;
/// <summary>VersionCodename - The version codename is displayed when the server starts. Inspired by software codenames conventions.</summary>
public static readonly string VersionCodename = "Go to sleep Patrikkk, Icy, Chris, Death, Axeel, Zaicon, hakusaro, Zack, and Yoraiz0r <3";
public static readonly string VersionCodename = "Now with less velocity, thanks to Off + Quake. Usual thanks to Chris/White <3";
/// <summary>SavePath - This is the path TShock saves its data in. This path is relative to the TerrariaServer.exe (not in ServerPlugins).</summary>
public static string SavePath = "tshock";