Express-FileUpload Arbitrary File Overwrite (CVE-2022-27261)

express-fileupload Updated 02 Oct 2025

Summary

13/04/2022
No i
High
7.5

CVE-2022-27261: Express-FileUpload Arbitrary File Overwrite. Affects express-fileupload versions < 1.3.1. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Express-FileUpload is an npm package used for file uploads in web applications. It provides a convenient way to handle file uploads and is commonly used in Node.js applications. However, a vulnerability has been discovered in version 1.3.1 of Express-FileUpload that allows attackers to upload multiple files with the same name, resulting in the overwrite of existing files on the web application server.

Vulnerability Detail

The vulnerability in Express-FileUpload v1.3.1 allows attackers to exploit the file upload functionality to overwrite existing files on the server. By uploading multiple files with the same name, the attacker can overwrite important files, potentially leading to data loss or unauthorized access. The package author has debated the existence of this vulnerability, but it has been confirmed and reported as CVE-2022-27261.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

If upgrading to a safe version is not immediately possible, a temporary workaround is to implement file name validation on the server-side. By checking for duplicate file names and rejecting uploads with the same name, you can prevent the overwrite vulnerability. Here's an example of how to implement file name validation in Node.js:

const express = require('express');
const fileUpload = require('express-fileupload');

const app = express();

app.use(fileUpload());

app.post('/upload', (req, res) => {
  const files = req.files;

  // Check for duplicate file names
  const fileNames = files.map(file => file.name);
  const duplicateFileNames = fileNames.filter((name, index) => fileNames.indexOf(name) !== index);

  if (duplicateFileNames.length > 0) {
    return res.status(400).json({ error: 'Duplicate file names are not allowed.' });
  }

  // Process file uploads
  // ...
});

app.listen(3000, () => {
  console.log('Server started on port 3000');
});

This code snippet demonstrates how to check for duplicate file names in the uploaded files and reject the request if duplicates are found.

Conclusion

The Express-FileUpload package has a vulnerability in version 1.3.1 that allows attackers to overwrite files on the server. It is recommended to upgrade to a safe version (1.3.2 and above) or implement file name validation as a temporary workaround. For further support on vulnerability remediation, contact DevNack.com.

See every vulnerability recorded for express-fileupload →

Share this vulnerability

FAQ

Express-FileUpload is an npm package used for file uploads in web applications. It provides a convenient way to handle file uploads in Node.js applications.

The vulnerability allows attackers to overwrite existing files on the web application server, potentially leading to data loss or unauthorized access.

Yes, upgrading to a version of Express-FileUpload that is not affected by this issue (1.3.2 and above) will fix the vulnerability.

Yes, a temporary workaround is to implement file name validation on the server-side to prevent uploads with duplicate file names.

You can find more information about this vulnerability in the CVE-2022-27261 advisory or by contacting the package author.

Related vulnerabilities

Recent vulnerabilities recorded for express-fileupload.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback