HIGH 7.5

CVE-2026-48511: MessagePack for C# ExpandoObject Denial of Service

MessagePack for C# contains a performance vulnerability in its ExpandoObject deserialization handler. When deserializing untrusted data containing large maps with many distinct keys, the library exhibits quadratic behavior—CPU and memory usage grow exponentially rather than linearly with input size. An attacker sending a specially crafted MessagePack message can trigger excessive resource consumption, potentially causing denial of service. The flaw affects versions before 2.5.301 and 3.1.7.

Source data · NVD / CISA · public domain

CVSS
3.1 · 7.5 HIGH · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weaknesses (CWE)
CWE-407
Affected products
1 configuration(s)
Published / Modified
2026-06-22 / 2026-06-25

NVD description (verbatim)

MessagePack for C# is a MessagePack serializer for C#. Prior to 2.5.301 and 3.1.7, ExpandoObjectFormatter.Deserialize populates System.Dynamic.ExpandoObject by calling IDictionary<string, object>.Add for each map entry. ExpandoObject internally maintains member names in array-like structures, so inserting many distinct keys can require repeated linear scans and array copies. For large attacker-controlled maps, this produces quadratic CPU and allocation behavior. The issue is especially surprising because ExpandoObjectResolver.Options is configured with MessagePackSecurity.UntrustedData, but collision-resistant dictionary comparers cannot protect ExpandoObject insertion internals. This vulnerability is fixed in 2.5.301 and 3.1.7.

1 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

ExpandoObjectFormatter.Deserialize populates System.Dynamic.ExpandoObject instances by iterating through map entries and calling IDictionary<string, object>.Add for each key-value pair. ExpandoObject maintains member names in array-like structures that require linear scans and array copies during insertion; with many distinct keys, this produces O(n²) behavior. Although ExpandoObjectResolver.Options is configured with MessagePackSecurity.UntrustedData, the untrusted-data security policy cannot defend against algorithmic complexity attacks on ExpandoObject's internal insertion mechanics. The root cause is architectural: ExpandoObject's insertion implementation becomes a performance bottleneck when fed large, adversary-controlled dictionaries.

Business impact

Applications using MessagePack for C# to deserialize untrusted input could be forced into resource exhaustion. A denial of service attack requires minimal bandwidth—a single moderately-sized malicious MessagePack payload can consume significant CPU and memory, potentially crashing the application or degrading service for legitimate users. This is particularly dangerous in API endpoints, message queues, or any service that accepts serialized data from untrusted sources. Organizations relying on MessagePack for C# deserialization of external data face immediate availability risk.

Affected systems

MessagePack for C# versions before 2.5.301 and 3.1.7 are affected. The vulnerability exists in the deserialization code path for ExpandoObject types, so applications must both use the affected library versions and deserialize ExpandoObject instances from untrusted sources to be at risk. Verify your dependency declarations and deserialization patterns against your actual usage.

Exploitability

Exploitability is high. The attack requires no authentication, no user interaction, and no special conditions—an attacker simply sends a crafted MessagePack message with a large map to a vulnerable endpoint. The network attack vector is straightforward, and the resources required to mount the attack (generating a malicious payload) are minimal. The only limiting factor is whether the application actually deserializes ExpandoObject types from untrusted input; applications that only deserialize other types are not affected.

Remediation

Upgrade MessagePack for C# to version 2.5.301 or later for the 2.x line, or 3.1.7 or later for the 3.x line. These versions fix the quadratic insertion behavior. After patching, no application code changes are required. If immediate patching is not possible, consider restricting deserialization of ExpandoObject types from untrusted sources or implementing rate limiting and resource quotas on deserialization operations.

Patch guidance

Update your NuGet package reference for MessagePack to 2.5.301 or 3.1.7 as appropriate for your major version. Consult the official MessagePack-CSharp GitHub repository and release notes to confirm the exact patched versions and any breaking changes. After updating, recompile and test your application against your existing test suite to ensure compatibility.

Detection guidance

Monitor for unusual CPU spikes and memory growth during deserialization operations, particularly if tied to incoming network requests or message processing. Log the size and key count of ExpandoObject instances being deserialized; unusually large maps from untrusted sources may indicate an attack. Implement metrics around deserialization latency—quadratic behavior will manifest as disproportionate slowdown as payload complexity increases. Code review: scan for MessagePackSerializer.Deserialize or Unpacker.Unpack calls that operate on untrusted input and involve ExpandoObject types.

Why prioritize this

The CVSS 7.5 HIGH score reflects network-exploitable denial of service with no user interaction required. While the attack vector is narrow (must deserialize ExpandoObject specifically), the impact is immediate and affects availability. Organizations using MessagePack for C# in production API or message-processing services should patch within weeks, not months. Lower priority for internal-use or trusted-data-only scenarios.

Risk score, explained

CVSS 3.1 score of 7.5 (HIGH) is assigned because: Attack Vector is Network (AV:N), Attack Complexity is Low (AC:L), Privileges Required is None (PR:N), User Interaction is None (UI:N), Scope is Unchanged (S:U), Confidentiality impact is None (C:N), Integrity impact is None (I:N), and Availability impact is High (A:H). The severity reflects that an unauthenticated remote attacker can reliably trigger denial of service through a single crafted message, but no data breach or integrity violation occurs.

Frequently asked questions

Does this vulnerability affect all MessagePack for C# users?

No. The vulnerability only affects applications that: (1) use MessagePack for C# versions before 2.5.301 or 3.1.7, AND (2) deserialize ExpandoObject types from untrusted or user-supplied input. If your application only deserializes strongly-typed classes or simple types, or only processes trusted data, you may not be at risk. Review your deserialization code to confirm.

Can security policies like MessagePackSecurity.UntrustedData prevent this attack?

No. While UntrustedData mode enables collision-resistant dictionary comparers to defend against hash collision attacks, it does not address algorithmic complexity issues in ExpandoObject's insertion implementation itself. The flaw is architectural; the security policy cannot override ExpandoObject's internal behavior.

What happens if we apply rate limiting to deserialization?

Rate limiting can reduce exposure but is not a substitute for patching. A single large malicious payload can still consume significant resources before the limit is enforced. Rate limiting is a useful defense-in-depth measure but should accompany a timely upgrade to patched versions.

Are other serializers affected by similar issues?

Other serializers may have similar algorithmic complexity vulnerabilities in deserialization paths. This CVE is specific to MessagePack for C#'s ExpandoObject handler. Review the security advisories for any other serialization libraries in your stack, and prefer deserialization into strongly-typed classes rather than dynamic objects when handling untrusted input.

This analysis is provided for informational purposes. Verify all technical details, affected versions, and patch availability against the official MessagePack-CSharp GitHub repository and vendor advisories before making remediation decisions. CVSS score and severity information are provided by the CVE database and should be considered alongside your organization's risk tolerance and asset criticality. No exploit code or weaponized proof-of-concept is provided. Always test patches in non-production environments before deployment. Source: NVD (public-domain), retrieved 2026-07-28. Analysis generated by SEC.co (claude-haiku-4-5).