---
id: "GHSA-q223-fc7f-xg75"
page: "https://infrastack.ai/live/GHSA-q223-fc7f-xg75"
kind: "vulnerability"
aliases: ["GHSA-q223-fc7f-xg75"]
title: "Process crash when a handler returns a stream that fails before it is read"
severity: "high"
cvss: null
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "@nestjs/core", "fixed": ["12.5.0"], "affected": ">= 12.4.0, < 12.5.0", "ecosystem": "npm"}]
ecosystems: ["npm"]
tags: ["cwe-248", "nestjs", "node", "npm", "package", "self-hosted"]
not_affected_if: ["no-readable-return", "pre-12.4.0", "streamable-file"]
published_at: "2026-11-12T19:03:53+00:00"
first_seen_at: "2026-11-12T19:14:24+00:00"
updated_at: "2026-11-12T19:15:45+00:00"
sources: [{"source": "ghsa-repo", "url": "https://github.com/nestjs/nest/security/advisories/GHSA-q223-fc7f-xg75", "first_seen_at": "2026-11-12T19:14:24+00:00"}]
exploit_sources: []
---

# Process crash when a handler returns a stream that fails before it is read

Link for people: https://infrastack.ai/live/GHSA-q223-fc7f-xg75 (this .md is for agents)

When a NestJS route handler returns a Node.js Readable stream that fails before it is read, such as a missing file, the error goes unhandled and terminates the process. A single HEAD request or an early client disconnect is enough to crash the server.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- npm:@nestjs/core affected >= 12.4.0, < 12.5.0 fixed 12.5.0

## How to check

- Check the installed version with `npm ls @nestjs/core`; affected versions are `>= 12.4.0, < 12.5.0`.
- Search the code for route handlers that return a `Readable` (for example `fs.createReadStream`) on paths a client can influence, without a `StreamableFile` wrapper or an interceptor on that route.

## Fix

- `@nestjs/core`: `12.5.0`
- Workaround named in the advisory: wrap the stream in a `StreamableFile`, or check that the file exists before opening the stream.

## Timeline

- 2026-11-12T19:14:24+00:00 ghsa-repo https://github.com/nestjs/nest/security/advisories/GHSA-q223-fc7f-xg75

## Documents

- [advisory] Maintainer's advisory: github.com https://github.com/nestjs/nest/security/advisories/GHSA-q223-fc7f-xg75

## From the sources

| Field | Value |
| --- | --- |
| Ecosystem | npm |
| Package | `@nestjs/core` |
| Affected versions | `>= 12.4.0, < 12.5.0` |
| Patched versions | `12.5.0` |
| Severity | High |
| CVSS v3.1 | `AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H` (7.5) |
| CWE | CWE-248 (Uncaught Exception) |

### Summary

Since 12.4.0, a route handler may return a Node.js `Readable` stream. A stream that failed before it was read, for example `fs.createReadStream()` of a file that does not exist, raised an error that nothing handled, which terminated the process. A single `HEAD` request, or a client that disconnected before the first chunk, was enough.

### Impact

Applications on 12.4.x that return a `Readable` from a handler, for a path a client can influence, and bind no interceptor to that route are affected, on every HTTP adapter. No authentication is needed unless a guard protects the route. Versions before 12.4.0 do not support returning a `Readable` this way.

### Patches

Fixed in **12.5.0**. The router now handles the errors of every stream it holds, including streams it stops without reading.

### Workarounds

Wrap the stream in a `StreamableFile`, or check that the file exists before opening the stream.

### Credit

Reported by Anthropic's OSS Scanner.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
