Skip to main content
Vulnerability Database/CVE-2024-37168

CVE-2024-37168: gRPC-JS Memory Allocation DOS Vulnerability

CVE-2024-37168 is a denial of service vulnerability in gRPC-JS that allows memory exhaustion through oversized messages. 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-2024-37168 Overview

CVE-2024-37168 is a resource allocation vulnerability in @grpc/grpc-js, the pure JavaScript implementation of gRPC for Node.js. The flaw allows attackers to force memory allocation in excess of the configured grpc.max_receive_message_length channel option through two distinct code paths. Oversized messages are fully buffered before being discarded, and compressed messages that decompress beyond the limit are fully decompressed into memory. On the server, decompressed oversized messages are not discarded. The vulnerability maps to [CWE-789: Memory Allocation with Excessive Size Value]. Maintainers patched the issue in versions 1.10.9, 1.9.15, and 1.8.22.

Critical Impact

Remote unauthenticated attackers can trigger excessive memory allocation on gRPC servers and clients, enabling denial-of-service conditions through resource exhaustion.

Affected Products

  • @grpc/grpc-js versions prior to 1.8.22 (1.8.x branch)
  • @grpc/grpc-js versions prior to 1.9.15 (1.9.x branch)
  • @grpc/grpc-js versions prior to 1.10.9 (1.10.x branch)

Discovery Timeline

  • 2024-06-10 - CVE-2024-37168 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-37168

Vulnerability Analysis

The @grpc/grpc-js library enforces an inbound message size limit via the grpc.max_receive_message_length channel option. Prior to the patched versions, the enforcement happened too late in the receive pipeline. Two code paths violate the intended limit.

First, when an incoming message's wire size exceeds the configured limit, the implementation reads and buffers the entire message in memory before dropping it. Second, when a message is within the wire-size limit but decompresses to a payload larger than the limit, the library decompresses the full payload into memory. On the server side, the oversized decompressed payload is retained rather than discarded. Both behaviors enable an attacker to force allocation of attacker-controlled memory volumes per request.

Root Cause

The root cause is the placement of size enforcement after full message materialization rather than during streaming reception. The MaxMessageSizeFilter (defined in packages/grpc-js/src/max-message-size-filter.ts) applied limits after the message was already assembled or decompressed. Compressed payloads additionally bypassed any pre-decompression size estimation, allowing a small compressed message to expand into a large in-memory buffer. This is a classic resource allocation flaw tracked under [CWE-789].

Attack Vector

An unauthenticated remote attacker sends crafted gRPC messages to a vulnerable server or responds to a client with oversized or highly compressible payloads. By repeatedly sending such messages, the attacker drives memory consumption upward until the Node.js process exhausts available heap and crashes or becomes unresponsive. The attack requires only network reachability to a gRPC endpoint using @grpc/grpc-js.

typescript
// Patch excerpt: packages/grpc-js/src/internal-channel.ts
// The MaxMessageSizeFilterFactory import and filter were removed and
// replaced by streaming-time enforcement in the call pipeline.

 import { trace } from './logging';
 import { SubchannelAddress } from './subchannel-address';
-import { MaxMessageSizeFilterFactory } from './max-message-size-filter';
 import { mapProxyName } from './http_proxy';
 import { GrpcUri, parseUri, uriToString } from './uri-parser';
 import { ServerSurfaceCall } from './server-call';

// Patch excerpt: packages/grpc-js/src/max-message-size-filter.ts (file deleted)
-export class MaxMessageSizeFilter extends BaseFilter implements Filter {
-  private maxSendMessageSize: number = DEFAULT_MAX_SEND_MESSAGE_LENGTH;
-  private maxReceiveMessageSize: number = DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;

Source: gRPC Node Commit 08b0422 and GitHub Security Advisory GHSA-7v5v-9h63-cj86. The fix removes the deferred filter-based enforcement and relocates size checking directly into the call pipeline so oversized or over-decompressed messages are rejected before full materialization.

Detection Methods for CVE-2024-37168

Indicators of Compromise

  • Sustained or sudden Node.js heap growth on processes hosting gRPC services, often correlated with inbound gRPC traffic bursts.
  • Repeated gRPC requests from the same peer carrying payloads near or exceeding the configured grpc.max_receive_message_length.
  • Inbound gRPC messages with unusually high compression ratios (small wire size, large decompressed size).
  • Node.js process restarts or out-of-memory (FATAL ERROR: JavaScript heap out of memory) events on gRPC endpoints.

Detection Strategies

  • Inventory Node.js services and dependency manifests (package-lock.json, yarn.lock) for @grpc/grpc-js versions below 1.8.22, 1.9.15, or 1.10.9.
  • Instrument gRPC servers with per-request size and decompression ratio metrics to flag outliers that would have been rejected by a properly enforced limit.
  • Correlate heap usage spikes with gRPC request logs to identify abuse patterns.

Monitoring Recommendations

  • Alert on Node.js process.memoryUsage().heapUsed crossing baseline thresholds on gRPC workloads.
  • Monitor for repeated connection resets or RESOURCE_EXHAUSTED status codes from gRPC services.
  • Track dependency drift using software composition analysis (SCA) tooling to catch regressions to unpatched @grpc/grpc-js versions.

How to Mitigate CVE-2024-37168

Immediate Actions Required

  • Upgrade @grpc/grpc-js to 1.10.9, 1.9.15, or 1.8.22 or later, matching your current minor version line.
  • Rebuild and redeploy all Node.js services that transitively depend on @grpc/grpc-js, including those pulling it in through other libraries.
  • Audit lockfiles after upgrade to confirm no nested dependency resolves to a vulnerable version.

Patch Information

The fix is delivered across three branches via commits 08b0422, 674f4e3, and a8a0203. The patches delete max-message-size-filter.ts and move receive-size enforcement into the call pipeline so oversized or over-decompressed messages are rejected before full buffering. Full advisory details are available in GitHub Security Advisory GHSA-7v5v-9h63-cj86.

Workarounds

  • Place a gRPC-aware proxy or API gateway in front of exposed services to enforce request size limits before traffic reaches Node.js.
  • Restrict network exposure of gRPC endpoints to trusted clients using firewall rules or mutual TLS until patching is complete.
  • Disable or restrict gRPC compression on untrusted channels to limit decompression-bomb amplification.
bash
# Upgrade @grpc/grpc-js to a patched version
npm install @grpc/grpc-js@^1.10.9

# Verify the installed version and surface vulnerable transitive dependencies
npm ls @grpc/grpc-js
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.