Skip to main content
Vulnerability Database/CVE-2026-107297

CVE-2026-107297: msgpack5 Denial of Service Vulnerability

CVE-2026-107297 is a denial of service vulnerability in msgpack5 that allows attackers to cause quadratic CPU usage and block the event loop. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-107297 Overview

CVE-2026-107297 is a denial-of-service vulnerability in msgpack5, a MessagePack v5 implementation for Node.js and the browser. The streaming decoder reparses incomplete arrays or maps from the beginning each time a new chunk arrives. A remote peer can split a valid MessagePack container across many small chunks, forcing already-decoded elements to be processed repeatedly. The resulting quadratic CPU cost blocks the Node.js event loop and starves the application of processing capacity. The issue is fixed in msgpack5 version 6.1.0.

Critical Impact

A remote unauthenticated attacker can block the Node.js event loop and cause sustained denial of service by streaming fragmented MessagePack containers to any service that uses the vulnerable streaming decoder.

Affected Products

  • msgpack5 Node.js package prior to version 6.1.0
  • Node.js server applications consuming MessagePack streams with msgpack5
  • Browser applications decoding streamed MessagePack data via msgpack5

Discovery Timeline

  • 2026-10-08 - CVE CVE-2026-107297 published to the National Vulnerability Database
  • 2026-10-08 - Last updated in NVD database

Technical Details for CVE-2026-107297

Vulnerability Analysis

The flaw is an algorithmic complexity issue [CWE-407] in the streaming decode path. When msgpack5 receives a partial array or map and the current buffer does not contain the full container, the decoder throws an IncompleteBufferError and discards partial progress. When additional bytes arrive, the decoder restarts from offset zero and re-decodes every element already processed.

For a container of N elements delivered in N chunks, the decoder performs on the order of N^2 element decodes. Each pass walks the full prefix of the container, producing CPU work that scales quadratically with element count. Because Node.js executes JavaScript on a single-threaded event loop, this synchronous work blocks all other request handling for the duration of the decode.

Root Cause

The decode function in lib/decoder.js accepted only a buffer and used tryDecode(buf, 0, context, 0), restarting at offset zero on every invocation. It had no persistent state to track which elements of a container were already decoded. Repeated calls against a growing buffer therefore repeated prior work rather than resuming from the last successful position.

Attack Vector

An attacker who can send MessagePack-encoded data to a vulnerable server crafts a single valid container with a large element count and transmits it in small TCP or WebSocket chunks. Each chunk triggers a full re-decode of the elements received so far. No authentication is required, and the attack succeeds against any endpoint that feeds streamed input into msgpack5.

javascript
// Security patch in lib/decoder.js - decode streaming containers incrementally
   const context = { decodingTypes, options, maxDepth, decode }
   return decode
 
-  function decode (buf) {
+  function decode (buf, decodeState) {
     if (!bl.isBufferList(buf)) {
       buf = bl(buf)
     }
 
-    const result = tryDecode(buf, 0, context, 0)
+    let result
+    try {
+      result = decodeState
+        ? tryDecodeIncremental(buf, decodeState, context)
+        : tryDecode(buf, 0, context, 0)
+    } catch (err) {
+      if (decodeState) decodeState.stack.length = 0
+      throw err
+    }
+
     // Handle worst case ASAP and keep code flat
     if (!result) throw new IncompleteBufferError()
 
-    buf.consume(result[1])
+    if (!decodeState) buf.consume(result[1])
     return result[0]
   }
 }
 
+function tryDecodeIncremental (buf, state, context) {
// Source: https://github.com/mcollina/msgpack5/commit/e4827641d3105e295cbbd56e9c5389978547eab4

The patch introduces tryDecodeIncremental and a decodeState object that preserves a decode stack across invocations. Buffer consumption is deferred to the incremental path, so prior work is retained when more data arrives.

Detection Methods for CVE-2026-107297

Indicators of Compromise

  • Sustained 100% CPU usage on a single Node.js worker correlated with inbound MessagePack traffic
  • Event loop lag metrics spiking into the hundreds of milliseconds or seconds during normal request volume
  • Many small TCP or WebSocket frames from one source carrying MessagePack payloads that never complete a container
  • Health check timeouts and request queue growth on services exposing MessagePack endpoints

Detection Strategies

  • Inventory Node.js applications and audit package-lock.json or yarn.lock for msgpack5 versions prior to 6.1.0
  • Instrument the Node.js event loop with libraries such as perf_hooks monitorEventLoopDelay and alert on sustained latency above baseline
  • Inspect network telemetry for sources sending many small frames to MessagePack endpoints without completing messages

Monitoring Recommendations

  • Track per-connection decode duration and byte-to-time ratios for MessagePack ingestion paths
  • Alert on CPU-bound Node.js processes that correlate with specific client IP addresses or session identifiers
  • Forward application and network logs to a centralized analytics platform to correlate chunking patterns with CPU anomalies

How to Mitigate CVE-2026-107297

Immediate Actions Required

  • Upgrade msgpack5 to version 6.1.0 or later in all Node.js services and front-end builds
  • Rebuild and redeploy container images and bundled browser artifacts that embed the vulnerable dependency
  • Place rate limits and maximum message size caps in front of any public MessagePack endpoint
  • Review the GitHub Security Advisory GHSA-gcx5-hxj7-gpqq for the full vendor guidance

Patch Information

The fix ships in msgpack5 release v6.1.0 and is implemented in commit e4827641. The decoder now accepts a decodeState parameter and uses tryDecodeIncremental to resume parsing from the last completed element rather than restarting at offset zero.

Workarounds

  • Buffer incoming MessagePack bytes until a complete message is received before calling decode, bypassing the vulnerable streaming code path
  • Enforce strict upper bounds on container element counts and total payload size at the application layer
  • Terminate connections from clients that send unusually fragmented or slow MessagePack streams
bash
# Upgrade msgpack5 to the patched release
npm install msgpack5@^6.1.0

# Verify the installed version
npm ls msgpack5

# Audit the full dependency tree for remaining vulnerable copies
npm audit --production

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.