CWEweakness
CWE-646 Reliance on File Name or Extension of Externally-Supplied File
High
Official page ↗
- Abstraction
- Base
- Structure
- Simple
- Status
- Incomplete
- Likelihood of exploit
- High
- Languages
- Not Language-Specific
- CWE version
- 5.0
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.
Extended description
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.
Common consequences
• 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.
Related
Attack pattern · CAPEC (1)
- CAPEC-209 XSS Using MIME Type Mismatch attack pattern
Child of · CWE (1)
- CWE-345 Insufficient Verification of Data Authenticity weakness
Peer of · CWE (1)
- CWE-434 Unrestricted Upload of File with Dangerous Type weakness
Referenced by CAPEC · weakness (1)
- CAPEC-209 XSS Using MIME Type Mismatch attack pattern
Referenced by CVE · weakness (10)
- CVE-2026-45315 Open WebUI is a self-hosted artificial intelligence platform designed to operate entirely offline. vulnerability
- CVE-2026-20172 A vulnerability in the Lite Agent feature of Cisco Enterprise Chat and Email (ECE) could allow an authenticated, remote attacker to conduct… vulnerability
- CVE-2025-30662 Symlink following in the installer for the Zoom Workplace VDI Plugin macOS Universal installer before version 6.3.14, 6.4.14, and 6.5.10 in… vulnerability
- CVE-2025-41720 A low privileged remote attacker can upload arbitrary data masked as a png file to the affected device using the webserver API because only… vulnerability
- CVE-2025-58449 Maho is a free and open source ecommerce platform. vulnerability
- CVE-2025-1889 picklescan before 0.0.22 only considers standard pickle file extensions in the scope for its vulnerability scan. vulnerability
- CVE-2024-52052 Wowza Streaming Engine below 4.9.1 permits an authenticated Streaming Engine Manager administrator to define a custom application property… vulnerability
- CVE-2024-38432 Matrix Tafnit v8 - CWE-646: Reliance on File Name or Extension of Externally-Supplied File vulnerability
- CVE-2023-45599 A CWE-646 “Reliance on File Name or Extension of Externally-Supplied File” vulnerability in the “iec61850” functionality of the web… vulnerability
- CVE-2021-34639 Authenticated File Upload in WordPress Download Manager <= 3.1.24 allows authenticated (Author+) users to upload files with a double… vulnerability