Skip to main content

Use of Weak Hash in MessagePack

CVE-2024-48924

  • MessagePack
Severity Medium
Score 6.5/10

Summary

The MessagePack is an extremely fast serializer for C#. When this library is used to deserialize messagepack versions through 2.5.172 and 2.6.95-alpha through 3.0.208-rc.1 data from an untrusted source, there is a risk of a Denial of Service attack by an attacker that sends data contrived to produce hash collisions, leading to large CPU consumption disproportionate to the size of the data being deserialized. A manual workaround is as follows: 1. Declare a class that derives from "MessagePack Security.". 2. Override the "GetHashCollisionResistantEqualityComparer<T>" method to provide a collision-resistant hash function of your own and avoid calling "base. GetHashCollisionResistantEqualityComparer<T>()". 3. Configure a "MessagePackSerializerOptions" with an instance of your derived type by calling "WithSecurity" on an existing options object. 4. Use your custom options object for all deserialization operations. This may be by setting the "MessagePackSerializer.DefaultOptions" static property if you call methods that rely on this default property, and/or by passing in the options object explicitly to any "Deserialize" method.

  • LOW
  • NETWORK
  • NONE
  • UNCHANGED
  • REQUIRED
  • NONE
  • NONE
  • HIGH

CWE-328 - Use of Weak Hash

The product uses an algorithm that produces a digest (output value) that does not meet security expectations for a hash function that allows an adversary to reasonably determine the original input (preimage attack), find another input that can produce the same hash (2nd preimage attack), or find multiple inputs that evaluate to the same hash (birthday attack).

Advisory Timeline

  • Published