CVE-2026-48516: MessagePack-CSharp: InterfaceLookupFormatter bypasses collision-resistant comparer settings
Summary InterfaceLookupFormatter constructs an internal Dictionary with the default equality comparer instead of the security-aware comparer supplied by options.Security.GetEqualityComparer (). Other hash-based collection formatters use the security-aware comparer when MessagePackSecurity.UntrustedData is configured.
Published Jun 25, 2026
Affected packages
MessagePack
- Ecosystem
- NuGet
- Affected
- < 2.5.301
- Fixed in
- 2.5.301
- Check
dotnet list package --include-transitive
MessagePack
- Ecosystem
- NuGet
- Affected
- >= 3.0, < 3.1.7
- Fixed in
- 3.1.7
- Check
dotnet list package --include-transitive
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
InterfaceLookupFormatter<TKey,TElement> constructs an internal Dictionary<TKey, IGrouping<TKey,TElement>> with the default equality comparer instead of the security-aware comparer supplied by options.Security.GetEqualityComparer<TKey>().
Other hash-based collection formatters use the security-aware comparer when MessagePackSecurity.UntrustedData is configured. This formatter omission allows hash-collision CPU denial of service against ILookup<TKey,TElement> even when the application has opted into the untrusted-data security posture.
Impact
Applications are affected when they deserialize untrusted payloads into schemas containing ILookup<TKey,TElement> with a key type for which attacker-controlled hash collisions are feasible.
Under the default comparer, many colliding keys can degrade dictionary insertion from amortized constant time to quadratic behavior. A payload of colliding keys can consume CPU for a disproportionate amount of time. This bypasses the mitigation that developers intentionally enabled by using MessagePackSecurity.UntrustedData.
Affected components
- Package:
MessagePack - API:
InterfaceLookupFormatter<TKey,TElement>.Create - Data type:
ILookup<TKey,TElement> - Finding ID:
MESSAGEPACKCSHARP-041
Patches
Fixes are prepared and will be released in coordinated patch versions.
Upgrade guidance:
- Upgrade
MessagePackto the patched version for your release line. - Upgrade companion MessagePack packages in the same dependency graph to the coordinated patched versions.
The fix should create the internal dictionary with options.Security.GetEqualityComparer<TKey>(), matching the sibling dictionary and lookup formatter behavior.
Workarounds
Patching is recommended.
Until a patched version is available, avoid exposing ILookup<TKey,TElement> in DTOs that deserialize untrusted data. Use collection shapes that are already protected by the security-aware comparer path, or validate and cap collection sizes at the transport boundary.
Resources
MESSAGEPACKCSHARP-041:InterfaceLookupFormattermissing security comparer- CWE-407: Inefficient Algorithmic Complexity
Credited to AArnott.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More NuGet vulnerabilities
All NuGet entriesCVE-2026-92707
MessagePack: Nested arrays can blow past buffer length limits
medium5.3Oct 15, 2026CVE-2026-48502
MessagePack-CSharp: Denial of service vulnerabilities can swamp the CPU or crash the process with stack and heap overflows
high8.2Jun 25, 2026CVE-2026-48506
MessagePack-CSharp: MessagePackReader.Skip can recurse without enforcing maximum object graph depth
high7.5Jun 25, 2026CVE-2026-48509
MessagePack-CSharp: ASP.NET Core MessagePackInputFormatter defaults to TrustedData for HTTP request bodies
medium6.3Jun 25, 2026CVE-2026-48510
MessagePack-CSharp: LZ4 decompression allocates from unbounded declared output lengths
medium7.5Jun 25, 2026CVE-2026-48511
MessagePack-CSharp: ExpandoObject formatter can perform quadratic insertion work on untrusted maps
medium7.5Jun 25, 2026
