Skip to main content

Nest.js CVE-2026-40879

HIGH
Uncontrolled Recursion (CWE-674)
2026-04-21 GitHub_M GHSA-hpwf-8g29-85qm
7.5
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Establish TCP connection to Nest.js endpoint
  2. Delivery
    Send 47 KB frame with 100+ small JSON messages
  3. Exploit
    Trigger recursive handleData() processing
  4. Execution
    Exhaust call stack
  5. Impact
    RangeError crash terminates Node.js process

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Recursion depth limits
Exploitation Conditions

Requires target application to use Nest.js versions prior to 11.1.19 with TCP-based message handling enabled for JSON payloads. Vulnerability triggers specifically when processing concatenated small JSON messages within a single TCP frame rather than traditional large-buffer attacks. Applications using HTTP-only request/response patterns without persistent TCP connections (pure RESTful JSON over standard HTTP libraries) may have reduced attack surface, though microservices using @nestjs/microservices with TCP transport are primary targets. No special network positioning required-any network path allowing TCP connection establishment to vulnerable endpoints enables exploitation (AV:N). No authentication, user interaction, or non-default configuration needed (PR:N/UI:N); default Nest.js installations processing JSON over TCP are exploitable.

Impact

Real-world risk is MODERATE despite 7.5 CVSS score. Attack vector is network-accessible with low complexity and no authentication (AV:N/AC:L/PR:N/UI:N), making exploitation trivial for remote attackers. However, impact is purely availability (C:N/I:N/A:H)-no data exfiltration or code execution. The 47 KB payload threshold is extremely low, enabling resource-efficient attacks against internet-facing Nest.js APIs. No public exploit code confirmed at time of analysis, and absence from CISA KEV suggests no widespread exploitation observed. SSVC assessment: exploitation status unknown, likely automatable given simplicity, technical impact limited to service crash. Priority depends on application criticality: HIGH for customer-facing production APIs where availability is business-critical, MEDIUM for internal services with redundancy. The ease of exploitation (single malformed TCP packet) and prevalence of Nest.js in modern microservices architectures elevate practical risk beyond a simple DoS.

Exploit ScenarioDerived

An attacker identifies a publicly accessible Nest.js API endpoint (e.g., REST or GraphQL service) and crafts a TCP packet containing approximately 100 small valid JSON objects (total ~47 KB) concatenated without separators. When this single frame arrives at the handleData() function, recursive parsing begins-each message triggers a new stack frame until the call stack overflows around message 95-100, throwing RangeError and crashing the Node.js worker process. The attacker repeats this low-bandwidth attack (under 50 KB per request) against all worker instances, achieving sustained denial of service with minimal resources. Public exploit code not identified at time of analysis, but attack implementation is straightforward given detailed vulnerability description.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Apr 21, 2026

Remote attackers can crash Nest.js applications (versions prior to 11.1.19) by sending approximately 47 KB of fragmented JSON messages within a single TCP frame, triggering a call stack overflow. The handleData() function's recursive processing of small valid JSON messages causes stack exhaustion before maxBufferSize limits are enforced, resulting in RangeError and denial of service. No authentication required (CVSS AV:N/PR:N). Vendor patch released in version 11.1.19. EPSS data not available; no confirmed active exploitation (not in CISA KEV).

RemediationAI

Upgrade Nest.js to version 11.1.19 or later, which implements iterative message processing to prevent call stack overflow. Update package.json dependency to "@nestjs/core": "^11.1.19" and run npm install or yarn install, followed by application restart. Review the GitHub security advisory at https://github.com/nestjs/nest/security/advisories/GHSA-hpwf-8g29-85qm for complete upgrade instructions. If immediate patching is not feasible, implement compensating controls: (1) Deploy application-layer rate limiting to restrict TCP connections per source IP (limit 10 connections/minute), which reduces attack surface but may impact legitimate high-volume clients; (2) Configure upstream reverse proxy (nginx/HAProxy) with client_body_buffer_size limits and connection timeouts to reject oversized or slow requests-note this may false-positive on mobile clients with variable connectivity; (3) Enable process monitoring with automatic restart policies (PM2, Kubernetes liveness probes) to recover from crashes within seconds, though this only mitigates availability impact without preventing exploitation.

Affected Packages

npm @nestjs/microservices fix: 11.1.19

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Nest.js is a progressive Node.js framework for building server-side applications, using TypeScript and following Angular-like architectural patterns. This vulnerability (CWE-674: Uncontrolled Recursion) resides in the TCP message parsing layer where handleData() processes incoming data streams. When multiple small, well-formed JSON messages arrive concatenated in a single TCP frame, the parser enters recursive processing-shrinking the buffer incrementally with each parsed message rather than iterating. The recursion depth correlates with message count, not total payload size, allowing attackers to bypass the maxBufferSize protection mechanism entirely. The call stack exhausts before buffer size limits trigger, causing JavaScript runtime RangeError exceptions that crash the Node.js process.

Know when Nest gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 7.5 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Primary rating from Vendor (GitHub_M) · only source for this CVE.

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

Lifecycle Timeline

2
Patch released
Apr 21, 2026 - 20:30 nvd
Patch available
CVE Published
Apr 21, 2026 - 19:14 nvd
HIGH 7.5

DescriptionCVE.org

Nest is a framework for building scalable Node.js server-side applications. Prior to 11.1.19, when an attacker sends many small, valid JSON messages in one TCP frame, handleData() recurses once per message; the buffer shrinks each call. maxBufferSize is never reached; call stack overflows instead. A ~47 KB payload is sufficient to trigger RangeError. This vulnerability is fixed in 11.1.19.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 2 npm packages depend on @nestjs/microservices (2 direct, 0 indirect)

Ecosystem-wide dependent count for version 11.1.19.

Executive ViewAI

Why It Matters

Nest.js applications running versions before 11.1.19 are vulnerable to unauthenticated remote denial-of-service attacks where attackers can crash services by sending specially crafted fragmented JSON payloads. This vulnerability affects any internet-facing Nest.js application and could disrupt business operations by making services unavailable to legitimate users.

Business Impact: High
Compensating Controls

Pending vendor patch deployment: implement network-level rate limiting on JSON message ingestion, configure reverse proxy buffer size limits below 47 KB per connection, and establish connection timeout policies to interrupt sustained fragmented message attacks. Monitor application logs for RangeError stack overflow events. Apply vendor patch as primary remediation once version 11.1.19 is available and tested.

Threat Intelligence Overview

EPSS Score
0.0%
Top 88% exploitable
Threat Intel
1
1 source
Data Quality
5 sources
Confidence: Medium
NVD CVE.org EPSS Vulnrichment GHSA GitHub

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
Yes
Human Impact
High
Technical Impact
Partial

Priority Score

38
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +38
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.

Affected Products (CPE)CVE.org

cpe:2.3:a:nestjs:nest:*:*:*:*:*:*:*:*

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy