CVE-2024-48924: MessagePack Denial of Service Vulnerability
MODERATECVE-2024-48924 is a MODERATE denial of service vulnerability (CWE-328: Use of Weak Hash) affecting MessagePack libraries in the NuGet ecosystem. The issue involves messagepack allows untrusted data to lead to dos attack due to hash collisions and stack overflow. Remediation is available by upgrading affected packages to version 2.5.187, 3.0.214-rc.1.
CVE-2024-48924 at a Glance
How to Fix CVE-2024-48924
To remediate this vulnerability, upgrade all affected MessagePack dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade MessagePack to 2.5.187
Upgrade MessagePack to 3.0.214-rc.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for MessagePack
How to Check if You Are Affected
To determine whether your application is affected by CVE-2024-48924, inspect your project dependencies for MessagePack:
inspect dependencies for MessagePack
Analyze the terminal output to locate any version of MessagePack in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.5.187), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-328: Use of Weak Hash, where 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). In MessagePack, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-48924 Affected MessagePack Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
MessagePack
|
NuGet |
< 2.5.187
|
2.5.187
|
|
MessagePack
|
NuGet |
≥ 2.6.95-alpha
< 3.0.214-rc.1
|
3.0.214-rc.1
|
References
Frequently Asked Questions
What is CVE-2024-48924?
Which MessagePack versions are affected?
What version fixes CVE-2024-48924?
Is MessagePack affected?
What CWE is associated with CVE-2024-48924?
How can I check NuGet dependencies for CVE-2024-48924?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-4qm4-8hg2-g2xm",
"modified" : "2024-10-18T16:23:37Z",
"published" : "2024-10-17T19:30:03Z",
"aliases" : [ "CVE-2024-48924" ],
"summary" : "MessagePack allows untrusted data to lead to DoS attack due to hash collisions and stack overflow",
"details" : "### Impact\n\nWhen 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.\n\nThis is similar to [a prior advisory](https://github.com/MessagePack-CSharp/MessagePack-CSharp/security/advisories/GHSA-7q36-4xx7-xcxf), which provided an inadequate fix for the hash collision part of the vulnerability.\n\n### Patches\n\nThe following steps are required to mitigate this risk.\n\n1. Upgrade to a version of the library where a fix is available. If upgrading from v1, check out [our migration guide](https://github.com/MessagePack-CSharp/MessagePack-CSharp/blob/master/doc/migration.md).\n1. Review the steps in [this previous advisory](https://github.com/MessagePack-CSharp/MessagePack-CSharp/security/advisories/GHSA-7q36-4xx7-xcxf) to ensure you have your application configured for untrusted data.\n\n### Workarounds\n\nIf upgrading MessagePack to a patched version is not an option for you, you may apply a manual workaround as follows:\n\n1. Declare a class that derives from `MessagePackSecurity`.\n2. Override the `GetHashCollisionResistantEqualityComparer<T>` method to provide a collision-resistant hash function of your own and avoid calling `base.GetHashCollisionResistantEqualityComparer<T>()`.\n3. Configure a `MessagePackSerializerOptions` with an instance of your derived type by calling `WithSecurity` on an existing options object.\n4. 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.\n\n### References\n\n- Learn more about best security practices when reading untrusted data with [MessagePack 1.x](https://github.com/MessagePack-CSharp/MessagePack-CSharp/tree/v1.x#security) or [MessagePack 2.x](https://github.com/MessagePack-CSharp/MessagePack-CSharp#security).\n- The .NET team's [discussion on hash collision vulnerabilities of their `HashCode` struct](https://github.com/GrabYourPitchforks/runtime/blob/threat_models/docs/design/security/System.HashCode.md) (or in [the pull request that merges this into the dotnet org](https://github.com/dotnet/runtime/pull/108864)).\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n\n* [Start a public discussion](https://github.com/MessagePack-CSharp/MessagePack-CSharp/discussions)\n* [Email us privately](mailto:andrewarnott@live.com)",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "NuGet",
"name" : "MessagePack"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.5.187"
} ]
} ]
}, {
"package" : {
"ecosystem" : "NuGet",
"name" : "MessagePack"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.6.95-alpha"
}, {
"fixed" : "3.0.214-rc.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/MessagePack-CSharp/MessagePack-CSharp/security/advisories/GHSA-4qm4-8hg2-g2xm"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/MessagePack-CSharp/MessagePack-CSharp"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-328" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-10-17T19:30:03Z",
"nvd_published_at" : "2024-10-17T21:15:14Z"
}
}