Weakness · High
CWE-434: Unrestricted Upload of File with Dangerous Type
What it is
The product allows the upload or transfer of dangerous file types that are automatically processed within its environment.
- Severity (our rating)
- High
- Likelihood of exploit
- Medium
- Introduced during
- Architecture and Design, Implementation
- Exploited in the wild
- 23 known exploited CVEs
What an attacker can do
- Execute Unauthorized Code or Commands (Integrity, Confidentiality, Availability)
How to prevent it
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.
- 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.
- Consider storing the uploaded files outside of the web document root entirely. Then, use other mechanisms to deliver the files dynamically.
- 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.
- 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.
- Run your code using the lowest privileges that are required to accomplish the necessary tasks. 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.
- 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.
Implementation
- 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.
- 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.
- When running on a web server that supports case-insensitive filenames, perform case-insensitive evaluations of the extensions that are provided.
- 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.
- 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.
How to find it
- Dynamic Analysis with Automated Results Interpretation. According to SOAR, the following detection techniques may be useful: Cost effective for partial coverage: Web Application Scanner Web Services Scanner Database Scanners
- Dynamic Analysis with Manual Results Interpretation. According to SOAR, the following detection techniques may be useful: Cost effective for partial coverage: Fuzz Tester Framework-based Fuzzer
- Manual Static Analysis - Source Code. According to SOAR, the following detection techniques may be useful: Highly cost effective: Focused Manual Spotcheck - Focused manual analysis of source Manual Source Code Review (not inspections)
- Automated Static Analysis - Source Code. According to SOAR, the following detection techniques may be useful: Highly cost effective: Source code Weakness Analyzer Context-configured Source Code Weakness Analyzer
- Architecture or Design Review. According to SOAR, the following detection techniques may be useful: Highly cost effective: Formal Methods / Correct-By-Construction Cost effective for partial coverage: Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)
Exploited in the wild: 23 CVEs
Vulnerabilities caused by CWE-434 that attackers have used, from CISA's Known Exploited Vulnerabilities catalog, newest first.
- CVE-2026-56291Balbooa Forms Unrestricted Upload of File with Dangerous Type Vulnerability · added July 10, 2026
- CVE-2026-48939iCagenda Unrestricted Upload of File with Dangerous Type Vulnerability · added July 10, 2026
- CVE-2026-48908JoomShaper SP Page Builder Unrestricted Upload of File with Dangerous Type Vulnerability · added July 7, 2026
- CVE-2024-7399Samsung MagicINFO 9 Server Path Traversal Vulnerability · added April 24, 2026
- CVE-2025-2749Kentico Xperience Path Traversal Vulnerability · added April 20, 2026
- CVE-2024-7694TeamT5 ThreatSonar Anti-Ransomware Unrestricted Upload of File with Dangerous Type Vulnerability · added February 17, 2026
- CVE-2025-52691 ransomwareSmarterTools SmarterMail Unrestricted Upload of File with Dangerous Type Vulnerability · added January 26, 2026
- CVE-2018-4063Sierra Wireless AirLink ALEOS Unrestricted Upload of File with Dangerous Type Vulnerability · added December 12, 2025
- CVE-2021-26828OpenPLC ScadaBR Unrestricted Upload of File with Dangerous Type Vulnerability · added December 3, 2025
- CVE-2025-31324 ransomwareSAP NetWeaver Unrestricted File Upload Vulnerability · added April 29, 2025
- CVE-2024-57968Advantive VeraCore Unrestricted File Upload Vulnerability · added March 10, 2025
- CVE-2024-50623 ransomwareCleo Multiple Products Unrestricted File Upload Vulnerability · added December 13, 2024
- CVE-2024-39717Versa Director Dangerous File Type Upload Vulnerability · added August 23, 2024
- CVE-2017-12617Apache Tomcat Remote Code Execution Vulnerability · added March 25, 2022
- CVE-2017-12615 ransomwareApache Tomcat on Windows Remote Code Execution Vulnerability · added March 25, 2022
- CVE-2020-13671Drupal core Un-restricted Upload of File · added January 18, 2022
- CVE-2021-27860FatPipe WARP, IPVPN, and MPVPN Configuration Upload exploit · added January 10, 2022
- CVE-2021-31207 ransomwareMicrosoft Exchange Server Security Feature Bypass Vulnerability · added November 3, 2021
- CVE-2021-20022 ransomwareSonicWall Email Security Unrestricted Upload of File Vulnerability · added November 3, 2021
- CVE-2020-25213WordPress File Manager Plugin Remote Code Execution Vulnerability · added November 3, 2021
- CVE-2020-8260Ivanti Pulse Connect Secure Code Execution Vulnerability · added November 3, 2021
- CVE-2019-8394Zoho ManageEngine ServiceDesk Plus (SDP) File Upload Vulnerability · added November 3, 2021
- CVE-2018-15961Adobe ColdFusion Unrestricted File Upload Vulnerability · added November 3, 2021
H2 Security
Found it in your code?
We review where it appears, fix it with your team, and check it was not already used against you.
Talk to our teamT Academy
Stop writing it in the first place
Learn to build software and systems without weaknesses like this one, with practice on real hosts in your browser, every objective checked on the machine.
Start freeSource: MITRE Common Weakness Enumeration, CWE version 4.19.1. CWE is a trademark of The MITRE Corporation.