The vulnerability, identified as GHSA-g5hg-p3ph-g8qg and CVE-2025-48997, affects Multer versions >=1.4.4-lts.1 and <2.0.1. It allows an attacker to cause a Denial of Service (DoS) by sending a file upload request with an empty string field name. This action triggers an unhandled exception, crashing the application process.
The root cause, as revealed by the patch (commit 35a3272b611945155e046dd5cef11088587635e9), was insufficient validation of the fieldname within the file handling logic. The patch was applied to lib/make-middleware.js, specifically within the makeMiddleware function. This function sets up an event handler for busboy's 'file' event: busboy.on('file', function (fieldname, fileStream, ...) { ... }).
Before the patch, this event handler callback did not check if fieldname was null. If a request provided an empty or malformed field name that busboy (or an intermediate step) interpreted as null for the fieldname argument, the subsequent code within the callback would attempt to process it, leading to an unhandled exception and a process crash.
The fix introduces a check at the beginning of this callback: if (fieldname == null) return abortWithCode('MISSING_FIELD_NAME'). This ensures that if fieldname is null, the execution is gracefully handled by calling abortWithCode instead of proceeding to the vulnerable code path.
Therefore, the vulnerable function is effectively the anonymous callback for the busboy.on('file', ...) event, which is defined and managed within the scope of the makeMiddleware function. During runtime, an exploit would trigger the unhandled exception within this callback when it attempts to operate with a null fieldname.