Skip to content

Commit ce4ca7a

Browse files
committed
GM Command hardening
1 parent 2fe41fc commit ce4ca7a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Zolian.Server.Base/Network/Server/WorldServer.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,13 @@ bool ParseCommand()
10571057
{
10581058
if (!localClient.Aisling.GameMaster) return false;
10591059
if (!localArgs.Message.StartsWith("/")) return false;
1060+
1061+
var ipLocal = IPAddress.Parse(ServerSetup.Instance.InternalAddress);
1062+
1063+
if (!GameMastersIPs.Any(ip => client.RemoteIp.Equals(IPAddress.Parse(ip)))
1064+
&& !IPAddress.IsLoopback(client.RemoteIp) && !client.RemoteIp.Equals(ipLocal))
1065+
return false;
1066+
10601067
Commander.ParseChatMessage(localClient.Aisling.Client, localArgs.Message);
10611068
return true;
10621069
}
@@ -1275,6 +1282,7 @@ private static async ValueTask LoadAislingAsync(IWorldClient client, IRedirect r
12751282
{
12761283
var ipLocal = IPAddress.Parse(ServerSetup.Instance.InternalAddress);
12771284

1285+
// If not from GM IPs, loopback, or local IP, disconnect
12781286
if (!GameMastersIPs.Any(ip => client.RemoteIp.Equals(IPAddress.Parse(ip)))
12791287
&& !IPAddress.IsLoopback(client.RemoteIp) && !client.RemoteIp.Equals(ipLocal))
12801288
{

0 commit comments

Comments
 (0)