Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS00cW00LThoZzItZzJ4bc4ABAZj

MessagePack allows untrusted data to lead to DoS attack due to hash collisions and stack overflow

Impact

When this library is used to deserialize messagepack 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.

This is similar to a prior advisory, which provided an inadequate fix for the hash collision part of the vulnerability.

Patches

The following steps are required to mitigate this risk.

  1. Upgrade to a version of the library where a fix is available. If upgrading from v1, check out our migration guide.
  2. Review the steps in this previous advisory to ensure you have your application configured for untrusted data.

Workarounds

If upgrading MessagePack to a patched version is not an option for you, you may apply a manual workaround as follows:

  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.

References

For more information

If you have any questions or comments about this advisory:

Permalink: https://github.com/advisories/GHSA-4qm4-8hg2-g2xm
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00cW00LThoZzItZzJ4bc4ABAZj
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: about 1 month ago
Updated: about 1 month ago


Identifiers: GHSA-4qm4-8hg2-g2xm, CVE-2024-48924
References: Repository: https://github.com/MessagePack-CSharp/MessagePack-CSharp
Blast Radius: 1.0

Affected Packages

nuget:MessagePack
Dependent packages: 519
Dependent repositories: 0
Downloads: 152,710,052 total
Affected Version Ranges: >= 2.6.95-alpha, < 3.0.214-rc.1, < 2.5.187
Fixed in: 3.0.214-rc.1, 2.5.187
All affected versions: 0.4.0, 0.4.1, 0.4.2, 0.5.0, 0.6.0, 0.6.1, 0.7.0, 0.7.2, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.8.5, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0, 1.1.1, 1.1.2, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.4.0, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.8.74, 1.8.80, 1.9.3, 1.9.11, 2.0.323, 2.0.335, 2.1.80, 2.1.90, 2.1.115, 2.1.143, 2.1.152, 2.1.165, 2.1.194, 2.2.60, 2.2.85, 2.2.113, 2.3.75, 2.3.85, 2.3.112, 2.4.35, 2.4.59, 2.5.94, 2.5.103, 2.5.108, 2.5.124, 2.5.129, 2.5.140, 2.5.168, 2.5.171, 2.5.172, 2.6.95-alpha
All unaffected versions: 2.5.187, 2.5.192