CVE-2026-35515
Description
Nest is a framework for building scalable Node.js server-side applications. Prior to 11.1.18, SseStream._transform() interpolates message.type and message.id directly into Server-Sent Events text protocol output without sanitizing newline characters (\r, \n). Since the SSE protocol treats both \r and \n as field delimiters and \n\n as event boundaries, an attacker who can influence these fields through upstream data sources can inject arbitrary SSE events, spoof event types, and corrupt reconnection state. This vulnerability is fixed in 11.1.18.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
@nestjs/corenpm | < 11.1.18 | 11.1.18 |
Affected products
1Patches
183558ae774a9Merge pull request #16686 from nestjs/fix/sanitize-sse-message
1 file changed · +6 −3
packages/core/router/sse-stream.ts+6 −3 modified@@ -97,9 +97,12 @@ export class SseStream extends Transform { encoding: string, callback: (error?: Error | null, data?: any) => void, ) { - let data = message.type ? `event: ${message.type}\n` : ''; - data += message.id ? `id: ${message.id}\n` : ''; - data += message.retry ? `retry: ${message.retry}\n` : ''; + const sanitize = (val: string | number) => + String(val).replace(/[\r\n]/g, ''); + + let data = message.type ? `event: ${sanitize(message.type)}\n` : ''; + data += message.id ? `id: ${sanitize(message.id)}\n` : ''; + data += message.retry ? `retry: ${sanitize(message.retry)}\n` : ''; data += message.data ? toDataString(message.data) : ''; data += '\n'; this.push(data);
Vulnerability mechanics
Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
6- github.com/advisories/GHSA-36xv-jgw5-4q75ghsaADVISORY
- github.com/nestjs/nest/security/advisories/GHSA-36xv-jgw5-4q75nvdVendor AdvisoryWEB
- nvd.nist.gov/vuln/detail/CVE-2026-35515ghsaADVISORY
- github.com/nestjs/nest/commit/83558ae774a990a7916141d3abe0b6548ff3a8b2ghsaWEB
- github.com/nestjs/nest/pull/16686ghsaWEB
- github.com/nestjs/nest/releases/tag/v11.1.18ghsaWEB
News mentions
0No linked articles in our index yet.