CVE-2013-2186: Commons fileupload Arbitrary File Write Vulnerability

HIGH
Advisory Identifier: GHSA-qx6h-9567-5fqw
CWE-20
Published
Advisory Summary

CVE-2013-2186 is a HIGH arbitrary file write vulnerability (CWE-20: Improper Input Validation) affecting Commons fileupload libraries in the Maven ecosystem. The issue involves arbitrary file write in apache commons fileupload. Remediation is available by upgrading affected packages to version 1.3.1.

CVE-2013-2186 at a Glance

CVE Identifier CVE-2013-2186
GHSA Identifier GHSA-qx6h-9567-5fqw
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-20: Improper Input Validation
Affected Product Commons fileupload
Package Ecosystem Maven
Published Date
Last Updated

How to Fix CVE-2013-2186

To remediate this vulnerability, upgrade all affected Commons fileupload dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

commons-fileupload:commons-fileupload fixed: 1.3.1
<dependency>
    <groupId>commons-fileupload</groupId>
    <artifactId>commons-fileupload</artifactId>
    <version>1.3.1</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=commons-fileupload

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2013-2186, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=commons-fileupload

Analyze the terminal output to locate any version of Commons fileupload in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.3.1), your application is affected.

Note: The mvn dependency:tree -Dincludes=commons-fileupload command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Commons fileupload, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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 via a NULL byte in a file name in a serialized instance.

CVE-2013-2186 Affected Commons fileupload Versions

1 component(s)
Fixed Versions:
1.3.1
Product / Package Ecosystem Affected Versions Fixed Version
commons-fileupload:commons-fileupload
Maven
< 1.3.1
1.3.1

References

NVD — CVE-2013-2186 NVD
https://nvd.nist.gov/vuln/detail/CVE-2013-2186
Security Fix Commit FIX COMMIT
https://github.com/apache/commons-fileupload/commit/163a6061fbc077d4b6e4787d26857c2baba495d1
access.redhat.com/errata/rhsa-2016:00... WEB
https://access.redhat.com/errata/RHSA-2016:0070
exchange.xforce.ibmcloud.com/vulnerabilities/881... WEB
https://exchange.xforce.ibmcloud.com/vulnerabilities/88133
Commons fileupload Source Repository REPOSITORY
https://github.com/apache/commons-fileupload
Commons fileupload Source Repository REPOSITORY
https://github.com/apache/commons-fileupload/blob/master/RELEASE-NOTES.txt
Commons fileupload Security Information SECURITY
https://wiki.jenkins-ci.org/display/SECURITY/Jenkins+Security+Advisory+2014-10-01
Commons fileupload Security Information SECURITY
https://www.tenable.com/security/research/tra-2016-23
Commons fileupload Security Information SECURITY
http://lists.opensuse.org/opensuse-security-announce/2013-11/msg00008.html
lists.opensuse.org/opensuse-updates/20... WEB
http://lists.opensuse.org/opensuse-updates/2013-10/msg00033.html
lists.opensuse.org/opensuse-updates/20... WEB
http://lists.opensuse.org/opensuse-updates/2013-10/msg00050.html
rhn.redhat.com/errata/rhsa-2013-14... WEB
http://rhn.redhat.com/errata/RHSA-2013-1448.html
ubuntu.com/usn/usn-2029-1 WEB
http://ubuntu.com/usn/usn-2029-1
Commons fileupload Security Information SECURITY
http://www.debian.org/security/2013/dsa-2827
Commons fileupload Security Information SECURITY
http://www.securityfocus.com/bid/63174

Frequently Asked Questions

What is CVE-2013-2186?
CVE-2013-2186 is a security vulnerability in Commons fileupload involving Arbitrary file write in Apache Commons Fileupload under CWE-20: Improper Input Validation.
Which Commons fileupload versions are affected?
Affected versions include releases prior to 1.3.1 across affected packages: commons-fileupload:commons-fileupload.
What version fixes CVE-2013-2186?
Upgrading to 1.3.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is commons-fileupload affected?
Yes, commons-fileupload:commons-fileupload is affected in releases prior to 1.3.1. Upgrade your dependency to 1.3.1 or later.
What CWE is associated with CVE-2013-2186?
CVE-2013-2186 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check Maven dependencies for CVE-2013-2186?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=commons-fileupload'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-qx6h-9567-5fqw",
  "modified" : "2024-03-05T17:59:41Z",
  "published" : "2022-05-14T03:52:43Z",
  "aliases" : [ "CVE-2013-2186" ],
  "summary" : "Arbitrary file write in Apache Commons Fileupload",
  "details" : "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 via a NULL byte in a file name in a serialized instance.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "commons-fileupload:commons-fileupload"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.3.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2013-2186"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/apache/commons-fileupload/commit/163a6061fbc077d4b6e4787d26857c2baba495d1"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2016:0070"
  }, {
    "type" : "WEB",
    "url" : "https://exchange.xforce.ibmcloud.com/vulnerabilities/88133"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/apache/commons-fileupload"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/apache/commons-fileupload/blob/master/RELEASE-NOTES.txt"
  }, {
    "type" : "WEB",
    "url" : "https://wiki.jenkins-ci.org/display/SECURITY/Jenkins+Security+Advisory+2014-10-01"
  }, {
    "type" : "WEB",
    "url" : "https://www.tenable.com/security/research/tra-2016-23"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2013-11/msg00008.html"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-updates/2013-10/msg00033.html"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-updates/2013-10/msg00050.html"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2013-1448.html"
  }, {
    "type" : "WEB",
    "url" : "http://ubuntu.com/usn/usn-2029-1"
  }, {
    "type" : "WEB",
    "url" : "http://www.debian.org/security/2013/dsa-2827"
  }, {
    "type" : "WEB",
    "url" : "http://www.securityfocus.com/bid/63174"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-11-03T21:09:29Z",
    "nvd_published_at" : "2013-10-28T21:55:00Z"
  }
}