CVE-2026-48516: MessagePack-CSharp: InterfaceLookupFormatter bypasses collision-resistant comparer settings

Published Jun 22, 2026
·
Updated

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:

1. Upgrade MessagePack to the patched version for your release line. 2. 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: InterfaceLookupFormatter missing security comparer - CWE-407: Inefficient Algorithmic Complexity

Other sources

MessagePack for C# is a MessagePack serializer for C#. Prior to 2.5.301 and 3.1.7, 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>(). 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 This vulnerability is fixed in 2.5.301 and 3.1.7.

MITRE

Affected Software

5 affected componentsFixes available
nuget/MessagePack<2.5.301, <3.1.7
MessagePack Messagepack C\#<2.5.301
MessagePack Messagepack C\#>=3.0.3<3.1.7
nuget/MessagePack>=3.0<3.1.7
3.1.7
nuget/MessagePack<2.5.301
2.5.301

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade nuget/MessagePack to a version that resolves this vulnerability.

    Fixed in 3.1.7
  2. Upgrade

    Upgrade nuget/MessagePack to a version that resolves this vulnerability.

    Fixed in 2.5.301
  3. Upgrade

    Upgrade MessagePack to a version that resolves this vulnerability.

    Fixed in 2.5.301
  4. Upgrade

    Upgrade MessagePack to a version that resolves this vulnerability.

    Fixed in 3.1.7
  5. Configuration

    In InterfaceLookupFormatter<TKey,TElement>, construct the internal Dictionary<TKey, IGrouping<TKey,TElement>> using options.Security.GetEqualityComparer<TKey>() (instead of the default equality comparer) so it matches the security-aware comparer behavior for MessagePackSecurity.UntrustedData.

    MessagePack InterfaceLookupFormatter<TKey,TElement> internal Dictionary<TKey, IGrouping<TKey,TElement>> equality comparer = options.Security.GetEqualityComparer<TKey>()
  6. Compensating control

    Until patched, avoid exposing ILookup<TKey,TElement> in DTOs that deserialize untrusted data.

Event History

Jun 22, 2026
CVE Published
via MITRE·09:09 PM
Data Sourced
via MITRE·09:09 PM
DescriptionWeakness
Data Sourced
via NVD·10:16 PM
DescriptionSeverityWeaknessAffected Software
Jun 25, 2026
Advisory Published
via GitHub·09:29 PM
Data Sourced
via GitHub·09:29 PM
DescriptionWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-48516?

CVE-2026-48516 is rated with a risk score of 28, indicating a medium-level security vulnerability.

2

How do I fix CVE-2026-48516?

To resolve CVE-2026-48516, upgrade to MessagePack for C# version 2.5.301 or 3.1.7 or later.

3

What systems are affected by CVE-2026-48516?

CVE-2026-48516 affects MessagePack for C# versions prior to 2.5.301 and 3.1.7.

4

What is the nature of the issue in CVE-2026-48516?

CVE-2026-48516 allows the InterfaceLookupFormatter to bypass user-defined equality comparer settings, using a default comparer instead.

5

Is CVE-2026-48516 a remote exploit?

CVE-2026-48516 does not indicate a remote exploitation vector, but it may lead to unexpected behavior in applications using the affected versions.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203