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

CVE-2026-107302: msgpack5 Buffer Overflow Vulnerability

CVE-2026-107302 is a buffer overflow flaw in msgpack5 that causes unexpected termination of requests, streams, or workers due to improper header validation. This article covers technical details, affected versions, and mitigation.

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-107302 Overview

CVE-2026-107302 affects msgpack5, a msgpack v5 implementation for Node.js and the browser. The decoder reads the four-byte length field of a map32 value before confirming the complete five-byte header is available in the buffer. A truncated map32 header triggers a checked out-of-bounds buffer read that throws a RangeError instead of the expected IncompleteBufferError. Applications waiting for additional bytes after IncompleteBufferError can unexpectedly terminate the request, stream, or worker. The buffer implementation enforces bounds, so no adjacent memory is disclosed. The issue is fixed in version 6.1.0.

Critical Impact

A remote attacker can send a malformed msgpack payload with a truncated map32 header to crash streams, workers, or request handlers, producing a denial of service in services that rely on msgpack5 for decoding.

Affected Products

  • msgpack5 versions prior to 6.1.0
  • Node.js applications consuming msgpack-encoded input through msgpack5
  • Browser applications bundling msgpack5 for client-side decoding

Discovery Timeline

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

Technical Details for CVE-2026-107302

Vulnerability Analysis

The flaw is an out-of-bounds read [CWE-125] in the msgpack5 streaming decoder. The msgpack map32 type uses a five-byte header: a one-byte type marker (0xdf) followed by a four-byte big-endian length. The decoder attempts to read the four-byte length before validating that all five header bytes are present in the input buffer.

When only part of the header has arrived, the length read reaches past the end of the available slice. The underlying buffer guards against reading beyond its length and raises RangeError. Callers that implement incremental decoding expect IncompleteBufferError to signal they should wait for more data. Receiving a RangeError instead propagates as an unhandled exception, terminating the pipeline consuming the stream.

Root Cause

The decoder's header-size lookup table omitted an entry for the 0xdf (map32) marker. Without a declared header length, the length-validation branch (isValidDataSize) was bypassed for map32, and the decoder jumped directly to reading the 32-bit length field from a buffer that may not yet contain all five header bytes.

Attack Vector

An unauthenticated remote attacker sends a msgpack payload beginning with 0xdf followed by fewer than four bytes of length data. Any network-reachable endpoint that feeds untrusted bytes into msgpack5.decoder() is vulnerable. Successful exploitation does not require authentication, user interaction, or elevated privileges, and impacts availability only.

javascript
// Security patch - header length lookup table in dist/msgpack5.js and lib/decoder.js
   0xd9: 2,
   0xda: 3,
   0xdb: 5,
-  0xde: 3,
   0xdc: 3,
-  0xdd: 5
+  0xdd: 5,
+  0xde: 3,
+  0xdf: 5
 }

 function isValidDataSize (dataLength, bufLength, headerLength) {

The patch adds 0xdf: 5 to the header-length table so map32 payloads participate in the isValidDataSize check, producing IncompleteBufferError when the five-byte header is truncated. Source: GitHub Commit 15443a1.

Detection Methods for CVE-2026-107302

Indicators of Compromise

  • Node.js process logs showing uncaught RangeError exceptions originating from msgpack5 decoder frames
  • Repeated worker, stream, or HTTP handler restarts correlated with inbound msgpack traffic
  • Inbound payloads beginning with the byte 0xdf followed by fewer than four trailing bytes before connection close

Detection Strategies

  • Inventory application dependencies and flag any msgpack5 version earlier than 6.1.0 using software composition analysis
  • Instrument decoder call sites to log exception types; alert on RangeError from msgpack5 where IncompleteBufferError is expected
  • Inspect network or application traces for truncated msgpack map32 headers delivered to decoding endpoints

Monitoring Recommendations

  • Track process crash rates and worker respawn counts on services that decode msgpack over the network
  • Correlate 5xx response spikes with specific client sources sending malformed msgpack frames
  • Enable structured logging around msgpack5.decoder() consumers to capture exception type, source IP, and payload length

How to Mitigate CVE-2026-107302

Immediate Actions Required

  • Upgrade msgpack5 to version 6.1.0 or later across all Node.js services and bundled browser builds
  • Rebuild and redeploy any artifacts, container images, or lockfiles that pin a vulnerable transitive version
  • Add exception handling around decoder consumers so RangeError cannot terminate long-lived workers while rollout proceeds

Patch Information

The fix is published in msgpack5 v6.1.0. The maintainer added the missing 0xdf entry to the header-length lookup, forcing map32 payloads through isValidDataSize validation. Full details are available in GHSA-8f34-f56x-9xph.

Workarounds

  • Wrap msgpack5 decoder streams in a try/catch that treats RangeError as a recoverable incomplete-buffer condition until the upgrade is deployed
  • Enforce a maximum payload size and reject msgpack frames that do not contain complete headers at the network ingress layer
  • Restrict decoder exposure to authenticated clients where feasible to reduce the attack surface
bash
# Upgrade msgpack5 to the fixed version
npm install msgpack5@^6.1.0

# Verify the installed version
npm ls msgpack5

# Audit for remaining vulnerable transitive dependencies
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.