The vulnerability exists in the MessagePack-CSharp library, specifically in the deserialization of DateTime objects. The core issue is an allocation of resources without limits (CWE-789). When deserializing a DateTime, the MessagePackReader.ReadDateTime function is called. This function, prior to the patch, would read an extension header length from the incoming data and use it to calculate the size for a stack allocation (stackalloc). The vulnerability lies in the fact that this length was not validated against the legitimate sizes for a timestamp (4, 8, or 12 bytes).
An attacker could craft a malicious MessagePack payload with a timestamp extension claiming a very large body length. When MessagePackReader.ReadDateTime processes this payload, it would attempt to allocate a large buffer on the stack, leading to a StackOverflowException. This exception is uncatchable and terminates the process, resulting in a denial of service.
The fix, identified in commit 26d4e743ca2a88a5626e62cced3762820e392325, was applied to the helper function MessagePack.MessagePackPrimitives.TryReadDateTime. The patch introduces a check to validate the extension length before any buffer allocation is attempted. If the length is not one of the valid sizes (4, 8, or 12), the operation is aborted, and an exception is thrown, preventing the stack overflow.
Therefore, any application using a vulnerable version of MessagePack-CSharp (>= 3.0, < 3.1.7) to deserialize untrusted data containing DateTime or DateTimeOffset values is at risk. During exploitation, a profiler would show the MessagePack.MessagePackReader.ReadDateTime function being called, which would then lead to the vulnerable code path and the subsequent crash.