目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1000

100.0%

CWE-616 上传文件变量的不完整标识(PHP) 类漏洞列表 1

CWE-616 上传文件变量的不完整标识(PHP) 类弱点 1 条 CVE 漏洞汇总,含 AI 中文分析。

CWE-616 是 PHP 应用中因使用过时机制处理文件上传导致的漏洞。攻击者可通过 POST 请求或 Cookie 覆盖全局变量(如文件名、类型),使应用处理未授权文件。开发者应避免依赖这些易被篡改的全局变量,转而使用标准的 $_FILES 超全局数组进行文件验证与处理,从而确保上传数据的完整性与安全性。

MITRE CWE 官方描述
CWE:CWE-616 上传文件变量标识不完整 (PHP) 该 PHP 应用程序使用一种旧方法来处理上传的文件,即引用为每个文件设置的四个全局变量(例如 $varname、$varname_size、$varname_name、$varname_type)。攻击者可以覆盖这些变量,导致应用程序处理未经授权的文件。 这些全局变量可以通过 POST 请求、cookie 或其他填充或覆盖这些变量的方法进行覆盖。攻击者可以通过提供诸如 "/etc/passwd" 之类的值,利用此漏洞读取或处理任意文件。
常见影响 (1)
Confidentiality, IntegrityRead Files or Directories, Modify Files or Directories
缓解措施 (3)
Architecture and DesignUse PHP 4 or later.
Architecture and DesignIf you must support older PHP versions, write your own version of is_uploaded_file() and run it against $HTTP_POST_FILES['userfile']))
ImplementationFor 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.
代码示例 (2)
As of 2006, the "four globals" method is probably in sharp decline, but older PHP applications could have this issue.
$varname = name of the temporary file on local machine $varname_size = size of file $varname_name = original name of file provided by client $varname_type = MIME type of the file
Bad · PHP
"The global $_FILES exists as of PHP 4.1.0 (Use $HTTP_POST_FILES instead if using an earlier version). These arrays will contain all the uploaded file information."
$_FILES['userfile']['name'] - original filename from client $_FILES['userfile']['tmp_name'] - the temp filename of the file on the server
Bad · PHP
CVE ID标题CVSS风险等级Published
CVE-2024-52305 UnoPim 安全漏洞 — unopim 6.5 Medium2024-11-13

CWE-616(上传文件变量的不完整标识(PHP)) 是常见的弱点类别,本平台收录该类弱点关联的 1 条 CVE 漏洞。