Time of Check Time of Use (TOCTOU) Affecting commons-fileupload:commons-fileupload package, versions [,1.3)


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.04% (6th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JAVA-COMMONSFILEUPLOAD-30079
  • published6 May 2015
  • disclosed15 Mar 2013
  • creditKarl Dyszynski, Hugo Vazquez Carames

Introduced: 15 Mar 2013

CVE-2013-0248  (opens in a new tab)
CWE-264  (opens in a new tab)
First added by Snyk

How to fix?

Upgrade commons-fileupload:commons-fileupload to version 1.3 or higher.

Overview

commons-fileupload:commons-fileupload is a component that provides a simple yet flexible means of adding support for multipart file upload functionality to servlets and web applications.

Affected versions of this package are vulnerable to Time of Check Time of Use (TOCTOU) if the attacker has write access to the /tmp directory.

Details

Commons FileUpload provides file upload capability for Servlets and web applications. During the upload process, FileUpload may (depending on configuration) save the uploaded file temporarily on disk. By default this will be in the system wide tmp directory. Because the temporary files have predictable file names and are stored in a publicly writeable location they are vulnerable to a TOCTOU attack.

A successful attack requires that the attacker has write access to the tmp directory. The attack can be prevented by setting the repository to a non-publicly writeable location. The documentation for FileUpload does not highlight the potential security implications of not setting a repository, nor do the provided examples set a repository. This may have caused users to use FileUpload in an insecure manner.

CVSS Scores

version 3.1