CVE-2026-48513: MessagePack-CSharp: DynamicUnionResolver-generated deserializers miss depth enforcement
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.
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
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:
- 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 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
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
