Expand description
An implementation of the World of Warcraft flavor of SRP6 used for authentication with the Login Server. This should work on all versions from 1.2 to 3.3.5.
The implementation is intended to abstract away as much of the protocol as possible, and limits itself to the specific requirements of the World of Warcraft implementation. For example, all key sizes are limited to exactly 32 bytes since the network packet fields describing public keys are of a fixed size in the protocol and key sizes of any other sizes are not possible.
This crate does not deal with parsing the network packets necessary to obtain the required parameters.
The WoWDev
wiki (archive) contains a reference list of packets
and the examples implement the required functionality.
THIS SHOULD NOT BE USED FOR ANYTHING OTHER THAN WORLD OF WARCRAFT EMULATION. THE CODE IS NOT CRYPTOGRAPHICALLY VERIFIED, HAS VERY LOW KEY SIZES BECAUSE OF PACKET REQUIREMENTS AND MOST LIKELY CONTAINS EXPLOITS.
§Usage
The crate is split into:
- A
server
module containing structs for use on the server. Eithersrp-fast-math
orsrp-default-math
must be enabled to for this to be enabled. - A
client
module containing structs for use on the client. Eithersrp-fast-math
orsrp-default-math
must be enabled to for this to be enabled. - A
vanilla_header
module containing structs for decrypting Vanilla world packets. - A
tbc_header
module containing structs for decrypting TBC world packets. - A
wrath_header
module containing structs for decrypting Wrath world packets.wrath-header
must be enabled for this to be enabled. - An
error
module for errors that are shared by all modules. - A
normalized_string
module used for all modules to correctly handle strings.
§Examples and Tests
The wow_messages
repo has examples that uses the
wow_login_messages
and wow_world_messages
library message definitions to showcase both crates.
These can also be used for testing that the crate works with real clients.
§Usage
Add the following to your Cargo.toml
:
[dependencies]
wow_srp = { version = "0.7.0", features = ["srp-default-math", "tbc-header", "wrath-header"] }
Then go to either the client
module or server
module for specific instructions.
§Features
Two different arbitrary precision integer libraries can be used, either:
-
num-bigint. A slow pure Rust implementation without external dependencies. It is enabled through the
srp-default-math
feature. This is enabled by default, and requires no opt in. -
rug. A fast wrapper around the GMP library with external dependencies, as described in the
gmp_mpfr_sys
documentation. This is enabled with thesrp-fast-math
feature and disabling default features. So instead of the above do this:
[dependencies]
wow_srp = { version = "0.7.0", default-features = false, features = ["srp-fast-math", "tbc-header", "wrath-header"] }
The srp-fast-math
feature leads to a 50% decrease in total time. It is highly recommended to enable
this feature for production usage since it also theoretically has better security.
To see the performance difference on your setup you can run cargo bench
for the default version,
and cargo bench --features srp-fast-math --no-default-features
for the srp-fast-math
version.
The wrath-header
feature gates features and dependencies related to wrath_header
.
The tbc-header
feature gates features and dependencies related to tbc_header
.
§MSRV
wow_srp
has a Minimum Supported Rust Version (MSRV) of 1.57.0.
The MSRV may be increased in PATCH
versions before wow_srp
reaches 1.0.0
(MAJOR.MINOR.PATCH
).
§Other implementations
- Ember is a C++ implementation for 1.12 with a clean, tested implementation of the protocol.
ArcEmu
is a C++ implementation for 3.3.5.- vMangos is a C++ implementation.
WoWCore
is a Pascal implementation that has 1.12, 2.4.3 and 3.3.5 versions.- Shadowburn is an Elixir implementation.
Modules§
- client
srp-default-math
orsrp-fast-math
Contains all functionality related to the client part. - The various errors that can happen during the SRP6 process.
- Functionality for keeping strings in a format the client expects.
- server
srp-default-math
orsrp-fast-math
Contains all functionality related to the server part, including the generation of values for the database. - tbc_header
tbc-header
Functionality for encrypting/decrypting World Packet headers. - Functionality for encrypting/decrypting World Packet headers.
- wrath_header
wrath-header
Functionality for encrypting/decrypting World Packet headers.
Structs§
- Represents a public key for both the client and server.
Constants§
- Called
g
in RFC2945. Statically set to 7. Used for generating the public keys for both server and client, and the session key. The length in bytes is always 1 since there are no generators greater than 255. - The length in bytes for GENERATOR. Will always be 1 since there are no generators greater than 255. Constant is provided here since the CMD_AUTH_LOGON_CHALLENGE packet requires it.
- Static large safe prime (
N
) value. The big endian version ofLARGE_SAFE_PRIME_LITTLE_ENDIAN
. This version should not be sent over the network and should generally not be used. - The size in bytes of the large safe prime.
- Static large safe prime (
N
) value. The little endian version ofLARGE_SAFE_PRIME_BIG_ENDIAN
. This is the version that should be sent over the network in the CMD_AUTH_LOGON_CHALLENGE_Server packet. - Password verifier size in bytes.
- Length of a proof in bytes.
- Length in bytes for both client and server public key.
- The size of the reconnect challenge data in bytes.
- The salt is always 32 bytes since the client expects a 32 byte salt field in the CMD_AUTH_LOGON_CHALLENGE_Server packet and will use leading zeros in the calculation.
- Size of the session key in bytes.