Skip to content

Commit 73dd260

Browse files
committed
fix clients being able to change their UUID at will
1 parent 1d7cb2e commit 73dd260

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

TerrariaServerAPI/TerrariaApi.Server/HookManager.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,14 @@ internal bool InvokeNetGetData(ref byte msgId, MessageBuffer buffer, ref int ind
470470
//We copy the bytes of the UUID then convert it to string. Then validating the GUID so its the correct format.
471471
//Then the bytes get hashed, and set as ClientUUID (and gets written in DB for auto-login)
472472
//length minus 2 = 36, the length of a UUID.
473+
//We only accept this packet during the initial connectioon state (1), and only if their current UUID is blank,
474+
//to prevent malicious clients from changing their UUID after connecting.
473475
case PacketTypes.ClientUUID:
476+
if ((Netplay.Clients[buffer.whoAmI].State != 1 || !string.IsNullOrEmpty(Netplay.Clients[buffer.whoAmI].ClientUUID)))
477+
{
478+
return true;
479+
}
480+
474481
if (length == 38)
475482
{
476483
byte[] uuid = new byte[length - 2];

0 commit comments

Comments
 (0)