Login: Difference between revisions

From wowdev
Jump to navigation Jump to search
(Add sequence diagram of login process)
(Split page into a section for each login phase)
Line 1: Line 1:
For a client to be able to join a server and select a character, it first has to
{{Template:SectionBox/VersionRange|max_expansionlevel=2|note=Only tested on 1.12.1.5875. Possibly valid until late Wrath}}
login through the login server and set up a ''session key''. This session key
will be used later to secure (in a very weak way) the messages between the world
server and the client. The authentication is made with the SRP protocol.


[[File:login-sequence-diagram.png|400px|thumb|right|Sequence diagram of the login process. The login server and world server do not have to be separate, but the client expects two separate hosts.]]
[[File:login-sequence-diagram.png|thumb|right|Sequence diagram of the login process. The login server and world server do not have to be separate, but the client expects two separate hosts.]]
 
Login can be thought of as three separate steps for the client:
 
# Entering a username/password and getting to the realm list.
# Selecting a realm and getting to the character screen.
# Selecting a character and getting into the world.
 
Each step builds upon the previous and it is possible to go backwards in the process.
 
The client only expects connections to two different servers:
* The Login Server (default port 3724) which handles initial login using [[Login Packet]]s.
* The World Server (default port 8085) which handles the character screen and gameplay on the realm using [[World Packet]]s.
 
= Realm List =
 
Authentication with the login server happens through a variant of the [https://en.wikipedia.org/wiki/Secure_Remote_Password_protocol SRP6 protocol] using [[Login Packet]]s.
This allows the client and server to prove to each other that they both know the same password without revealing what the password is to eavesdroppers.
The client and server can use this shared secret to create a session key which is used for encrypting the headers of [[World Packet]]s when connecting to the World Server.


Login message exchange:
Login message exchange:
Line 32: Line 47:


* [https://www.ietf.org/rfc/rfc2945.txt SRP6 RFC]
* [https://www.ietf.org/rfc/rfc2945.txt SRP6 RFC]
* [https://en.wikipedia.org/wiki/Secure_Remote_Password_protocol Wikipedia page]
 
* An overview of the [[Login Packet]]s.
= Character Screen =


When connecting to a realm the client starts a TCP connection to the string specified in the realm list address and then:
When connecting to a realm the client starts a TCP connection to the string specified in the realm list address and then:


# The client waits for the server to send [[SMSG_AUTH_CHALLENGE]], interrupting with [[CMSG_PING]] if no response is gotten.
# The client waits for the server to send [[SMSG_AUTH_CHALLENGE]], sending [[CMSG_PING]] every 30 seconds.
# After receiving the [[SMSG_AUTH_CHALLENGE]] the client replies with a [[CMSG_AUTH_SESSION]].
# After receiving the [[SMSG_AUTH_CHALLENGE]] the client replies with a [[CMSG_AUTH_SESSION]].
# Packets are now (weakly) encrypted from now on.
# Packet headers are now (weakly) encrypted from now on.
# The server sends a [[SMSG_AUTH_RESPONSE]].
# The server sends a [[SMSG_AUTH_RESPONSE]].
# The client sends a [[CMSG_CHAR_ENUM]].
# The client sends a [[CMSG_CHAR_ENUM]].
# The server sends a [[SMSG_CHAR_ENUM]].
# The server sends a [[SMSG_CHAR_ENUM]].
The client is now on the character screen and can:
* Create a character which will send [[CMSG_CHAR_CREATE]] and the server will respond with [[SMSG_CHAR_CREATE]]. The packet is only sent after the client has entered a name and pressed "Accept".
* Delete a character which will send [[CMSG_CHAR_DELETE]] and the server will respond with [[SMSG_CHAR_DELETE]]. The packet is only sent after the client has entered "delete" and pressed "Accept".
* Rename a character which will send [[CMSG_CHAR_RENAME]] and the server will respond with [[SMSG_CHAR_RENAME]]. The packet is only sent if the rename flag is set for the character in the [[SMSG_CHAR_ENUM]] and the client tries to login.
* Request a new character list with [[CMSG_CHAR_ENUM]] and the server will respond with [[SMSG_CHAR_ENUM]].
* Attempt to login to the world as described below.
= World =
When pressing "Enter World" the client sends a [[CMSG_PLAYER_LOGIN]] and the server responds with at least:
* A [[SMSG_LOGIN_VERIFY_WORLD]] that tells the client which map to load.
* A [[SMSG_TUTORIAL_FLAGS]].
And then a [[SMSG_UPDATE_OBJECT]] with the player. The player is now logged into the world and can move around the map.


[[Category:Login]]
[[Category:Login]]

Revision as of 20:11, 19 June 2021

This section only applies to versions ≤ BC. Only tested on 1.12.1.5875. Possibly valid until late Wrath.
Sequence diagram of the login process. The login server and world server do not have to be separate, but the client expects two separate hosts.

Login can be thought of as three separate steps for the client:

  1. Entering a username/password and getting to the realm list.
  2. Selecting a realm and getting to the character screen.
  3. Selecting a character and getting into the world.

Each step builds upon the previous and it is possible to go backwards in the process.

The client only expects connections to two different servers:

  • The Login Server (default port 3724) which handles initial login using Login Packets.
  • The World Server (default port 8085) which handles the character screen and gameplay on the realm using World Packets.

Realm List

Authentication with the login server happens through a variant of the SRP6 protocol using Login Packets. This allows the client and server to prove to each other that they both know the same password without revealing what the password is to eavesdroppers. The client and server can use this shared secret to create a session key which is used for encrypting the headers of World Packets when connecting to the World Server.

Login message exchange:

  1. Client asks for a login challenge by sending its build number and account name
  2. Server sends SRP authentication data
  3. Client sends SRP proof
  4. Server accepts this proof and send its own, or reject and close the connection

When the client is accepted by the server, it can send reconnect challenges to keep connected with the same session key.

  1. Client asks for a reconnection challenge with the same data as login challenge
  2. Server sends a reconnection challenge (16 random bytes)
  3. Client sends proof data with its own client proof
  4. Server accepts or not this proof.

To check the client proof, the server has to SHA1 the concatenation of: the account name, the proof data received, the reconnection challenge and the session key. This hash should match the client proof received to be valid.

It's worth noting that, for build 4125, the client automatically disconnect after a successful login challenge and proof exchange and sends a reconnect packet right away instead of asking for the realm list.

External resources about SRP and how to implement it:

Character Screen

When connecting to a realm the client starts a TCP connection to the string specified in the realm list address and then:

  1. The client waits for the server to send SMSG_AUTH_CHALLENGE, sending CMSG_PING every 30 seconds.
  2. After receiving the SMSG_AUTH_CHALLENGE the client replies with a CMSG_AUTH_SESSION.
  3. Packet headers are now (weakly) encrypted from now on.
  4. The server sends a SMSG_AUTH_RESPONSE.
  5. The client sends a CMSG_CHAR_ENUM.
  6. The server sends a SMSG_CHAR_ENUM.

The client is now on the character screen and can:

  • Create a character which will send CMSG_CHAR_CREATE and the server will respond with SMSG_CHAR_CREATE. The packet is only sent after the client has entered a name and pressed "Accept".
  • Delete a character which will send CMSG_CHAR_DELETE and the server will respond with SMSG_CHAR_DELETE. The packet is only sent after the client has entered "delete" and pressed "Accept".
  • Rename a character which will send CMSG_CHAR_RENAME and the server will respond with SMSG_CHAR_RENAME. The packet is only sent if the rename flag is set for the character in the SMSG_CHAR_ENUM and the client tries to login.
  • Request a new character list with CMSG_CHAR_ENUM and the server will respond with SMSG_CHAR_ENUM.
  • Attempt to login to the world as described below.

World

When pressing "Enter World" the client sends a CMSG_PLAYER_LOGIN and the server responds with at least:

And then a SMSG_UPDATE_OBJECT with the player. The player is now logged into the world and can move around the map.