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:
- Alice, bob and carol start a game, (no matter if lobby or rated)
- Bob disconnects
- Eve notices that there are less players connected than the list displays
- Eve tries to join the game, but can't connect as the game already started
- Eve clicks on multiplayer -> join. The IP address is the one of alice' game
- Eve tries to connect with one of the names (including the rating as that's part of the name)
- 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.
Note:
See TracTickets
for help on using tickets.