# CVE-2013-2186: Arbitrary file write in Apache Commons Fileupload

> Remote attackers can write arbitrary files via NULL byte injection in serialized instances, potentially leading to code execution.

- **Severity:** High 7.5 (`AV:N/AC:L/Au:N/C:P/I:P/A:P`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 28 Oct 2013
- **Updated:** 6 Aug 2024
- **Also known as:** DEBIAN-CVE-2013-2186, DSA-2827-1, GHSA-qx6h-9567-5fqw, RHSA-2013:1428

## What is CVE-2013-2186?

CVE-2013-2186 is a high-severity unsafe deserialization vulnerability in Redhat Openshift, published on 28 Oct 2013. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

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.

Weakness: CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2013-2186?

2 open source packages ship an affected version, including commons-fileupload:commons-fileupload. It affects 5 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `commons-fileupload:commons-fileupload` | Maven | All versions | 1.3.1 |
| `commons-fileupload:commons-fileupload` | Maven | All versions | 1.3.1 |
| `jakarta-commons-fileupload` | Red Hat:jboss_enterprise_web_server:1::el5 | All versions | 1:1.1.1-7.7.ep5.el5 |
| `jakarta-commons-fileupload` | Red Hat:jboss_enterprise_web_server:1::el6 | All versions | 1:1.1.1-7.7.ep5.el6 |

Products: Redhat Jboss Enterprise Brms Platform, Redhat Jboss Enterprise Portal Platform, Redhat Jboss Enterprise Web Server, Redhat Openshift, Ubuntu Ubuntu.

## How do I fix CVE-2013-2186?

Upgrade commons-fileupload:commons-fileupload to 1.3.1 or later.

## Is CVE-2013-2186 being exploited?

There is no known exploitation of CVE-2013-2186 in the wild and no public exploit code.

Public exploit code:

- Payload generator for Java Binary Deserialization attack with Commons FileUpload (CVE-2013-2186) (github_poc): https://github.com/GrrrDog/ACEDcup
- Code generate payload for CVE-2013-2186 (github_poc): https://github.com/sa1g0n1337/Payload_CVE_2013_2186
- Source code for CVE-2013-2186 (github_poc): https://github.com/sa1g0n1337/CVE_2013_2186

## Other vulnerabilities in Redhat Openshift

- [CVE-2011-2908](https://insights.sbomify.com/CVE-2011-2908/): Cross-site request forgery in n/a (medium 6.0)
- [CVE-2012-2377](https://insights.sbomify.com/CVE-2012-2377/): Missing authorization in n/a (low 3.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2013-2186 and fix it if it is affected.

What it is: CVE-2013-2186 is a high-severity unsafe deserialization vulnerability in Redhat Openshift, published on 28 Oct 2013. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2013-2186 in the wild and no public exploit code.

Affected packages and fixed versions:
- commons-fileupload:commons-fileupload (Maven): affected all versions; fixed in 1.3.1
- commons-fileupload:commons-fileupload (Maven): affected all versions; fixed in 1.3.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2013-2186/ (Markdown: https://insights.sbomify.com/CVE-2013-2186/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2013-2186
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2013-2186
- OSV: https://osv.dev/vulnerability/CVE-2013-2186

---
From sbomify Insights: https://insights.sbomify.com/CVE-2013-2186/
Summaries are generated and may contain mistakes; the official description above is the record.
