CVE-2026-48513: MessagePack-CSharp: DynamicUnionResolver generated deserializers miss depth enforcement

Published Jun 22, 2026
·
Updated

Summary

Runtime-generated union deserializers emitted by DynamicUnionResolver do not call MessagePackSecurity.DepthStep(ref reader) and do not decrement reader.Depth around recursive deserialization and skip paths.

This means union deserialization does not consistently participate in the maximum object graph depth enforcement that protects other recursive formatter paths. For unknown union keys, the emitted deserializer calls reader.Skip() on attacker-controlled data without an enclosing depth step.

Impact

Applications are affected when they deserialize untrusted payloads into object graphs containing [Union]-decorated interfaces or abstract classes handled by DynamicUnionResolver.

An attacker can provide a union payload with an unknown key and a deeply nested value. Because the generated union formatter does not enter the depth accounting scope before skipping or recursively processing the value, configured depth limits can be bypassed. In combination with recursive skip behavior, this can terminate the process with an uncatchable StackOverflowException.

This issue is narrower than the general TrySkip() recursion issue because it specifically concerns a formatter-generation path that fails to count union nesting. It remains independently fixable because the emitted IL should mirror the depth-step behavior used by source-generated union formatters and dynamic object formatters.

Affected components

- Package: MessagePack - API: DynamicUnionResolver.BuildDeserialize - Data types: [Union]-decorated interface and abstract class hierarchies handled by the dynamic resolver - Finding ID: MESSAGEPACKCSHARP-070

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 emit DepthStep and matching reader.Depth-- cleanup in dynamic union deserializers, consistent with other recursive formatter implementations.

Workarounds

Patching is recommended.

Until a patched version is available, avoid deserializing untrusted payloads into dynamically resolved [Union] types. Prefer source-generated formatters that include depth checks, where applicable, and enforce outer message-size and schema constraints.

Resources

- MESSAGEPACKCSHARP-070: dynamic union deserializer missing depth-step enforcement - CWE-674: Uncontrolled Recursion

Other sources

MessagePack for C# is a MessagePack serializer for C#. Prior to 2.5.301 and 3.1.7, runtime-generated union deserializers emitted by DynamicUnionResolver do not call MessagePackSecurity.DepthStep(ref reader) and do not decrement reader.Depth around recursive deserialization and skip paths. This means union deserialization does not consistently participate in the maximum object graph depth enforcement that protects other recursive formatter paths. For unknown union keys, the emitted deserializer calls reader.Skip() on attacker-controlled data without an enclosing depth step. 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. Compensating control

    Until patched, avoid deserializing untrusted payloads into dynamically resolved `[Union]` types handled by `DynamicUnionResolver`.

Event History

Jun 22, 2026
CVE Published
via MITRE·09:12 PM
Data Sourced
via MITRE·09:12 PM
DescriptionWeakness
Data Sourced
via NVD·10:16 PM
DescriptionSeverityWeaknessAffected Software
Jun 25, 2026
Advisory Published
via GitHub·09:22 PM
Data Sourced
via GitHub·09:22 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-48513?

CVE-2026-48513 has a risk score of 47, indicating a moderate level of severity.

2

How do I fix CVE-2026-48513?

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

3

What are the consequences of CVE-2026-48513 if left unaddressed?

If left unaddressed, CVE-2026-48513 can lead to denial-of-service vulnerabilities due to unchecked depth during deserialization.

4

Which versions of MessagePack for C# are affected by CVE-2026-48513?

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

5

In which component of MessagePack for C# does CVE-2026-48513 occur?

CVE-2026-48513 occurs in the DynamicUnionResolver's runtime-generated union deserializers.

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