Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client Packets with non-matching/missing MessagePack keys crash the server #596

Closed
Cheshire92 opened this issue Mar 11, 2021 · 0 comments · Fixed by #637
Closed

Client Packets with non-matching/missing MessagePack keys crash the server #596

Cheshire92 opened this issue Mar 11, 2021 · 0 comments · Fixed by #637
Labels
bug Something isn't working

Comments

@Cheshire92
Copy link
Contributor

Describe the bug
When sending a client packet to the server with an missing messagepack key that the server expects the entire server crashes.

Version Encountered
Development branch

To Reproduce
Steps to reproduce the behavior:

  1. Compile a server.
  2. Remove a random element from any packet.
  3. Compile client and run this client versus the server, server crashes when the packet is sent from the client.

Expected behavior
The user should be disconnected from the server, rather than taking the entire server down upon such an error.

Screenshots
If applicable, add screenshots to help explain your problem.

Logs
2021-03-11 18:25:01.781 [Error] Message: Failed to deserialize Intersect.Network.Packets.Client.NationQueryPacket value. Stack: at MessagePack.MessagePackSerializer.Deserialize[T](MessagePackReader& reader, MessagePackSerializerOptions options) at MessagePack.MessagePackSerializer.Deserialize[T](ReadOnlyMemory1 buffer, MessagePackSerializerOptions options, CancellationToken cancellationToken)
at lambda_method(Closure , ReadOnlyMemory1 , MessagePackSerializerOptions , CancellationToken ) at MessagePack.MessagePackSerializer.Deserialize(Type type, ReadOnlyMemory1 bytes, MessagePackSerializerOptions options, CancellationToken cancellationToken)
at Intersect.Network.MessagePacker.Deserialize(Byte[] data) in C:\Projects\Intersect-Leafling\Intersect (Core)\Network\MessagePacker.cs:line 44

Caused By
Message: Unexpected msgpack code 196 (bin 8) encountered.
Stack: at MessagePack.MessagePackReader.ThrowInvalidCode(Byte code)
at MessagePack.MessagePackReader.ReadInt32()
at MessagePack.Formatters.Intersect_Network_Packets_Client_NationQueryPacketFormatter48.Deserialize(MessagePackReader& reader, MessagePackSerializerOptions options)
at MessagePack.MessagePackSerializer.Deserialize[T](MessagePackReader& reader, MessagePackSerializerOptions options)


2021-03-11 18:25:01.789 [Error] Received unhandled exception from Name:Intersect Server.exe
There are no context policies.
.


2021-03-11 18:25:01.789 [Error]
Message: Object reference not set to an instance of an object.
Stack: at Intersect.Server.Networking.PacketHandler.HandlePacket(IConnection connection, IPacket packet) in C:\Projects\Intersect-Leafling\Intersect.Server\Networking\PacketHandler.cs:line 145
at Intersect.Network.AbstractNetwork.HandleInboundData(IBuffer buffer, IConnection connection) in C:\Projects\Intersect-Leafling\Intersect (Core)\Network\AbstractNetwork.cs:line 240
at Intersect.Network.AbstractNetwork.HandleInboundMessageAvailable(INetworkLayerInterface sender) in C:\Projects\Intersect-Leafling\Intersect (Core)\Network\AbstractNetwork.cs:line 184
at Intersect.Network.Lidgren.LidgrenInterface.<.ctor>b__9_0(Object peer) in C:\Projects\Intersect-Leafling\Intersect.Network\Lidgren\LidgrenInterface.cs:line 133
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()`

Operating System:
Windows, Mac, Or Linux

Additional context
Packet names in log do not exist in Intersect, but I would imagine the issue is much the same for other packets.
Could potentially have script kiddies crashing game servers with malformed packets.

@Cheshire92 Cheshire92 added the bug Something isn't working label Mar 11, 2021
@jcsnider jcsnider linked a pull request Apr 23, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants