CVE-2026-48517: MessagePack-CSharp Type-Filtering Bypass in Typeless Deserialization
MessagePack for C# contains a type-filtering bypass vulnerability in its typeless deserialization mechanism. The library implements a safety check to block dangerous types from being deserialized, but this check only examines the outermost type. An attacker can circumvent this protection by wrapping a blocked type inside an array or generic type wrapper, allowing the forbidden type to slip through validation and be instantiated anyway. This creates a deserialization attack surface that the vendor intended to close.
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:H/A:N
- Weaknesses (CWE)
- CWE-470, CWE-502
- 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, MessagePack-CSharp's typeless deserialization includes MessagePackSerializerOptions.ThrowIfDeserializingTypeIsDisallowed(Type) as a safety check for dangerous types. The default implementation checks the outer type name, but it does not recursively inspect array element types or generic type arguments. As a result, a type that would be blocked directly can be wrapped inside an array or constructed generic type and pass the outer type check. The formatter machinery can then materialize formatters for the inner blocked type. 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
MessagePackSerializerOptions.ThrowIfDeserializingTypeIsDisallowed(Type) performs a shallow type inspection during typeless deserialization. The method validates the declared type name but fails to recursively traverse array element types (e.g., Type[]) or generic type arguments (e.g., List<BlockedType>). An attacker supplying a crafted MessagePack payload can declare a wrapped variant of a blocked type, pass the outer validation layer, and trigger formatter instantiation for the inner dangerous type. The vulnerability affects typeless deserialization scenarios where the library is expected to enforce type restrictions as a security boundary.
Business impact
Applications relying on MessagePack for C# typeless deserialization with enabled type restrictions face gadget chain or arbitrary code execution risks. If an attacker can control the MessagePack input stream, they may achieve remote code execution by triggering instantiation of types capable of executing malicious logic during deserialization. This is particularly severe in service-to-service communication, API gateways, or any trust boundary where MessagePack is used to deserialize untrusted data. Organizations using this library for security-sensitive deserialization must assume their type-blocking controls are ineffective until patching.
Affected systems
MessagePack for C# versions prior to 2.5.301 (v2.x line) and prior to 3.1.7 (v3.x line) are affected. The vulnerability applies only when typeless deserialization is in use; strongly-typed deserialization is not affected. Any application or microservice component using MessagePack-CSharp with typeless deserialization features should be inventoried. This includes .NET Framework, .NET Core, and .NET 5+ environments.
Exploitability
Exploitation requires the attacker to control the MessagePack input stream and to have knowledge of available gadget types in the target application's assembly context. The CVSS vector (AV:N/AC:L/PR:N/UI:N) indicates network accessibility and low attack complexity. No user interaction or authentication is required. The practical difficulty depends on the availability of suitable gadget chains; many .NET libraries and the framework itself expose types capable of arbitrary code execution when deserialized. This is a practical remote vulnerability in many real-world deployments.
Remediation
Upgrade MessagePack for C# to version 2.5.301 or later for the v2.x branch, or to version 3.1.7 or later for the v3.x branch. The patched versions implement recursive type inspection, validating not only the outer type but also array element types and generic type parameters against the disallowed type list. After patching, validate that your application's package dependencies are correctly resolved and test deserialization of trusted payloads in staging before production deployment.
Patch guidance
Consult the official MessagePack-CSharp repository and NuGet package releases for v2.5.301 and v3.1.7. Update your project file or package management configuration to reference the patched version. If you are on a v2.x release, upgrade to 2.5.301; if on v3.x, upgrade to 3.1.7. The fix changes the internal validation logic to traverse nested type structures; no API changes are anticipated for applications using standard deserialization patterns. Verify compatibility in your test environment before rolling out broadly.
Detection guidance
Monitor for MessagePack deserialization exceptions or security audit logs indicating type validation failures (ThrowIfDeserializingTypeIsDisallowed being invoked). Grep your codebase for calls to typeless deserialization methods (e.g., MessagePackSerializer.Deserialize with typeof(object) or non-specific type parameters). Review network traffic or log files for unusual MessagePack messages with array or generic type wrappers where simple types are expected. In-depth detection may require custom instrumentation of MessagePack deserialization callbacks or dynamic type inspection at runtime.
Why prioritize this
HIGH severity due to the combination of network accessibility, low attack complexity, and integrity/code execution impact. The bypass of intended security controls transforms a protective mechanism into a false sense of security, making this a critical issue for any team relying on MessagePack typeless deserialization. The fix is straightforward and low-risk, justifying immediate patching within affected environments.
Risk score, explained
The CVSS 7.5 score reflects a network-accessible vulnerability (AV:N) with low attack complexity (AC:L) and no authentication or user interaction requirements. The impact is integrity and availability (I:H, A:N), corresponding to code execution potential. The vulnerability is not scored as critical (9.0+) because the attack surface is limited to applications explicitly using typeless deserialization; strongly-typed usage is unaffected. Organizations using the typeless features in security-sensitive contexts should treat this as effectively critical for their risk model.
Frequently asked questions
Does this vulnerability affect applications using strongly-typed MessagePack deserialization?
No. The vulnerability is specific to typeless deserialization paths. If your application always specifies a concrete type (e.g., MessagePackSerializer.Deserialize<MyClass>(bytes)), the type filtering mechanism is not invoked and you are not affected. Review your codebase for typeless patterns before assuming safety.
What types of gadget chains can be exploited through this vulnerability?
Any .NET type with dangerous behavior during construction or deserialization can potentially be exploited. Common gadget chains in the .NET ecosystem include types from System.Diagnostics (Process execution), System.Reflection (dynamic code generation), and application-specific types. The exact feasibility depends on what is loaded in the target process.
If we upgrade to the patched version, do we need to change our application code?
No code changes are required. The patched versions maintain API compatibility. The fix operates internally within the validation logic, so existing deserialization calls will continue to work as before, with stronger type safety guarantees.
Can we mitigate this vulnerability without upgrading if typeless deserialization is optional in our setup?
Yes. If you can disable typeless deserialization or restrict it to trusted inputs only, you reduce attack surface. However, upgrading is the permanent fix. Mitigation through configuration is temporary and relies on operational discipline.
This analysis is based on publicly disclosed CVE information and vendor advisories. Exploit code and detailed attack chains are not provided herein. Organizations should independently verify patch availability and compatibility with their environment before deployment. SEC.co makes no warranty regarding the completeness or timeliness of this information. Always consult the official MessagePack-CSharp project and your security team before making remediation decisions. Source: NVD (public-domain), retrieved 2026-07-28. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-48502HIGHMessagePack for C# Stack Overflow in Timestamp Parsing
- CVE-2025-11993HIGHWooCommerce Infinite Scroll Plugin PHP Object Injection – HIGH Severity
- CVE-2025-27511HIGHGeoServer DB2 JNDI Injection Remote Code Execution
- CVE-2025-69130HIGHPHP Object Injection in Entrepreneur WordPress Booking Theme ≤3.1.3
- CVE-2025-71339HIGHPicklescan Gadget Bypass Allows Arbitrary Code Execution
- CVE-2025-71341HIGHPicklescan Bypass Enables Remote Code Execution via profile.Profile.runctx
- CVE-2025-71344HIGHpicklescan RCE via Undetected ensurepip._run_pip
- CVE-2025-71348HIGHpicklescan Detection Evasion in Torch Config Loading