CVE-2026-48513: MessagePack-CSharp Remote Code Execution Vulnerability

MODERATE
Advisory Identifier: GHSA-wfr3-xj75-pfwh
CWE-674
Published
Advisory Summary

CVE-2026-48513 is a MODERATE remote code execution vulnerability (CWE-674: Uncontrolled Recursion) affecting MessagePack-CSharp libraries in the NuGet ecosystem. The issue involves dynamicunionresolver-generated deserializers miss depth enforcement. Remediation is available by upgrading affected packages to version 3.1.7, 2.5.301.

CVE-2026-48513 at a Glance

CVE Identifier CVE-2026-48513
GHSA Identifier GHSA-wfr3-xj75-pfwh
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-674: Uncontrolled Recursion
Affected Product MessagePack-CSharp
Package Ecosystem NuGet
Published Date
Last Updated

How to Fix CVE-2026-48513

To remediate this vulnerability, upgrade all affected MessagePack-CSharp dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

MessagePack fixed: 3.1.7
Upgrade MessagePack to 3.1.7
MessagePack fixed: 2.5.301
Upgrade MessagePack to 2.5.301
Verify Direct and Transitive Dependencies

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-2026-48513, inspect your project dependencies for MessagePack-CSharp:

inspect dependencies for MessagePack

Analyze the terminal output to locate any version of MessagePack-CSharp in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.1.7), 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-674: Uncontrolled Recursion, where the product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack. In MessagePack-CSharp, 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

## 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

CVE-2026-48513 Affected MessagePack-CSharp Versions

2 component(s)
Fixed Versions:
3.1.72.5.301
Product / Package Ecosystem Affected Versions Fixed Version
MessagePack
NuGet
≥ 3.0
< 3.1.7
3.1.7
MessagePack
NuGet
< 2.5.301
2.5.301

References

Frequently Asked Questions

What is CVE-2026-48513?
CVE-2026-48513 is a security vulnerability in MessagePack-CSharp involving DynamicUnionResolver-generated deserializers miss depth enforcement under CWE-674: Uncontrolled Recursion.
Which MessagePack-CSharp versions are affected?
Affected versions include releases prior to 3.1.7, 2.5.301 across affected packages: MessagePack.
What version fixes CVE-2026-48513?
Upgrading to 3.1.7, 2.5.301 (or the latest patched release for your respective branch) resolves the vulnerability.
Is MessagePack affected?
Yes, MessagePack is affected in releases prior to 3.1.7, 2.5.301. Upgrade your dependency to 3.1.7, 2.5.301 or later.
What CWE is associated with CVE-2026-48513?
CVE-2026-48513 is classified under CWE-674: Uncontrolled Recursion (The product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack.).
How can I check NuGet dependencies for CVE-2026-48513?
Run the dependency tree command: 'inspect dependencies for MessagePack'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-wfr3-xj75-pfwh",
  "modified" : "2026-06-25T21:22:52Z",
  "published" : "2026-06-25T21:22:52Z",
  "aliases" : [ "CVE-2026-48513" ],
  "summary" : "MessagePack-CSharp: DynamicUnionResolver-generated deserializers miss depth enforcement",
  "details" : "## Summary\n\nRuntime-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.\n\nThis 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.\n\n## Impact\n\nApplications are affected when they deserialize untrusted payloads into object graphs containing `[Union]`-decorated interfaces or abstract classes handled by `DynamicUnionResolver`.\n\nAn 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`.\n\nThis 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.\n\n## Affected components\n\n- Package: `MessagePack`\n- API: `DynamicUnionResolver.BuildDeserialize`\n- Data types: `[Union]`-decorated interface and abstract class hierarchies handled by the dynamic resolver\n- Finding ID: `MESSAGEPACKCSHARP-070`\n\n## Patches\n\nFixes are prepared and will be released in coordinated patch versions.\n\nUpgrade guidance:\n\n1. Upgrade `MessagePack` to the patched version for your release line.\n2. Upgrade companion MessagePack packages in the same dependency graph to the coordinated patched versions.\n\nThe fix should emit `DepthStep` and matching `reader.Depth--` cleanup in dynamic union deserializers, consistent with other recursive formatter implementations.\n\n## Workarounds\n\nPatching is recommended.\n\nUntil 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.\n\n## Resources\n\n- `MESSAGEPACKCSHARP-070`: dynamic union deserializer missing depth-step enforcement\n- CWE-674: Uncontrolled Recursion",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "MessagePack"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.5.301"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "MessagePack"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0"
      }, {
        "fixed" : "3.1.7"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/MessagePack-CSharp/MessagePack-CSharp/security/advisories/GHSA-wfr3-xj75-pfwh"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-48513"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/MessagePack-CSharp/MessagePack-CSharp"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-674" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-25T21:22:52Z",
    "nvd_published_at" : "2026-06-22T22:16:48Z"
  }
}