r/ultimaonline • u/UOAdam • 5h ago
Coding Shard Administration: Encrypted client detected, disconnecting
We've been chasing an intermittent login problem on our Angel Island family of shards, and I think we've finally put this one to bed.
Some of you running RunUO-based servers may have seen this message:
Encrypted client detected, disconnecting
The odd thing is that the client isn't encrypted. The player is using a perfectly valid client, and everything works fine on the next login attempt.
Sometimes the connection just appears to hang.
Well, it turns out there's a rather interesting explanation, buried in the networking code of RunUO, a server emulator whose history stretches all the way back to 2002. More than two decades of development, and we're still finding surprises.
The problem
When a player logs in, the server generates a random four-byte authentication key using GenerateAuthID.
That key is sent to the client during the shard relay, which then presents it to the game server as the first four bytes of the new connection.
So far, so good.
But there's another piece of code in MessagePump.HandleSeed that examines the first byte of an incoming connection.
If that byte is 0xEF, RunUO assumes it's receiving a newer 21-byte client seed packet.
And there's the problem.
The authentication key is random. Occasionally, it begins with 0xEF.
When that happens, RunUO mistakes the four-byte authentication key for the beginning of a 21-byte seed packet. It waits for more data and consumes part of the following game login packet.
From that point forward, packet framing is broken.
The server eventually encounters what it believes is an invalid or encrypted client packet and disconnects the player.
In one of our tests, the login server generated:
0xEF6EC0C0
The game server subsequently interpreted the seed as:
0x6EC0C091
Notice the trailing 0x91? That's actually the packet ID of the game login packet. The parser had consumed it as part of the seed.
Pretty conclusive.
How often does this happen?
Approximately one login in 256.
That's frequent enough to annoy players, but infrequent enough that it can be remarkably difficult to reproduce.
And because the next login generally works, it's easy to dismiss as a transient network or client problem.
The fix
Fortunately, the fix is almost embarrassingly simple.
In Server\Network\PacketHandlers.cs, find GenerateAuthID.
The existing loop ends with:
} while (m_AuthIDWindow.ContainsKey(authID));Change it to:
} while (m_AuthIDWindow.ContainsKey(authID) ||
((authID >> 24) & 0xFF) == 0xEF);That's it.
We simply prevent the server from issuing authentication keys whose first byte would be mistaken for a seed packet.
The keys remain random, the packet protocol doesn't change, and no client modifications are required.
This applies whether or not you're running a dedicated login server. Even a standalone RunUO shard generates a relay key when the player selects a shard and establishes a new game connection.
If you use a dedicated login server, the fix must be applied there, since that's where the keys are normally generated. However, shard administrators and owners often connect directly to individual game servers for testing, maintenance, or other reasons. Those servers generate their own relay keys as well.
The safest approach is to apply the fix to both your login server and all game servers. That way, regardless of how a player or administrator connects, the problematic keys are never issued.
Testing: 4,409 logins
We ran automated login tests against our servers, first with the original code and then with the fix.
Before the fix:
- 2,617 login attempts
- 8 authentication keys beginning with 0xEF
- All 8 produced the encrypted-client disconnect
- No other unexplained failures
After the fix:
- 1,792 login attempts
- 9 authentication keys beginning with 0xEF
- All 9 rejected and regenerated before being issued
- 1,792 successful logins
- Zero disconnects
- No unexplained failures
The interesting part is that the bad keys continued to appear at approximately the expected frequency. The difference is that the server now recognizes and discards them before they can cause trouble.
So this wasn't merely a case of running a test and getting lucky. We observed the failure mechanism before the fix, then watched the fix intercept the same condition nine times without a single failed login.
A little historical irony
The original seed detection logic actually makes sense.
Older client seeds were based on IP addresses, and 0xEF corresponds to the multicast address range, so it was reasonable to treat that byte as a special case.
Likewise, generating random authentication keys makes perfect sense.
It's just that these two perfectly reasonable design decisions don't play nicely together.
And that's how you get a bug that can survive for years.
A note for shard developers
We've confirmed this in our RunUO 2.6-based code. I haven't checked every RunUO version or fork, so your implementation may differ.
Specifically, look for the 0xEF test in MessagePump.HandleSeed. If your server doesn't use that detection logic, this particular issue may not apply.
Also, the same encryption warning can occur for legitimate reasons. This fix addresses the random authentication-key collision, not every possible cause of that message.
Our testing confirms the fix, although it has not yet been deployed to our live shards.
I thought this was worth sharing because I suspect other RunUO shard operators have encountered the same mysterious disconnects over the years.
Sometimes the bugs that have been around the longest turn out to have the simplest explanations.
--Adam Ant
game-master.net
RunUO 2.7, the final legacy release. I verified that the tagged release contains both code paths. RunUO 2.7 release · Key generation · Seed parsing
- GenerateAuthID generates the relay key. PacketHandlers.cs
- HandleSeed checks for a leading 0xEF. MessagePump.cs

