Reject invalid orders from unvalidated clients.
This commit is contained in:
@@ -25,6 +25,7 @@ namespace OpenRA.Server
|
||||
public int ExpectLength = 8;
|
||||
public int Frame = 0;
|
||||
public int MostRecentFrame = 0;
|
||||
public bool Validated;
|
||||
|
||||
public long TimeSinceLastResponse { get { return Game.RunTime - lastReceivedTime; } }
|
||||
public bool TimeoutMessageShown = false;
|
||||
|
||||
@@ -361,6 +361,8 @@ namespace OpenRA.Server
|
||||
PreConns.Remove(newConn);
|
||||
Conns.Add(newConn);
|
||||
LobbyInfo.Clients.Add(client);
|
||||
newConn.Validated = true;
|
||||
|
||||
var clientPing = new Session.ClientPing { Index = client.Index };
|
||||
LobbyInfo.ClientPings.Add(clientPing);
|
||||
|
||||
@@ -477,6 +479,23 @@ namespace OpenRA.Server
|
||||
|
||||
void InterpretServerOrder(Connection conn, ServerOrder so)
|
||||
{
|
||||
// Only accept handshake responses from unvalidated clients
|
||||
// Anything else may be an attempt to exploit the server
|
||||
if (!conn.Validated)
|
||||
{
|
||||
if (so.Name == "HandshakeResponse")
|
||||
ValidateClient(conn, so.Data);
|
||||
else
|
||||
{
|
||||
Log.Write("server", "Rejected connection from {0}; Order `{1}` is not a `HandshakeResponse`.",
|
||||
conn.Socket.RemoteEndPoint, so.Name);
|
||||
|
||||
DropClient(conn);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
switch (so.Name)
|
||||
{
|
||||
case "Command":
|
||||
@@ -493,9 +512,6 @@ namespace OpenRA.Server
|
||||
break;
|
||||
}
|
||||
|
||||
case "HandshakeResponse":
|
||||
ValidateClient(conn, so.Data);
|
||||
break;
|
||||
case "Chat":
|
||||
case "TeamChat":
|
||||
case "PauseGame":
|
||||
|
||||
Reference in New Issue
Block a user