Opened 9 years ago

Last modified 6 years ago

#3549 closed defect

Secure authentication - prevent joins as a different player — at Initial Version

Reported by: elexis Owned by:
Priority: Release Blocker Milestone: Alpha 23
Component: Multiplayer lobby Keywords: beta
Cc: Patch:

Description

The current implementation of the NetServer allows users to join as a different player.

Reproduce:

  1. Alice, bob and carol start a game, (no matter if lobby or rated)
  2. Bob disconnects
  3. Eve notices that there are less players connected than the list displays
  4. Eve tries to join the game, but can't connect as the game already started
  5. Eve clicks on multiplayer -> join. The IP address is the one of alice' game
  6. Eve tries to connect with one of the names (including the rating as that's part of the name)
  7. After some tries, eve successfuly joins as Bob. Carol doesn't know its eve, as even the chat messages indicate it's bob.

The code we need to change for this can be found in CNetServerWorker::AddPlayer:

	// Try to match username next
	for (PlayerAssignmentMap::iterator it = m_PlayerAssignments.begin(); it != m_PlayerAssignments.end(); ++it)
	{
		if (!it->second.m_Enabled && it->second.m_Name == name && usedIDs.find(it->second.m_PlayerID) == usedIDs.end())
		{
			playerID = it->second.m_PlayerID;
			m_PlayerAssignments.erase(it); // delete the old mapping, since we've got a new one now
			goto found;
		}
	}

But notice we have this other TODO in CNetServerWorker::OnAuthenticate:

		// Search for an old disconnected player of the same name
		// (TODO: if GUIDs were stable, we should use them instead)

We might need some secure authentication token, like the jabber ID for lobbied games.

Change History (0)

Note: See TracTickets for help on using tickets.