Removed stat hack configs and permissions, added hardcoded limits due to crash exploit potential from abnormal stats. Also added hardcoded limits of player damage and killme due to crash exploits.

This commit is contained in:
Zidonuke Ghost 2013-10-06 02:56:55 -04:00
parent b958b43f9b
commit 3f956801f8
5 changed files with 20 additions and 27 deletions

View file

@ -1315,9 +1315,9 @@ namespace TShockAPI
if (args.Player.FirstMaxHP == 0)
args.Player.FirstMaxHP = max;
if ((max > TShock.Config.MaxHealth && max > args.Player.FirstMaxHP) && !args.Player.Group.HasPermission(Permissions.ignorestathackdetection))
if (cur < 0 || cur > 500 || max < 100 || max > 500) //Abnormal values have the potential to cause infinite loops in the server.
{
TShock.Utils.ForceKick(args.Player, "Hacked Client Detected.", true);
TShock.Utils.ForceKick(args.Player, "Crash Exploit Attempt", true);
return false;
}
@ -1333,9 +1333,6 @@ namespace TShockAPI
args.Player.Heal(args.TPlayer.statLifeMax);
}
if (cur <= 0)
TSPlayer.All.SendData(PacketTypes.PlayerKillMe, "attempt at aboose", args.TPlayer.whoAmi);
return false;
}
@ -1351,9 +1348,9 @@ namespace TShockAPI
if (args.Player.FirstMaxMP == 0)
args.Player.FirstMaxMP = max;
if (max > TShock.Config.MaxMana && max > args.Player.FirstMaxMP)
if (cur < 0 || cur > 400 || max < 20 || max > 200) //Abnormal values have the potential to cause infinite loops in the server.
{
TShock.Utils.ForceKick(args.Player, "Hacked Client Detected.", true);
TShock.Utils.ForceKick(args.Player, "Crash Exploit Attempt", true);
return false;
}
@ -1567,11 +1564,6 @@ namespace TShockAPI
TShock.Utils.ForceKick(args.Player, "Blank name.", true);
return true;
}
if (TShock.HackedStats(args.Player) && !args.Player.Group.HasPermission(Permissions.ignorestathackdetection))
{
TShock.Utils.ForceKick(args.Player, "You have hacked health/mana, please use a different character.", true);
return true;
}
if (!args.Player.Group.HasPermission(Permissions.ignorestackhackdetection))
{
@ -2495,6 +2487,13 @@ namespace TShockAPI
var direction = args.Data.ReadInt8();
var dmg = args.Data.ReadInt16();
var pvp = args.Data.ReadInt8() == 0;
if (dmg > 20000) //Abnormal values have the potential to cause infinite loops in the server.
{
TShock.Utils.ForceKick(args.Player, "Crash Exploit Attempt", true);
return false;
}
if (OnKillMe(id, direction, dmg, pvp))
return true;
int textlength = (int) (args.Data.Length - args.Data.Position - 1);
@ -2944,6 +2943,12 @@ namespace TShockAPI
var pvp = args.Data.ReadBoolean();
var crit = args.Data.ReadBoolean();
if (dmg > 10000) //Abnormal values have the potential to cause infinite loops in the server.
{
TShock.Utils.ForceKick(args.Player, "Crash Exploit Attempt", true);
return false;
}
if (OnPlayerDamage(id, direction, dmg, pvp, crit))
return true;