---
title: "CWE-616: Incomplete Identification of Uploaded File Variables (PHP)"
url: https://radicalnotion.ai/cwe/cwe-616
type: cwe
description: "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)."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-616: Incomplete Identification of Uploaded File Variables (PHP)

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Incomplete
- **CVEs with this as primary weakness:** 8
- **Of those, in CISA KEV:** 0
- **New in 2026:** 2
- **CWE catalog version:** 4.21

## Description

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).

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Applicable platforms

**Languages:** PHP (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality, Integrity | Read Files or Directories, Modify Files or Directories | These variables could be overwritten by attackers via POST requests, cookies, or other methods, causing the application to read or process unauthorized files. |

## Potential mitigations

### Architecture and Design

Use PHP 4 or later.

### 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'\]))

### Implementation

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.

## Demonstrative examples

### Example 1

As of 2006, the "four globals" method is probably in sharp decline, but older PHP applications could have this issue.

Bad code:

```php
$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
```

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."

Bad code:

```php
$_FILES['userfile']['name'] - original filename from client
$_FILES['userfile']['tmp_name'] - the temp filename of the file on the server
```

\*\* note: 'userfile' is the field name from the web form; this can vary.

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2002-1460 | Forum does not properly verify whether a file was uploaded or if the associated variables were set by POST, allowing remote attackers to read arbitrary files. |
| CVE-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-1710 | Product does not distinguish uploaded file from other files. |

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2025-67084 | - | critical | 9.9 | - | No | 2026-01-15 |
| CVE-2024-31601 | - | critical | 9.8 | - | No | 2024-04-26 |
| CVE-2024-29858 | - | critical | 9.8 | - | No | 2024-03-21 |
| CVE-2026-67198 | Perspective 5.0.0 DoS via VirtualServer Protocol Dispatcher | high | 8.7 | - | No | 2026-08-04 |
| CVE-2023-38947 | - | high | 7.2 | - | No | 2023-08-03 |
| CVE-2024-52305 | UnoPim Stored XSS : Cookie hijacking through Create User function | medium | 6.9 | - | No | 2024-11-13 |
| CVE-2025-59402 | - | medium | 5.4 | - | No | 2025-09-25 |
| CVE-2025-52130 | - | medium | 5.4 | - | No | 2025-08-25 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-345](https://radicalnotion.ai/cwe/cwe-345) | Insufficient Verification of Data Authenticity |
| Peer | [CWE-473](https://radicalnotion.ai/cwe/cwe-473) | PHP External Variable Modification |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Incomplete Identification of Uploaded File Variables (PHP) | - | - |
| Software Fault Patterns | Tainted input to variable | SFP25 | - |

## Frequently asked questions

### What is CWE-616?

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).

### What CVEs are caused by CWE-616?

8 recorded CVEs are attributed to CWE-616, including CVE-2025-67084, CVE-2024-31601 and CVE-2024-29858.

### How do you prevent CWE-616?

Use PHP 4 or later.

### What are the consequences of CWE-616?

Exploiting CWE-616 can lead to: Read Files or Directories, Modify Files or Directories.

### Is CWE-616 actively exploited?

8 recorded CVEs are caused by CWE-616; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/616.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-616). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
