Skip to main content
Menu
Advisories

Process crash via a multipart request with many fields on the Express and Node adapters

GHSA-C8FR-C7PF-58PFPublished Updated GitHub

Description

FieldValue
Ecosystemnpm
Package@nestjs/platform-express, @nestjs/platform-node
Affected versions@nestjs/platform-express < 11.2.10 and >= 12.0.0, < 12.5.0; @nestjs/platform-node >= 12.3.0, < 12.5.0
Patched versions11.2.10 and 12.5.0
SeverityHigh
CVSS v3.1AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H (7.5)
CWECWE-770 (Allocation of Resources Without Limits or Throttling), CWE-400 (Uncontrolled Resource Consumption)

Summary

The upload interceptors of the Express and Node adapters set no default limit on the number of parts in a multipart request. A single request of a few megabytes could make the server allocate memory until the process ran out of heap and terminated.

Impact

Applications using @nestjs/platform-express (the default adapter) or @nestjs/platform-node are affected when a route uses FileInterceptor, FilesInterceptor, FileFieldsInterceptor, AnyFilesInterceptor or NoFilesInterceptor with the default limits. No authentication is needed unless a guard protects the route. The Fastify adapter is not affected in the same way, because @fastify/multipart limits the number of parts by default.

Patches

Fixed in 11.2.10 and 12.5.0. Multipart requests are now limited to 1000 parts by default (limits.parts), counting fields and files together. Applications that need more must raise limits.parts.

Workarounds

Set limits.parts (or limits.fields and limits.files) in MulterModule.register() or in the options of each upload interceptor.

Credit

Reported by Anthropic's OSS Scanner.

Affected versions

References

GitHub · nestjs/nest