CVE-2026-77063: multer vulnerable to file size limit bypass via async fileFilter race condition
Impact
When multer is configured with an asynchronous fileFilter, the limits.fileSize limit can be bypassed. The 'limit' event is registered inside the async fileFilter callback, so if a file exceeds limits.fileSize before that callback runs, the event is missed and the oversized upload is accepted instead of being rejected with a LIMITFILESIZE error. Applications that rely on limits.fileSize to reject oversized uploads are affected on all upload methods (.single(), .array(), .fields(), .any()). Uploads using a synchronous fileFilter are not affected.
Patches
Users should upgrade to 2.3.0.
Workarounds
Use a synchronous fileFilter, or validate the uploaded file size after the upload completes.
Other sources
multer is a middleware for handling multipart/form-data in Node.js. When an application uses an asynchronous fileFilter together with the fileSize limit, a race condition in multer's file stream handling can allow a file that exceeds the configured size limit to bypass the size-limit rejection. All versions before 2.3.0 are affected. The impact is limited because the underlying multipart parser still truncates the stream at the size limit, so this is a bypass of the limit rejection rather than uncontrolled resource consumption. The issue is fixed in multer 2.3.0. Upgrade to multer 2.3.0 to remediate.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/multerto a version that resolves this vulnerability.Fixed in 2.3.0 - Upgrade
Upgrade
multerto a version that resolves this vulnerability.Fixed in 2.3.0 - Configuration
If using multer with limits.fileSize, configure fileFilter as synchronous (not async) to avoid bypass of the fileSize limit.
multer fileFilter (async vs synchronous) = Use synchronous fileFilter - Compensating control
If an asynchronous fileFilter must be used, validate the uploaded file size after the upload completes, since limits.fileSize can be bypassed due to the async fileFilter race condition.
Event History
Frequently Asked Questions
Which applications are affected by this issue?
Applications using multer versions before 2.3.0 are affected only when they combine an asynchronous fileFilter with multer's fileSize limit.
What does an attacker need to exploit the bypass?
An attacker needs network access to an upload endpoint that uses the affected asynchronous fileFilter and fileSize configuration. No privileges or user interaction are required, but exploitation has high attack complexity.
Does this allow unrestricted file uploads or resource exhaustion?
No. The underlying multipart parser still truncates the upload stream at the configured size limit; the flaw bypasses the configured size-limit rejection rather than allowing uncontrolled resource consumption.
How can the issue be remediated?
Upgrade multer to version 2.3.0. This version fixes the asynchronous fileFilter race condition.