CVE-2026-40879: Nest Affected by DoS via Recursive handleData in JsonSocket (TCP Transport)

CVE-2026-40879 · Severity: high · CVSS 7.5 · Published 2026-04-21

NestJS Microservices is a library used to build scalable, distributed applications with message-based communication. An attacker can send specially crafted TCP messages containing many small JSON objects in a single frame, causing the JSON parser to recursively process each message and exhaust the application's call stack, resulting in a denial of service crash.

Technologies: NestJS Nest. Vendors: NestJS, npm.

Quick answers

Is CVE-2026-40879 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-40879 being exploited in the wild.
How severe is CVE-2026-40879?
High severity, with a CVSS score of 7.5, published 21 April 2026.
Which products and versions are affected?
NestJS Microservices <= 11.1.18; @nestjs/microservices (npm) <= 11.1.18, SEMVER:introduced=0,fixed=11.1.19.
Is there a fix for CVE-2026-40879?
Yes. @nestjs/microservices (npm): upgrade to 11.1.19 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-40879 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-40879?
Check whether you run NestJS Microservices, NestJS Nest or @nestjs/microservices (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • @nestjs/microservices (npm): upgrade to 11.1.19 or later
    npm install @nestjs/microservices@11.1.19

Technical details

The vulnerability is a stack overflow (CWE-674, CWE-770) in the JsonSocket TCP transport handler. The handleData() method recurses once per JSON message in the buffer, and each recursion shrinks the buffer without ever reaching the configured maxBufferSize limit. An attacker can send approximately 47 KB of valid JSON messages in a single TCP frame to trigger a RangeError and crash the application. The attack requires network access to the microservice but no authentication or user interaction. The issue is fixed in @nestjs/microservices version 11.1.19.

Affected products

  • NestJS Microservices <= 11.1.18

Identifiers

  • CVE-2026-40879
  • GHSA-hpwf-8g29-85qm

Timeline

  • 2026-04-14: disclosed: GitHub Security Advisory published
  • 2026-04-14: patched: Fixed in @nestjs/microservices@11.1.19

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.