CWE一覧に戻る
CWE-616

アップロードされたファイル変数の不完全な識別(PHP)

Incomplete Identification of Uploaded File Variables (PHP)
脆弱性 作成中
JA

PHPアプリケーションは、アップロードされたファイルを処理するために、各ファイルに設定される4つのグローバル変数(例えば$varname、$varname_size、$varname_name、$varname_type)を参照する古い方法を使用しています。これらの変数は攻撃者によって上書きされ、アプリケーションが不正なファイルを処理する可能性があります。

これらのグローバル変数は、POSTリクエスト、クッキー、あるいはこれらの変数に値を入れたり上書きしたりする他の方法によって上書きされる可能性がある。これは、"/etc/passwd "のような値を提供することで、任意のファイルを読んだり処理したりするために使われる可能性があります。

EN

The PHP application uses an old method for processing uploaded files by referencing the four global variables that are set for each file (e.g. $varname, $varname_size, $varname_name, $varname_type). These variables could be overwritten by attackers, causing the application to process unauthorized files.

These global variables could be overwritten by POST requests, cookies, or other methods of populating or overwriting these variables. This could be used to read or process arbitrary files by providing values such as "/etc/passwd".

Scope: Confidentiality, Integrity / Impact: Read Files or Directories; Modify Files or Directories
Use PHP 4 or later.
If you must support older PHP versions, write your own version of is_uploaded_file() and run it against $HTTP_POST_FILES['userfile']))
For later PHP versions, reference uploaded files using the $HTTP_POST_FILES or $_FILES variables, and use is_uploaded_file() or move_uploaded_file() to ensure that you are dealing with an uploaded file.
MITRE公式ページ — CWE-616