---
title: "CWE-646: Reliance on File Name or Extension of Externally-Supplied File"
url: https://radicalnotion.ai/cwe/cwe-646
type: cwe
description: "The product allows a file to be uploaded, but it relies on the file name or extension of the file to determine the appropriate behaviors."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-646: Reliance on File Name or Extension of Externally-Supplied File

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Incomplete
- **Likelihood of exploit:** High
- **CVEs with this as primary weakness:** 12
- **Of those, in CISA KEV:** 0
- **New in 2026:** 2
- **CWE catalog version:** 4.21

## Description

The product allows a file to be uploaded, but it relies on the file name or extension of the file to determine the appropriate behaviors.

This could be used by attackers to cause the file to be misclassified and processed in a dangerous fashion, causing the wrong action to occur.

## Applicable platforms

**Technologies:** Web Server (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity | Execute Unauthorized Code or Commands | If an attacker can provide a file that is treated as executable, then code execution might be possible. For example, in a web application, an attacker could supply a file that ends in a ".php.gif" extension that appears to be a GIF image, but would be processed as PHP code by the server. |
| Confidentiality | Read Application Data | An attacker may be able to read sensitive data, e.g., exposure of debug or system data (including application source code) |
| Availability | DoS: Crash, Exit, or Restart, DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory), DoS: Resource Consumption (Other) | An attacker may be able to cause a denial of service. |
| Access Control | Gain Privileges or Assume Identity | An attacker may be able to gain privileges. |

## Potential mitigations

### Architecture and Design

Make decisions on the server side based on file content and not on file name or extension.

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2024-38432 | Matrix – Tafnit v8 CWE-646: Reliance on File Name or Extension of Externally-Supplied File | critical | 9.8 | - | No | 2024-07-30 |
| CVE-2024-52052 | Stream Target Remote Code Execution in Wowza Streaming Engine | critical | 9.4 | - | No | 2024-11-21 |
| CVE-2026-126186 | Active Storage: Possible arbitrary file read and remote code execution in Active Storage video previews, analysis and image processing | high | 8.8 | - | No | 2026-11-10 |
| CVE-2023-45599 | - | high | 8.8 | - | No | 2024-03-05 |
| CVE-2021-34639 | WordPress Download Manager \<= 3.1.24 Authenticated Arbitrary File Upload | high | 8.8 | - | No | 2021-08-05 |
| CVE-2025-58449 | Maho Vulnerable to Authenticated Remote Code Execution via File Upload | high | 8.7 | - | No | 2025-09-08 |
| CVE-2025-30662 | Zoom Workplace VDI Plugin macOS Universal Installer - Symlink Following | medium | 6.6 | - | No | 2025-11-13 |
| CVE-2023-0350 | CVE-2023-0350 | medium | 6.5 | - | No | 2023-03-13 |
| CVE-2025-1889 | picklescan - Security scanning bypass via non-standard file extensions | medium | 5.3 | - | No | 2025-03-03 |
| CVE-2026-20172 | Cisco Enterprise Chat and Email Lite Agent File Upload Vulnerability | medium | 4.3 | - | No | 2026-05-06 |
| CVE-2025-41720 | Sauter: Arbitrary File Upload | medium | 4.3 | - | No | 2025-10-22 |
| CVE-2023-21843 | Oracle Java SE, Oracle GraalVM Enterprise Edition: Sound - unauthorized data modification | low | 3.7 | - | No | 2023-01-17 |

## Related attack patterns (CAPEC)

- [CAPEC-209](https://radicalnotion.ai/capec/capec-209): XSS Using MIME Type Mismatch

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-345](https://radicalnotion.ai/cwe/cwe-345) | Insufficient Verification of Data Authenticity |
| Peer | [CWE-434](https://radicalnotion.ai/cwe/cwe-434) | Unrestricted Upload of File with Dangerous Type |

## Frequently asked questions

### What is CWE-646?

The product allows a file to be uploaded, but it relies on the file name or extension of the file to determine the appropriate behaviors.

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

12 recorded CVEs are attributed to CWE-646, including CVE-2024-38432, CVE-2024-52052 and CVE-2026-126186.

### How do you prevent CWE-646?

Make decisions on the server side based on file content and not on file name or extension.

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

Exploiting CWE-646 can lead to: Execute Unauthorized Code or Commands, Read Application Data, DoS: Crash, Exit, or Restart, DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory), DoS: Resource Consumption (Other).

### Is CWE-646 actively exploited?

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

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

---

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