Skip to content

Integrate realmd authentication stream hardening#461

Merged
MadMaxMangos merged 10 commits into
masterfrom
fix/realmd-auth-stream-safety
Jul 23, 2026
Merged

Integrate realmd authentication stream hardening#461
MadMaxMangos merged 10 commits into
masterfrom
fix/realmd-auth-stream-safety

Conversation

@MadMaxMangos

@MadMaxMangos MadMaxMangos commented Jul 23, 2026

Copy link
Copy Markdown
Member

Summary

  • advance the realmd submodule to the tested authentication-stream hardening commit
  • enable parent CTest discovery early enough for the submodule protocol test
  • add an installed-runtime smoke test for hostile input, TCP fragmentation, live log visibility, idle timeout, and process survival
  • record the protocol audit design, implementation plan, compatibility reasoning, and validation evidence

Depends on mangos/realmd#30.

Why

The Classic client can fragment its login challenge at any TCP boundary, while the previous server path could dispatch handlers before a complete protocol frame was available. The integration also lacked an installed-binary regression for malformed streams and stalled sessions. Separately, realmd did not periodically drain the shared logger's buffered file sink, so debug authentication records could remain invisible until shutdown.

The linked submodule change centralizes framing and state validation, caps unauthenticated buffering, adds a pre-authentication deadline, preserves patch and authenticated realm-list behavior, and flushes logs without restoring per-line I/O.

Compatibility

realmd remains one multi-client application. The protocol guard is build-independent and its test covers every accepted build: 5875, 6005, 6141, 8606, 12340, 15595, 18273, 18414, 21742, 26972, 35662, and 40000.

This parent intentionally pins the compatible realmd commit rather than current realmd master: the latter includes the later Common/Locales.h and Common/TimeConstants.h split, while current Zero master does not yet provide those headers.

Validation

  • full RelWithDebInfo build passed, including realmd, mangosd, modules, tools, and tests
  • CTest: 4/4 passed (realmd_auth_protocol_tests, auth_crypto_tests, lease_tests, network_regression_tests)
  • installed-runtime smoke passed:
    • prompt rejection of hostile/unknown input
    • complete Classic build-5875 challenge
    • every one of its 39 split points
    • live debug-log visibility before daemon shutdown
    • idle pre-authentication timeout
    • daemon survival
  • fail-before/pass-after evidence captured for both fragmented auth framing and live-log flushing
  • manual Classic, TBC, WotLK, and Cata clients authenticated and received realm lists with world servers offline (no character-selection claim)
  • build and installed realmd.exe SHA-256 hashes matched
  • protected source checkout remained clean
  • auth-stream cross-model review returned APPROVE with no blocking or important findings after follow-up

This change is?Reviewable

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@AppVeyorBot

Copy link
Copy Markdown

@MadMaxMangos
MadMaxMangos marked this pull request as ready for review July 23, 2026 19:55
@MadMaxMangos
MadMaxMangos merged commit c87a505 into master Jul 23, 2026
7 of 8 checks passed
@MadMaxMangos
MadMaxMangos deleted the fix/realmd-auth-stream-safety branch July 23, 2026 20:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b7fae6a00

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +110 to +111
catch [System.IO.IOException] {
return $false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat reset closes as successful prompt shutdown

When the invalid-stream case writes extra data after the server has already closed the socket, Windows/.NET can surface the close as an IOException with a connection-reset socket error instead of returning 0 from Read. In that correct prompt-close scenario this helper returns false, so the new smoke test can fail even though realmd rejected and closed the hostile connection as intended; distinguish timeouts from reset/closed errors here.

Useful? React with 👍 / 👎.

}

function New-LogonChallenge {
$username = [System.Text.Encoding]::ASCII.GetBytes("NOUSER")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use an account name guaranteed to be absent

If the configured realm database happens to contain an account named NOUSER, these challenge responses are no longer deterministic because realmd returns an SRP challenge with per-connection random values, so the every-split SequenceEqual check later can fail even though TCP fragmentation handling is correct. Generate a unique unlikely username for each run or assert/remove it from the test database before comparing full responses.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants