Use of Weak Hash Affecting messagepack package, versions [,2.5.187)[2.6.95-alpha,3.0.214-rc.1)


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.05% (18th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Use of Weak Hash vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-DOTNET-MESSAGEPACK-8229907
  • published18 Oct 2024
  • disclosed17 Oct 2024
  • creditAndrew Arnott

Introduced: 17 Oct 2024

CVE-2024-48924  (opens in a new tab)
CWE-328  (opens in a new tab)

How to fix?

Upgrade MessagePack to version 2.5.187, 3.0.214-rc.1 or higher.

Overview

MessagePack is a MessagePack(MsgPack) Serializer for C#(.NET, .NET Core, Unity, Xamarin).

Affected versions of this package are vulnerable to Use of Weak Hash through the deserialization process. An attacker can cause a denial of service by sending specially crafted data that leads to hash collisions or stack overflow.

Notes:

  1. This vulnerability is caused by an incomplete fix for CVE-2020-5234.

  2. When deserializing untrusted data, it is recommend to put MessagePack into a more secure mode with:

MessagePackSecurity.Active = MessagePackSecurity.UntrustedData;

Workaround

  1. Declare a class that derives from MessagePackSecurity.

  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.

CVSS Scores

version 4.0
version 3.1