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

Variant Incomplete Simple

CWE版本: 4.18

更新日期: 2025-09-09

弱点描述

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.

扩展描述

An application might use the file name or extension of a user-supplied file to determine the proper course of action, such as selecting the correct process to which control should be passed, deciding what data should be made available, or what resources should be allocated. If the attacker can cause the code to misclassify the supplied file, then the wrong action could occur. For example, 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. In extreme cases, code execution is possible, but the attacker could also cause exhaustion of resources, denial of service, exposure of debug or system data (including application source code), or being bound to a particular server side process. This weakness may be due to a vulnerability in any of the technologies used by the web and application servers, due to misconfiguration, or resultant from another flaw in the application itself.

常见后果

影响范围: Confidentiality

技术影响: Read Application Data

说明: An attacker may be able to read sensitive data.

影响范围: Availability

技术影响: DoS: Crash, Exit, or Restart

说明: 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.

潜在缓解措施

阶段: Architecture and Design

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

引入模式

阶段 说明
Architecture and Design -
Implementation -
Operation -

适用平台

编程语言
Not Language-Specific (Undetermined)
技术
Web Server (Undetermined)
关键信息

CWE ID: CWE-646

抽象级别: Variant

结构: Simple

状态: Incomplete

利用可能性: High

相关弱点
相关攻击模式
CAPEC-209