Apache Commons FileUpload Vulnerability in libcommons-fileupload-java: Arbitrary File Write via NULL Byte

libcommons-fileupload-java Updated 02 Oct 2025

Summary

28/10/2013
N/A
Yes i
Unrated
Not published

CVE-2013-2186: The DiskFileItem class in Apache Commons FileUpload, as used in Red Hat JBoss BRMS 5.3.1; JBoss Portal 4.3 CP07, 5.2.2, and 6.0.0; and Red Hat JBoss Web Server 1.0.2 allows remote attackers to write to arbitrary files vi... Affects libcommons-fileupload-java versions < 1.3-2.1. Fixed in 1.3-2.1. 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 Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Apache Commons FileUpload is a widely used library in Java applications for handling file uploads. It provides a simple API for processing file uploads in web applications. However, certain versions of this library are vulnerable to a security flaw that allows attackers to exploit the file upload functionality, leading to potential unauthorized file writes on the server. This vulnerability affects various distributions, including Debian 11, 12, and 13, making it critical for developers using this library to be aware of its implications.

Vulnerability Detail

The vulnerability, identified as CVE-2013-2186, resides in the DiskFileItem class of Apache Commons FileUpload. It allows remote attackers to write to arbitrary files by injecting a NULL byte into a file name in a serialized instance. This can lead to unauthorized access to sensitive files or even complete system compromise, depending on the server's configuration and permissions. The flaw arises from improper validation of file names, enabling attackers to bypass security checks.

How To Fix

Minimum fixed version

1.3-2.1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade libcommons-fileupload-java

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If immediate upgrading is not feasible, a temporary workaround is to implement input validation on file names before processing uploads. Ensure that file names do not contain NULL bytes or any other potentially harmful characters. This can be done by sanitizing the input, for example: if (

fileName.contains("\0")) { throw new IllegalArgumentException("Invalid file name");

}

Conclusion

The CVE-2013-2186 vulnerability in the Apache Commons FileUpload library poses a significant risk to applications that utilize the libcommons-fileupload-java package. It is crucial for developers to update to the latest version to mitigate potential security threats. Implementing input validation can serve as a temporary measure while awaiting updates.

See every vulnerability recorded for libcommons-fileupload-java →

Share this vulnerability

FAQ

CVE-2013-2186 is a security vulnerability in the Apache Commons FileUpload library that allows remote attackers to write to arbitrary files by exploiting a NULL byte in a file name.

The vulnerability affects all versions prior to 1.3-2.1 in Debian 11, 12, and 13.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected by this vulnerability.

Exploitation of this vulnerability can lead to unauthorized file access, data breaches, and potentially full system compromise, depending on the server's configuration.

Yes, you can implement input validation on file names to prevent NULL bytes and other harmful characters from being processed.

Related vulnerabilities

Recent vulnerabilities recorded for libcommons-fileupload-java.

How To Fix

Minimum fixed version

1.3-2.1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade libcommons-fileupload-java

Tip — Not sure which version your app runs? Vulert can match this fix to it. 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