Incomplete Identification of Uploaded File Variables (PHP) |
Weakness ID: 616 (Weakness Variant) | Status: Incomplete |
Description Summary
Extended Description
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".
Example 1
As of 2006, the "four globals" method is probably in sharp decline, but older PHP applications could have this issue.
In the "four globals" method, PHP sets the following 4 global variables (where "varname" is application-dependent):
Example 2
"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."
** note: 'userfile' is the field name from the web form; this can vary.
Reference | Description |
---|---|
CVE-2002-1460 | program does not distinguish between normal $ POST variables and the ones that are used for recognizing that a file has been downloaded. |
CVE-2002-1710CVE-2002-1759 | product doesn't check if the variables for an upload were set by uploading the file, or other methods such as $ POST. |
CVE-2002-1460 | PHP web forum does not properly verify whether a file was uploaded, allowing attackers to reference other files by modifying POST variables. |
CVE-2002-1710 | product does not distinguish uploaded file from other files. |
CVE-2002-1759 | PHP script does not restrict access to uploaded files. Overlaps container error. |
Phase: Architecture and Design Use PHP 4 or later. |
Phase: Architecture and Design 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. |
Ordinality | Description |
---|---|
Primary | (where the weakness exists independent of other weaknesses) |
Nature | Type | ID | Name | View(s) this relationship pertains to![]() |
---|---|---|---|---|
ChildOf | ![]() | 345 | Insufficient Verification of Data Authenticity | Research Concepts (primary)1000 |
ChildOf | ![]() | 429 | Handler Errors | Development Concepts (primary)699 |
PeerOf | ![]() | 473 | PHP External Variable Modification | Research Concepts1000 |
Mapped Taxonomy Name | Node ID | Fit | Mapped Node Name |
---|---|---|---|
PLOVER | Incomplete Identification of Uploaded File Variables (PHP) |
Submissions | ||||
---|---|---|---|---|
Submission Date | Submitter | Organization | Source | |
PLOVER | Externally Mined | |||
Modifications | ||||
Modification Date | Modifier | Organization | Source | |
2008-07-01 | Eric Dalci | Cigital | External | |
updated Time of Introduction | ||||
2008-09-08 | CWE Content Team | MITRE | Internal | |
updated Relationships, Observed Example, Other Notes, Taxonomy Mappings, Weakness Ordinalities | ||||
2008-10-14 | CWE Content Team | MITRE | Internal | |
updated Description, Other Notes, Potential Mitigations |