Skip to content

🚨 [security] [backend] Update multer 1.4.3 → 2.4.0 (major) - #549

Open
depfu[bot] wants to merge 1 commit into
mainfrom
depfu/update/backend/npm/multer-2.4.0
Open

depfu[bot] wants to merge 1 commit into
mainfrom
depfu/update/backend/npm/multer-2.4.0

Conversation

@depfu

@depfu depfu Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

🚨 Your current dependencies have known security vulnerabilities 🚨

This dependency update fixes known security vulnerabilities. Please see the details below and assess their impact carefully. We recommend to merge and deploy this as soon as possible!


Here is everything you need to know about this upgrade. Please take a good look at what changed and the test results before merging this pull request.

What changed?

✳️ multer (1.4.3 → 2.4.0) · Repo · Changelog

Security Advisories 🚨

🚨 multer vulnerable to Denial of Service via crafted multipart field names

Impact

A vulnerability in multer allows a remote, unauthenticated attacker to crash the Node.js process with a single multipart/form-data request. Two specially crafted text field names cause an uncaught RangeError: Invalid array length inside multer's field parsing, which is not routed to the application error handler and terminates the process. All applications using multer to parse multipart requests are affected.

Patches

Users should upgrade to 2.3.0.

Workarounds

None.

🚨 multer vulnerable to Denial of Service via file descriptor leak on aborted uploads

Impact

A vulnerability in multer 2.2.0 allows an attacker to trigger a Denial of Service (DoS) by aborting or truncating multipart uploads. When using diskStorage, the destination write stream is not closed if the upload is aborted before it finishes, so each failed request leaks an open file descriptor and retains its disk blocks until the process exits. Repeated failed uploads can exhaust the available file descriptors. All applications using multer's disk storage are affected.

Patches

Users should upgrade to 2.3.0.

Workarounds

None.

🚨 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 LIMIT_FILE_SIZE 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.

🚨 multer vulnerable to Denial of Service via oversized array index in field names

Impact

multer is vulnerable to a Denial of Service (DoS) via a crafted array index in multipart field names. The append-field dependency parses bracket notation in field names, and a large numeric index such as items[4294967294] forces allocation of a maximum-length sparse array. A following field with a non-numeric key on the same base then converts that array to an object by iterating its full length, which consumes CPU synchronously and leaves the process unable to handle other requests. A single HTTP request with a crafted multipart body is sufficient to exploit this, and it affects multer 1.x and 2.x.

Patches

Users should upgrade to 2.3.0 and configure limits.fieldArrayIndexLimit to the minimum array index their application requires.

Workarounds

None.

🚨 Multer vulnerable to Denial of Service via incomplete cleanup of aborted uploads

Impact

A vulnerability in Multer allows an attacker to trigger a Denial of Service (DoS) by aborting or sending malformed multipart uploads, causing orphaned partial files to accumulate on disk when using diskStorage.

Patches

Users should upgrade to 2.2.0, 3.0.0-alpha.2 or higher

Workarounds

None

🚨 Multer vulnerable to Denial of Service via deeply nested field names

Impact

Multer is vulnerable to a Denial of Service (DoS) via deeply nested field names in multipart form data. The append-field dependency parses bracket notation in field names (e.g., a[b][c]) with no limit on nesting depth, allowing an attacker to force allocation of deeply nested object structures that consume CPU and memory. A single HTTP request with a crafted multipart body is sufficient to exploit this.

Patches

Users should upgrade to 2.2.0 and configure limits.fieldNestingDepth to the minimum depth their application requires.

Workarounds

Set limits.fields to a reasonable value to reduce the number of fields an attacker can send per request. This does not fully mitigate the issue but limits the impact.

🚨 Multer Vulnerable to Denial of Service via Uncontrolled Recursion

Impact

A vulnerability in Multer versions < 2.1.1 allows an attacker to trigger a Denial of Service (DoS) by sending malformed requests, potentially causing stack overflow.

Patches

Users should upgrade to 2.1.1

Workarounds

None

Resources

🚨 Multer vulnerable to Denial of Service via resource exhaustion

Impact

A vulnerability in Multer versions < 2.1.0 allows an attacker to trigger a Denial of Service (DoS) by dropping connection during file upload, potentially causing resource exhaustion.

Patches

Users should upgrade to 2.1.0

Workarounds

None

🚨 Multer vulnerable to Denial of Service via incomplete cleanup

Impact

A vulnerability in Multer versions < 2.1.0 allows an attacker to trigger a Denial of Service (DoS) by sending malformed requests, potentially causing resource exhaustion.

Patches

Users should upgrade to 2.1.0

Workarounds

None

🚨 Multer vulnerable to Denial of Service via unhandled exception from malformed request

Impact

A vulnerability in Multer versions >= 1.4.4-lts.1, < 2.0.2 allows an attacker to trigger a Denial of Service (DoS) by sending a malformed request. This request causes an unhandled exception, leading to a crash of the process.

Patches

Users should upgrade to 2.0.2

Workarounds

None

🚨 Multer vulnerable to Denial of Service via unhandled exception

Impact

A vulnerability in Multer versions >=1.4.4-lts.1, <2.0.1 allows an attacker to trigger a Denial of Service (DoS) by sending an upload file request with an empty string field name. This request causes an unhandled exception, leading to a crash of the process.

Patches

Users should upgrade to 2.0.1

Workarounds

None

References

35a3272
#1233
#1256

🚨 Multer vulnerable to Denial of Service via memory leaks from unclosed streams

Impact

Multer <2.0.0 is vulnerable to a resource exhaustion and memory leak issue due to improper stream handling. When the HTTP request stream emits an error, the internal busboy stream is not closed, violating Node.js stream safety guidance.

This leads to unclosed streams accumulating over time, consuming memory and file descriptors. Under sustained or repeated failure conditions, this can result in denial of service, requiring manual server restarts to recover. All users of Multer handling file uploads are potentially impacted.

Patches

Users should upgrade to 2.0.0

Workarounds

None

References

🚨 Multer vulnerable to Denial of Service from maliciously crafted requests

Impact

A vulnerability in Multer versions >=1.4.4-lts.1 allows an attacker to trigger a Denial of Service (DoS) by sending a malformed multi-part upload request. This request causes an unhandled exception, leading to a crash of the process.

Patches

Users should upgrade to 2.0.0

Workarounds

None

References

Release Notes

2.4.0

Highlights

multer finally supports Google Cloud Functions and Firebase 🎉

These platforms read the request body before your code runs, so multer's classic req.pipe(busboy) received nothing: empty req.body, empty req.files, and nearly a decade of duplicated issues.

The new streamHandler option closes that gap: you decide how the body reaches the parser, so the pre-read rawBody just works (see image).

const multer = require('multer')

const upload = multer({
storage: multer.memoryStorage(),
streamHandler: (req, busboy) => {
// Cloud Functions / Firebase expose the pre-read body here
if (req.rawBody) busboy.end(req.rawBody)
else req.pipe(busboy)
}
})

app.post('/upload', upload.single('file'), (req, res) => {
res.json({ name: req.file.originalname, size: req.file.size })
})

This landed thanks to community PRs going back to 2017; their authors are credited as co-authors in the release.

Important: Security

What's Changed

New Contributors

Full Changelog: v2.3.0...v2.4.0

2.3.0

Important

What's Changed

New Contributors

Full Changelog: v2.2.0...v2.3.0

2.2.0

Important

What's Changed

New Contributors

Full Changelog: v2.1.1...v2.2.0

2.1.1

Important

What's Changed

New Contributors

Full Changelog: v2.1.0...v2.1.1

2.1.0

Important

What's Changed

New Contributors

Full Changelog: v2.0.2...v2.1.0

2.0.2

Important

Full Changelog: v2.0.1...v2.0.2

2.0.1

Important

What's Changed

New Contributors

Full Changelog: v2.0.0...v.2.0.1

2.0.0

Important

What's Changed

  • 🐛 drain stream. fixes regression in node 18, remove old CI, set minimum node version, fix readme badges, add .npmrc
  • fix: handle two busboy error events
  • ♻️ fully drain stream
  • 🥅 explicitly handle req error
  • 🚨 lint:fix
  • ⬆️ bump mocha
  • docs: include release 2.0.0 details

1.4.4 (from changelog)

  • Bugfix: Handle missing field names (#913)
  • Docs: Add Vietnamese translation (#803)
  • Docs: Improve Spanish translation (#948)

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

↗️ busboy (indirect, 0.2.14 → 1.6.0) · Repo

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

↗️ streamsearch (indirect, 0.1.2 → 1.1.0) · Repo

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

🗑️ buffer-from (removed)

🗑️ concat-stream (removed)

🗑️ core-util-is (removed)

🗑️ dicer (removed)

🗑️ isarray (removed)

🗑️ mkdirp (removed)

🗑️ process-nextick-args (removed)

🗑️ readable-stream (removed)

🗑️ string_decoder (removed)

🗑️ typedarray (removed)

🗑️ util-deprecate (removed)

🗑️ xtend (removed)


👉 No CI detected

You don't seem to have any Continuous Integration service set up!

Without a service that will test the Depfu branches and pull requests, we can't inform you if incoming updates actually work with your app. We think that this degrades the service we're trying to provide down to a point where it is more or less meaningless.

This is fine if you just want to give Depfu a quick try. If you want to really let Depfu help you keep your app up-to-date, we recommend setting up a CI system:

* [Circle CI](https://circleci.com), [Semaphore ](https://semaphoreci.com) and [Github Actions](https://docs.github.com/actions) are all excellent options. * If you use something like Jenkins, make sure that you're using the Github integration correctly so that it reports status data back to Github. * If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with `depfu/`.

Depfu Status

Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with @depfu rebase.

All Depfu comment commands
@​depfu rebase
Rebases against your default branch and redoes this update
@​depfu recreate
Recreates this PR, overwriting any edits that you've made to it
@​depfu merge
Merges this PR once your tests are passing and conflicts are resolved
@​depfu cancel merge
Cancels automatic merging of this PR
@​depfu close
Closes this PR and deletes the branch
@​depfu reopen
Restores the branch and reopens this PR (if it's closed)
@​depfu pause
Ignores all future updates for this dependency and closes this PR
@​depfu pause [minor|major]
Ignores all future minor/major updates for this dependency and closes this PR
@​depfu resume
Future versions of this dependency will create PRs again (leaves this PR as is)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants