---
title: "CWE-434: Unrestricted Upload of File with Dangerous Type"
url: https://radicalnotion.ai/cwe/cwe-434
type: cwe
description: "The product allows the upload or transfer of dangerous file types that are automatically processed within its environment."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-434: Unrestricted Upload of File with Dangerous Type

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **Likelihood of exploit:** Medium
- **CVEs with this as primary weakness:** 4,365
- **Of those, in CISA KEV:** 26
- **New in 2026:** 873
- **CWE catalog version:** 4.21

## Description

The product allows the upload or transfer of dangerous file types that are automatically processed within its environment.

## Alternate terms

- **Unrestricted File Upload:** Used in vulnerability databases and elsewhere, but it is insufficiently precise. The phrase could be interpreted as the lack of restrictions on the size or number of uploaded files, which is a resource consumption issue.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |
| Architecture and Design | OMISSION: This weakness is caused by missing a security tactic during the architecture and design phase. |

## Applicable platforms

**Languages:** ASP.NET (Sometimes), PHP (Often)

**Technologies:** Web Server (Sometimes), AI/ML (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity, Confidentiality, Availability | Execute Unauthorized Code or Commands | Arbitrary code execution is possible if an uploaded file is interpreted and executed as code by the recipient. This is especially true for web-server extensions such as .asp and .php because these file types are often treated as automatically executable, even when file system permissions do not specify execution. For example, in Unix environments, programs typically cannot run unless the execute bit is set, but PHP programs may be executed by the web server without directly invoking them on the operating system. |

## Potential mitigations

### Architecture and Design

Generate a new, unique filename for an uploaded file instead of using the user-supplied filename, so that no external input is used at all.\[REF-422\] \[REF-423\]

### Architecture and Design (Enforcement by Conversion)

When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs.

### Architecture and Design

Consider storing the uploaded files outside of the web document root entirely. Then, use other mechanisms to deliver the files dynamically. \[REF-423\]

### Implementation (Input Validation)

Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.

When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."

Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.

For example, limiting filenames to alphanumeric characters can help to restrict the introduction of unintended file extensions.

### Architecture and Design

Define a very limited set of allowable extensions and only generate filenames that end in these extensions. Consider the possibility of XSS (CWE-79) before allowing .html or .htm file types.

### Implementation (Input Validation)

Ensure that only one extension is used in the filename. Some web servers, including some versions of Apache, may process files based on inner extensions so that "filename.php.gif" is fed to the PHP interpreter.\[REF-422\] \[REF-423\]

### Implementation

When running on a web server that supports case-insensitive filenames, perform case-insensitive evaluations of the extensions that are provided.

### Architecture and Design

For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.

### Implementation

Do not rely exclusively on sanity checks of file contents to ensure that the file is of the expected type and size. It may be possible for an attacker to hide code in some file segments that will still be executed by the server. For example, GIF images may contain a free-form comments field.

### Implementation

Do not rely exclusively on the MIME content type or filename attribute when determining how to render a file. Validating the MIME content type and ensuring that it matches the extension is only a partial solution.

### Architecture and Design, Operation (Environment Hardening)

Run your code using the lowest privileges that are required to accomplish the necessary tasks \[REF-76\]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.

### Architecture and Design, Operation (Sandbox or Jail)

Run the code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which files can be accessed in a particular directory or which commands can be executed by the software.

OS-level examples include the Unix chroot jail, AppArmor, and SELinux. In general, managed code may provide some protection. For example, java.io.FilePermission in the Java SecurityManager allows the software to specify restrictions on file operations.

This may not be a feasible solution, and it only limits the impact to the operating system; the rest of the application may still be subject to compromise.

Be careful to avoid CWE-243 and other weaknesses related to jails.

Effectiveness: Limited. The effectiveness of this mitigation depends on the prevention capabilities of the specific sandbox or jail being used and might only help to reduce the scope of an attack, such as restricting the attacker to certain system calls or limiting the portion of the file system that can be accessed.

## Detection methods

### Dynamic Analysis with Automated Results Interpretation

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Cost effective for partial coverage:

- Web Application Scanner
- Web Services Scanner
- Database Scanners

Effectiveness: SOAR Partial

### Dynamic Analysis with Manual Results Interpretation

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Cost effective for partial coverage:

- Fuzz Tester
- Framework-based Fuzzer

Effectiveness: SOAR Partial

### Manual Static Analysis - Source Code

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Highly cost effective:

- Focused Manual Spotcheck - Focused manual analysis of source
- Manual Source Code Review (not inspections)

Effectiveness: High

### Automated Static Analysis - Source Code

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Highly cost effective:

- Source code Weakness Analyzer
- Context-configured Source Code Weakness Analyzer

Effectiveness: High

### Architecture or Design Review

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Highly cost effective:

Cost effective for partial coverage:

- Formal Methods / Correct-By-Construction
- Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)

Effectiveness: High

## Demonstrative examples

### Example 1

The following code intends to allow a user to upload a picture to the web server. The HTML code that drives the form on the user end has an input field of type "file".

Good code:

```html
<form action="upload_picture.php" method="post" enctype="multipart/form-data">

Choose a file to upload:
<input type="file" name="filename"/>
<br/>
<input type="submit" name="submit" value="Submit"/>

</form>
```

Bad code:

```php
// Define the target location where the picture being

// uploaded is going to be saved.
$target = "pictures/" . basename($_FILES['uploadedfile']['name']);

// Move the uploaded file to the new location.
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target))
{
    echo "The picture has been successfully uploaded.";
}
else
{
    echo "There was an error uploading the picture, please try again.";
}
```

Attack code:

```
malicious.php
```

Attack code:

```php
<?php
    system($_GET['cmd']);

?>
```

Attack code:

```
http://server.example.com/upload_dir/malicious.php?cmd=ls%20-l
```

### Example 2

The following code demonstrates the unrestricted upload of a file with a Java servlet and a path traversal vulnerability. The action attribute of an HTML form is sending the upload file request to the Java servlet.

Good code:

```html
<form action="FileUploadServlet" method="post" enctype="multipart/form-data">

Choose a file to upload:
<input type="file" name="filename"/>
<br/>
<input type="submit" name="submit" value="Submit"/>

</form>
```

Bad code:

```java
public class FileUploadServlet extends HttpServlet {
    ...

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        String contentType = request.getContentType();

        // the starting position of the boundary header
        int ind = contentType.indexOf("boundary=");
        String boundary = contentType.substring(ind+9);

        String pLine = new String();
        String uploadLocation = new String(UPLOAD_DIRECTORY_STRING); //Constant value

        // verify that content type is multipart form data
        if (contentType != null && contentType.indexOf("multipart/form-data") != -1) {
            // extract the filename from the Http header
            BufferedReader br = new BufferedReader(new InputStreamReader(request.getInputStream()));
            ...
            pLine = br.readLine();
            String filename = pLine.substring(pLine.lastIndexOf("\\"), pLine.lastIndexOf("\""));
            ...

            // output the file to the local upload directory
            try {
                BufferedWriter bw = new BufferedWriter(new FileWriter(uploadLocation+filename, true));
                for (String line; (line=br.readLine())!=null; ) {
                    if (line.indexOf(boundary) == -1) {
                        bw.write(line);
                        bw.newLine();
                        bw.flush();
                    }
                } //end of for loop
                bw.close();

            } catch (IOException ex) {...}
            // output successful upload response HTML page
        }
        // output unsuccessful upload response HTML page
        else
        {...}
    }
        ...
}
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2023-5227 | PHP-based FAQ management app does not check the MIME type for uploaded images |
| CVE-2001-0901 | Web-based mail product stores ".shtml" attachments that could contain SSI |
| CVE-2002-1841 | PHP upload does not restrict file types |
| CVE-2005-1868 | upload and execution of .php file |
| CVE-2005-1881 | upload file with dangerous extension |
| CVE-2005-0254 | program does not restrict file types |
| CVE-2004-2262 | improper type checking of uploaded files |
| CVE-2006-4558 | Double "php" extension leaves an active php extension in the generated filename. |
| CVE-2006-6994 | Chain: ASP program allows upload of .asp files (CWE-434) by bypassing client-side checks (CWE-601. |
| CVE-2005-3288 | ASP file upload |
| CVE-2006-2428 | ASP file upload |

## Real CVEs with this weakness (sample of 12 of 4,365)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-56291 | Joomla Extension - balbooa.com - Unauthenticated file upload in Balbooa Forms extension \< 2.4.1 | critical | 10.0 | - | Yes | 2026-07-09 |
| CVE-2026-56290 | Joomla Extension - joomlack.fr - Unauthenticated file upload in Page Builder CK extension \< 3.6.0 | critical | 10.0 | - | Yes | 2026-06-29 |
| CVE-2026-48908 | Joomla Extension - joomshaper.com - Remote Code Execution in SP Pagebuilder extension for Joomla \< 6.6.2 | critical | 10.0 | - | Yes | 2026-06-20 |
| CVE-2026-48939 | Joomla Extension - icagenda.com - Remote Code Execution in iCaganda extension for Joomla \< 4.0.8/3.9.15 | critical | 10.0 | - | Yes | 2026-06-20 |
| CVE-2025-31324 | Missing Authorization check in SAP NetWeaver (Visual Composer development server) | critical | 10.0 | - | Yes | 2025-04-24 |
| CVE-2020-25213 | WordPress File Manager Plugin Remote Code Execution Vulnerability | critical | 10.0 | - | Yes | 2020-09-09 |
| CVE-2024-57968 | Advantive VeraCore Unrestricted File Upload Vulnerability | critical | 9.4 | - | Yes | 2025-02-03 |
| CVE-2024-7694 | TeamT5 ThreatSonar Anti-Ransomware - Arbitrary File Upload | critical | 9.4 | - | Yes | 2024-08-12 |
| CVE-2021-26828 | OpenPLC ScadaBR Unrestricted Upload of File with Dangerous Type Vulnerability | critical | 9.4 | - | Yes | 2021-06-11 |
| CVE-2018-4063 | Sierra Wireless AirLink ALEOS Unrestricted Upload of File with Dangerous Type Vulnerability | critical | 9.4 | - | Yes | 2019-05-06 |
| CVE-2026-48356 | Adobe Commerce \| Unrestricted Upload of File with Dangerous Type (CWE-434) | critical | 9.3 | - | Yes | 2026-07-14 |
| CVE-2025-52691 | Upload Arbitrary Files | critical | 9.3 | - | Yes | 2025-12-29 |

## Related attack patterns (CAPEC)

- [CAPEC-1](https://radicalnotion.ai/capec/capec-1): Accessing Functionality Not Properly Constrained by ACLs

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-669](https://radicalnotion.ai/cwe/cwe-669) | Incorrect Resource Transfer Between Spheres |
| Peer | [CWE-351](https://radicalnotion.ai/cwe/cwe-351) | Insufficient Type Distinction |
| Peer | [CWE-430](https://radicalnotion.ai/cwe/cwe-430) | Deployment of Wrong Handler |
| Peer | [CWE-436](https://radicalnotion.ai/cwe/cwe-436) | Interpretation Conflict |
| Peer | [CWE-646](https://radicalnotion.ai/cwe/cwe-646) | Reliance on File Name or Extension of Externally-Supplied File |
| Related | [CWE-73](https://radicalnotion.ai/cwe/cwe-73) | External Control of File Name or Path |
| Related | [CWE-183](https://radicalnotion.ai/cwe/cwe-183) | Permissive List of Allowed Inputs |
| Related | [CWE-184](https://radicalnotion.ai/cwe/cwe-184) | Incomplete List of Disallowed Inputs |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Unrestricted File Upload | - | - |
| OWASP Top Ten 2007 | Malicious File Execution | A3 | CWE More Specific |
| OMG ASCSM | - | ASCSM-CWE-434 | - |

## Frequently asked questions

### What is CWE-434?

The product allows the upload or transfer of dangerous file types that are automatically processed within its environment.

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

4,365 recorded CVEs are attributed to CWE-434, including CVE-2026-56291, CVE-2026-56290 and CVE-2026-48908. 26 are listed in CISA's Known Exploited Vulnerabilities (KEV) catalog.

### Is CWE-434 part of the OWASP Top 10?

CWE-434 maps to OWASP Top Ten 2007: Malicious File Execution (A3) in the OWASP security taxonomy.

### How do you prevent CWE-434?

Generate a new, unique filename for an uploaded file instead of using the user-supplied filename, so that no external input is used at all.

### How is CWE-434 detected?

Dynamic Analysis with Automated Results Interpretation: According to SOAR, the following detection techniques may be useful:

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

Exploiting CWE-434 can lead to: Execute Unauthorized Code or Commands.

### Is CWE-434 actively exploited?

Yes. 26 CWE-434 vulnerabilities are in CISA's KEV catalog of actively exploited flaws, out of 4,365 recorded CVEs.

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

---

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