Files
praxisandClaude Fable 5.2 60b6d4b7a5 Design records
59 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

14 KiB

Forever → Turtle compatibility gateway: source audit

Audit date: 2026-10-14. This is a source audit, not proof of wire compatibility with build 70334. All paths below are local, read-only evidence. Working Forever world entry is reported by the operator; this project has not reproduced it.

Evidence roots

Alias Absolute path HEAD
F /home/praxis/Projects/WoW-Hybrid/servers/trinity-forever 2a7187e228e17afab8b19bf5e22dbf735488596b
T /home/praxis/Servers/tortoise-wow d94947b0db60c33e7248523ad0ba7f58af97fd09
W /home/praxis/Projects/WoW-Hybrid/references/WoWee bcf3a197c78193589f460f7d1f618ecb82d425e0
M /home/praxis/Projects/WoW-Hybrid/references/manila 7e71f725152cc2d2ba390f01fcc1a9895039d0a9

References denote the working-tree files at inspection time; HEAD alone does not capture local modifications. No code or configuration in these trees is changed.

Authentication and session separation

Forever: F/src/server/bnetserver/REST/LoginRESTService.cpp, LoginRESTService::HandlePostLogin, HandlePostLoginSrpChallenge and StartNetwork implement HTTPS login and tickets. F/src/server/bnetserver/Services/ AuthenticationService.cpp, Authentication::HandleLogon and HandleVerifyWebCredentials consume the login flow. F/src/server/bnetserver/Services/GameUtilitiesService.cpp, GameUtilities::JoinRealm returns Param_RealmJoinTicket and Param_JoinSecret. F/src/server/game/Server/WorldSocket.cpp, HandleAuthSession, HandleAuthSessionCallback parse the realm-join ticket, check build/account data, verify a SHA-256 based digest and derive session/encryption keys. SendEnterEncryptedMode and HandleEnterEncryptedModeAck establish encrypted operation. This is not the legacy realmd handshake. Preserve the existing TLS certificates, Wine prefix and RAM key-patching service; introducing an independent Forever endpoint is future work.

Turtle: T/src/realmd/AuthSocket.cpp, packed sAuthLogonChallenge_C, sAuthLogonProof_C_1_11, _HandleLogonChallenge, _HandleLogonProof, SendProof and _HandleRealmList define command-specific TCP records (commands 0x00, 0x01, 0x10), not world packet frames. Username/password are uppercase; SRP uses g=7, N=894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7, k=3. Integers are little-endian; _SetVSFields hashes the natural-length salt when deriving x; server SHA1 big-number inputs use natural lengths, while S is padded to 32 bytes before the even/odd SHA1 interleave yielding K[40]. M1 binds H(N) xor H(g), H(username), s, A, B and K; M2 binds A, M1 and K. VerifyVersion separately enforces client integrity according to server policy. PIN/geolock/build/patch rejections must be surfaced, never bypassed. T/src/realmd/RealmList.cpp ExpectedRealmdClientBuilds explicitly maps 7272 to 1.18.1; FindBuildInfo accepts higher builds too. Do not substitute generic vanilla build 5875. W/src/auth/srp.cpp SRP::feed, computeSessionKey, computeProofs corroborate the SRP arithmetic and natural-length caveat; M/crates/benilla-protocol/src/auth.rs contains ChallengeReply and login wire readers; M/crates/benilla-protocol/src/native_auth.rs logon_with_override is a reference for explicit build rejection, not evidence for 7272 support.

T/src/game/Protocol/WorldSocket.cpp WorldSocket::HandleAuthSession reads build, serverId, account cstring, client seed, SHA1(account | zero32 | clientSeed | serverSeed | K), then addon information. It sets the K header cipher before auth response. T/src/game/Anticheat/AddonHandler.cpp SessionAnticheat::ReadAddonInfo rejects absent/zero-length/uncompressible addon data and processes fingerprints. The gateway must not invent integrity attestations. The prototype requires a version hash and an addon wire tail supplied from an authorized local test setup; acceptance by real Tortoise remains to be tested. No automatic changes to integrity policy, no Warden emulation, no credentials or session keys in logs.

Framing and encryption

Property Forever Turtle
Initial world stream V2 ASCII client/server banners server auth challenge
Outer header LE uint32 size + 12-byte tag BE uint16 size
Opcode encrypted LE uint32, included in size client LE uint32; server LE uint16, included in size
Cipher AES-256-GCM on opcode and body rolling XOR/add on headers only
Compression compressed packet wrapper, deflate opcode-specific compressed object update

Evidence: F/src/server/game/Server/WorldSocket.h PacketHeader, IncomingPacketHeader; WorldSocket.cpp WorldSocketProtocolInitializer, ReadHeaderHandler, ReadDataHandler, WritePacketToBuffer. F/src/common/Cryptography/Authentication/WorldPacketCrypt.cpp Init, EncryptSend, DecryptRecv: independent counters, 12-byte IV counter plus CLNT/SRVR direction magic (0x544E4C43 / 0x52565253); counters advance even before initialization. T/src/framework/Network/MangosSocket.h ServerPktHeader, ClientPktHeader; MangosSocketImpl.h handle_input_header, iSendPacket: client size includes four opcode bytes, must be 4..10240, server size includes two. T/src/shared/Auth/AuthCrypt.cpp EncryptSend, DecryptRecv operate on four/six header bytes; independent direction state persists across packets, starts at zero. W/src/auth/vanilla_crypt.cpp VanillaCrypt::encrypt/decrypt and M/crates/benilla-srp/src/vanilla_header.rs HeaderCrypto, world_server_proof corroborate this. TCP fragmentation is independent of packet boundaries.

Opcodes and characters

T/src/game/Protocol/Opcodes_1_12_1.h (included by Opcodes.h) and Opcodes.cpp StoreOpcode: CMSG_CHAR_ENUM=0x37, SMSG_CHAR_ENUM=0x3B, CMSG_AUTH_SESSION=0x1ED, SMSG_AUTH_CHALLENGE=0x1EC, SMSG_AUTH_RESPONSE=0x1EE. F/src/server/game/Server/Protocol/ClassicOpcodes.cpp TranslateClientOpcode, TranslateServerOpcode and ClassicClientOpcodes.inc apply group/index shifts and exceptions; enum request is 0x440014 in the source comments. Those comments distinguish 70009/70245/70291 and explicitly retain hypotheses. A complete exact 70334 map is unverified. Copying retail numbers or uniformly shifting groups is insufficient. Maintain a build-specific allowlist with per-message codecs and verified fixtures before accepting client traffic.

T/src/game/Handlers/CharacterHandler.cpp HandleCharEnum writes uint8 count; T/src/game/Objects/Player.cpp Player::BuildEnumData writes raw LE GUID64, cstring name, race/class/gender, five appearance bytes, level, zone/map, XYZ floats, guild ID, flags, first-login byte, three pet uint32s and 20 five-byte visual slots (INVENTORY_SLOT_BAG_START + 1). W/src/game/packet_parsers_classic.cpp ClassicPacketParsers::parseCharEnum selects the pre-WotLK codec with no enchantment; M/crates/benilla-protocol/src/messages/roster.rs Character describes the roster. F/src/server/game/Server/Packets/CharacterPackets.cpp EnumCharactersResult::Write and operator<<(CharacterInfoBasic) write bits, uint32 counts, packed GUIDs, realm metadata, customization choices, four flag words, extended visual items, name/surname lengths and restrictions/mail data. Translation requires an appearance/data-ID mapping; no arbitrary mapping is implemented. Turtle races/classes/items not represented by Forever need an explicit supported-content policy rather than silent reinterpretation.

GUIDs and world initialization

T/src/game/ObjectGuid.h defines 64-bit GUID construction and packed GUID helpers. Character enumeration uses raw 64 bits; other messages may use a byte mask. F/src/server/game/Entities/Object/ObjectGuid.cpp operator<< writes two mask bytes and nonzero bytes of a 128-bit GUID; operator>> discards an incoming GUID if its highest type byte is missing. Keep semantic kind/realm/entry/counter in the canonical model and a bidirectional per-session identity map; never just pad a Turtle GUID to 128 bits and treat it as a valid Forever player GUID.

T/src/game/Handlers/CharacterHandler.cpp HandlePlayerLoginOpcode, HandlePlayerLogin verify character ownership and send SMSG_LOGIN_VERIFY_WORLD (map + XYZ + orientation), account data, tutorials and initial player state. T/src/game/Objects/Player.cpp SendInitialPacketsBeforeAddToMap / SendInitialPacketsAfterAddToMap send spells/actions/reputations/time and world state around map insertion. F/src/server/game/Handlers/CharacterHandler.cpp HandlePlayerLoginOpcode, HandlePlayerLogin include instance connection and LoginVerifyWorld, account timestamps, feature/timezone/season data and further initialization; F/src/server/game/Entities/Player/Player.cpp has the corresponding before/after-map methods. Object updates use different field schemas and GUIDs; movement, update masks, spell IDs, map data and login ordering need independent translation. Working character enumeration alone cannot establish world entry.

Proposed architecture and implementation boundary

Independent Forever frontend → authenticated canonical session → independent Turtle backend. Own framing/cipher state at both ends; translate decoded messages, not encrypted bytes. Keep credentials per side separate and secrets in memory. Backend states: disconnected → SRP challenge → verified M2 → world challenge → auth accepted → roster received → closed. Fail closed on security challenges, unsupported integrity requests, malformed lengths, auth errors and timeouts.

First milestone: standalone C++ codecs, bounds checks, legacy header cipher, SRP client and loopback-only backend character-list probe. Python fixture is an independent local protocol peer, not a Tortoise server or proof of its acceptance. Future milestones: approved real local Tortoise test, Forever login endpoint, exact-build enum translation and content mapping, instance connection, minimal world initialization/update translation, then movement and gameplay. No live OctoWoW connection is authorized by this project. Tests must use disposable local accounts; no DB provisioning or service/config changes are performed automatically.

Additional implemented offline boundary

gateway::ForeverChannel now encodes/decodes complete uncompressed envelopes, AES-256-GCM, 12-byte tags, directional IVs and counters including plaintext mode. It fails closed on malformed frames/authentication errors, refuses key replacement, and exposes no plaintext before successful tag verification. Offline golden tests validate it against an independently generated Python cryptography vector, not against a Forever capture. It rejects nonzero plaintext tags (stricter than the server's pre-encryption behavior). Compression, streaming frontend sockets, login key derivation and exact-build opcode translation remain unimplemented.

Implemented relay and actual-client validation update

After expanded local authorization, the gateway implements a standalone loopback Forever world relay (src/relay.cpp, relay, Provider::key, derive, Inflate::unwrap) against the existing local HTTPS/Battle.net/world authentication provider. It observes the real challenge/ticket exchange, reads only the approved local account's authentication session material, derives the key using the source SHA512/HMAC/session generator sequence and manages four independent directional packet contexts. Provider compression is decoded with a persistent raw-deflate stream and both seeded Adler checksums before forwarding uncompressed messages.

fetch_roster in src/legacy_client.cpp establishes a separately authenticated Turtle session for each translated enumeration. forever_roster and forever_restrictions in src/roster_translation.cpp encode the tested human-warrior subset using realm-scoped GUID128 identities and regionwide characters. No Forever character database query is involved. Provider realm/auth context is retained; world login is intercepted until authoritative Turtle world translation exists.

The actual 70334 client validated these opcode numbers in the successful trace: CMSG_AUTH_SESSION 0x460001, encrypted-mode ACK 0x460005, CMSG_ENUM_CHARACTERS 0x440014 and SMSG_ENUM_CHARACTERS_RESULT 0x470018. This validates that observed subset, not the entire build's opcode table. Its SRP challenge requires a use_srp field; the minimal, gated local provider response patch is tracked under patches/. The earlier document's offline-only implementation boundary is historical; the integration record states the current verified scope.

The original source's normal client-packet limit has a hotfix-request exception; server initialization/hotfix payloads can be larger. The relay uses separate, explicit 1 MiB client and 16 MiB server/decompression limits while preserving the codec's smaller default. The actual client's full initialization and character screen remained connected after translated enumeration and injected restrictions.