Weakness · High
CWE-20: Improper Input Validation
What it is
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
- Severity (our rating)
- High
- Likelihood of exploit
- High
- Introduced during
- Architecture and Design, Implementation
- Exploited in the wild
- 119 known exploited CVEs
In more detail
Input validation is a frequently-used technique for checking potentially dangerous inputs in order to ensure that the inputs are safe for processing within the code, or when communicating with other components. Input can consist of: raw data - strings, numbers, parameters, file contents, etc. metadata - information about the raw data, such as headers or size Data can be simple or structured. Structured data can be composed of many nested layers, composed of combinations of metadata and raw data, with other simple or structured data. Many properties of raw data or metadata may need to be validated upon entry into the code, such as: specified quantities such as size, length, frequency, price, rate, number of operations, time, etc. implied or derived quantities, such as the actual size of a file instead of a specified size indexes, offsets, or positions into more complex data structures symbolic keys or other elements into hash tables, associative arrays, etc. well-formedness, i.e. syntactic correctness - compliance with expected syntax lexical token correctness - compliance with rules for what is treated as a token specified or derived type - the actual type of the input (or what the input appears to be) consistency - between individual data elements, between raw data and metadata, between references, etc. conformance to domain-specific rules, e.g. business logic equivalence - ensuring that equivalent inputs are treated the same authenticity, ownership, or other attestations about the input, e.g. a cryptographic signature to prove the source of the data Implied or derived properties of data must often be calculated or inferred by the code itself. Errors in deriving properties may be considered a contributing factor to improper input validation.
What an attacker can do
- DoS: Crash, Exit, or Restart (Availability)
- DoS: Resource Consumption (CPU) (Availability)
- DoS: Resource Consumption (Memory) (Availability)
- Read Memory (Confidentiality)
- Read Files or Directories (Confidentiality)
- Modify Memory (Integrity, Confidentiality, Availability)
- Execute Unauthorized Code or Commands (Integrity, Confidentiality, Availability)
How to prevent it
Architecture and Design
- Consider using language-theoretic security (LangSec) techniques that characterize inputs using a formal language and build "recognizers" for that language. This effectively requires parsing to be a distinct layer that effectively enforces a boundary between raw input and internal data representations, instead of allowing parser code to be scattered throughout the program, where it could be subject to errors or inconsistencies that create weaknesses.
- Use an input validation framework such as Struts or the OWASP ESAPI Validation API. Note that using a framework does not automatically address all input validation problems; be mindful of weaknesses that could arise from misusing the framework itself (CWE-1173).
- Understand all the potential areas where untrusted inputs can enter the product, including but not limited to: parameters or arguments, cookies, anything read from the network, environment variables, reverse DNS lookups, query results, request headers, URL components, e-mail, files, filenames, databases, and any external systems that provide data to the application. Remember that such inputs may be obtained indirectly through API calls.
- 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. Even though client-side checks provide minimal benefits with respect to server-side security, they are still useful. First, they can support intrusion detection. If the server receives input that should have been rejected by the client, then it may be an indication of an attack. Second, client-side error-checking can provide helpful feedback to the user about the expectations for valid input. Third, there may be a reduction in server-side processing time for accidental input errors, although this is typically a small savings.
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.
- When your application combines data from multiple sources, perform the validation after the sources have been combined. The individual data elements may pass the validation step but violate the intended restrictions after they have been combined.
- Be especially careful to validate all input when invoking code that crosses language boundaries, such as from an interpreted language to native code. This could create an unexpected interaction between the language boundaries. Ensure that you are not violating any of the expectations of the language with which you are interfacing. For example, even though Java may not be susceptible to buffer overflows, providing a large argument in a call to native code might trigger an overflow.
- Directly convert your input type into the expected data type, such as using a conversion function that translates a string into a number. After converting to the expected data type, ensure that the input's values fall within the expected range of allowable values and that multi-field consistencies are maintained.
- Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180, CWE-181). Make sure that your application does not inadvertently decode the same input twice (CWE-174). Such errors could be used to bypass allowlist schemes by introducing dangerous inputs after they have been checked. Use libraries such as the OWASP ESAPI Canonicalization control. Consider performing repeated canonicalization until your input does not change any more. This will avoid double-decoding and similar scenarios, but it might inadvertently modify inputs that are allowed to contain properly-encoded dangerous content.
- When exchanging data between components, ensure that both components are using the same character encoding. Ensure that the proper encoding is applied at each interface. Explicitly set the encoding you are using whenever the protocol allows you to do so.
How to find it
- Automated Static Analysis. Some instances of improper input validation can be detected using automated static analysis. A static analysis tool might allow the user to specify which application-specific methods or functions perform input validation; the tool might also have built-in knowledge of validation frameworks such as Struts. The tool may then suppress or de-prioritize any associated warnings. This allows the analyst to focus on areas of the software in which input validation does not appear to be present. Except in the cases described in the previous paragraph, automated static analysis might not be able to recognize when proper input validation is being performed, leading to false positives - i.e., warnings that do not have any security consequences or require any code changes.
- Manual Static Analysis. When custom input validation is required, such as when enforcing business rules, manual analysis is necessary to ensure that the validation is properly implemented.
- Fuzzing. Fuzzing techniques can be useful for detecting input validation errors. When unexpected inputs are provided to the software, the software should not crash or otherwise become unstable, and it should generate application-controlled error messages. If exceptions or interpreter-generated error messages occur, this indicates that the input was not detected and handled within the application logic itself.
- Automated Static Analysis - Binary or Bytecode. According to SOAR, the following detection techniques may be useful: Cost effective for partial coverage: Bytecode Weakness Analysis - including disassembler + source code weakness analysis Binary Weakness Analysis - including disassembler + source code weakness analysis
- Manual Static Analysis - Binary or Bytecode. According to SOAR, the following detection techniques may be useful: Cost effective for partial coverage: Binary / Bytecode disassembler - then use manual analysis for vulnerabilities & anomalies
- Dynamic Analysis with Automated Results Interpretation. According to SOAR, the following detection techniques may be useful: Highly cost effective: Web Application Scanner Web Services Scanner Database Scanners
- Dynamic Analysis with Manual Results Interpretation. According to SOAR, the following detection techniques may be useful: Highly cost effective: Fuzz Tester Framework-based Fuzzer Cost effective for partial coverage: Host Application Interface Scanner Monitored Virtual Environment - run potentially malicious code in sandbox / wrapper / virtual machine, see if it does anything suspicious
- 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: Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.) Formal Methods / Correct-By-Construction Cost effective for partial coverage: Attack Modeling
Exploited in the wild: 119 CVEs
Vulnerabilities caused by CWE-20 that attackers have used, from CISA's Known Exploited Vulnerabilities catalog, newest first.
- CVE-2026-93952Arista VeloCloud Orchestrator Improper Input Validation Vulnerability · added September 22, 2026
- CVE-2026-12569 ransomwarePTC Windchill and FlexPLM Improper Input Validation Vulnerability · added June 25, 2026
- CVE-2026-34910Ubiquiti UniFi OS Improper Input Validation Vulnerability · added June 23, 2026
- CVE-2026-6973Ivanti Endpoint Manager Mobile (EPMM) Improper Input Validation Vulnerability · added May 7, 2026
- CVE-2026-34197Apache ActiveMQ Improper Input Validation Vulnerability · added April 16, 2026
- CVE-2026-32201Microsoft SharePoint Server Improper Input Validation Vulnerability · added April 14, 2026
- CVE-2025-20393Cisco Multiple Products Improper Input Validation Vulnerability · added December 17, 2025
- CVE-2025-54236Adobe Commerce and Magento Improper Input Validation Vulnerability · added October 24, 2025
- CVE-2025-6558Google Chromium ANGLE and GPU Improper Input Validation Vulnerability · added July 22, 2025
- CVE-2024-21413Microsoft Outlook Improper Input Validation Vulnerability · added February 6, 2025
- CVE-2016-3714ImageMagick Improper Input Validation Vulnerability · added September 9, 2024
- CVE-2024-38189Microsoft Project Remote Code Execution Vulnerability · added August 13, 2024
- CVE-2024-30040Microsoft Windows MSHTML Platform Security Feature Bypass Vulnerability · added May 14, 2024
- CVE-2024-3400 ransomwarePalo Alto Networks PAN-OS Command Injection Vulnerability · added April 12, 2024
- CVE-2023-41266 ransomwareQlik Sense Path Traversal Vulnerability · added December 7, 2023
- CVE-2023-36563Microsoft WordPad Information Disclosure Vulnerability · added October 10, 2023
- CVE-2014-8361Realtek SDK Improper Input Validation Vulnerability · added September 18, 2023
- CVE-2021-25489Samsung Mobile Devices Improper Input Validation Vulnerability · added June 29, 2023
- CVE-2023-2868Barracuda Networks ESG Appliance Improper Input Validation Vulnerability · added May 26, 2023
- CVE-2010-3904Linux Kernel Improper Input Validation Vulnerability · added May 12, 2023
- CVE-2022-39197Fortra Cobalt Strike Teamserver Cross-Site Scripting (XSS) Vulnerability · added March 30, 2023
- CVE-2021-30900Apple iOS, iPadOS, and macOS Out-of-Bounds Write Vulnerability · added March 30, 2023
- CVE-2015-2291 ransomwareIntel Ethernet Diagnostics Driver for Windows Denial-of-Service Vulnerability · added February 10, 2023
- CVE-2023-22952Multiple SugarCRM Products Remote Code Execution Vulnerability · added February 2, 2023
- CVE-2017-11357 ransomwareTelerik UI for ASP.NET AJAX Insecure Direct Object Reference Vulnerability · added January 26, 2023
- CVE-2022-42827Apple iOS and iPadOS Out-of-Bounds Write Vulnerability · added October 25, 2022
- CVE-2013-6282Linux Kernel Improper Input Validation Vulnerability · added September 15, 2022
- CVE-2010-2568Microsoft Windows Remote Code Execution Vulnerability · added September 15, 2022
- CVE-2022-37969 ransomwareMicrosoft Windows Common Log File System (CLFS) Driver Privilege Escalation Vulnerability · added September 14, 2022
- CVE-2022-32917Apple iOS, iPadOS, and macOS Remote Code Execution Vulnerability · added September 14, 2022
- CVE-2022-3075Google Chromium Mojo Insufficient Data Validation Vulnerability · added September 8, 2022
- CVE-2021-31010Apple iOS, macOS, watchOS Sandbox Bypass Vulnerability · added August 25, 2022
- CVE-2022-32894Apple iOS and macOS Out-of-Bounds Write Vulnerability · added August 18, 2022
- CVE-2022-32893Apple iOS and macOS Out-of-Bounds Write Vulnerability · added August 18, 2022
- CVE-2022-2856Google Chromium Intents Insufficient Input Validation Vulnerability · added August 18, 2022
- CVE-2022-29499 ransomwareMitel MiVoice Connect Data Validation Vulnerability · added June 27, 2022
- CVE-2019-7193 ransomwareQNAP QTS Improper Input Validation Vulnerability · added June 8, 2022
- CVE-2012-0151Microsoft Windows Authenticode Signature Verification Remote Code Execution Vulnerability · added June 8, 2022
- CVE-2016-0034 ransomwareMicrosoft Silverlight Runtime Remote Code Execution Vulnerability · added May 25, 2022
- CVE-2013-3896Microsoft Silverlight Information Disclosure Vulnerability · added May 25, 2022
- CVE-2018-19949 ransomwareQNAP NAS File Station Command Injection Vulnerability · added May 24, 2022
- CVE-2019-11708Mozilla Firefox and Thunderbird Sandbox Escape Vulnerability · added May 23, 2022
- CVE-2007-3010Alcatel OmniPCX Enterprise Remote Code Execution Vulnerability · added April 15, 2022
- CVE-2021-42278 ransomwareMicrosoft Active Directory Domain Services Privilege Escalation Vulnerability · added April 11, 2022
- CVE-2017-0148 ransomwareMicrosoft SMBv1 Server Remote Code Execution Vulnerability · added April 6, 2022
- CVE-2022-22675Apple macOS Out-of-Bounds Write Vulnerability · added April 4, 2022
- CVE-2022-22674Apple macOS Out-of-Bounds Read Vulnerability · added April 4, 2022
- CVE-2018-8414Microsoft Windows Shell Remote Code Execution Vulnerability · added March 25, 2022
- CVE-2018-0147Cisco Secure Access Control System Java Deserialization Vulnerability · added March 25, 2022
- CVE-2018-0125Cisco VPN Routers Remote Code Execution Vulnerability · added March 25, 2022
- CVE-2017-6316Citrix Multiple Products Remote Code Execution Vulnerability · added March 25, 2022
- CVE-2017-3881Cisco IOS and IOS XE Remote Code Execution Vulnerability · added March 25, 2022
- CVE-2017-0146 ransomwareMicrosoft Windows SMB Remote Code Execution Vulnerability · added March 25, 2022
- CVE-2013-2251Apache Struts Improper Input Validation Vulnerability · added March 25, 2022
- CVE-2012-1823PHP-CGI Query String Parameter Vulnerability · added March 25, 2022
- CVE-2010-3035Cisco IOS XR Border Gateway Protocol (BGP) Denial-of-Service Vulnerability · added March 25, 2022
- CVE-2009-2055Cisco IOS XR Border Gateway Protocol (BGP) Denial-of-Service Vulnerability · added March 25, 2022
- CVE-2009-0927Adobe Reader and Adobe Acrobat Stack-Based Buffer Overflow Vulnerability · added March 25, 2022
- CVE-2021-21973VMware vCenter Server and Cloud Foundation Server Side Request Forgery (SSRF) Vulnerability · added March 7, 2022
- CVE-2019-1652Cisco Small Business Routers Improper Input Validation Vulnerability · added March 3, 2022
- CVE-2018-0174Cisco IOS Software and Cisco IOS XE Software Improper Input Validation Vulnerability · added March 3, 2022
- CVE-2018-0173Cisco IOS and IOS XE Software Improper Input Validation Vulnerability · added March 3, 2022
- CVE-2018-0172Cisco IOS and IOS XE Software Improper Input Validation Vulnerability · added March 3, 2022
- CVE-2018-0159Cisco IOS and XE Software Internet Key Exchange Version 1 Denial-of-Service Vulnerability · added March 3, 2022
- CVE-2018-0158Cisco IOS and XE Software Internet Key Exchange Memory Leak Vulnerability · added March 3, 2022
- CVE-2017-12319Cisco IOS XE Software Ethernet Virtual Private Network Border Gateway Protocol Denial-of-Service Vulnerability · added March 3, 2022
- CVE-2017-12240Cisco IOS and IOS XE Software DHCP Remote Code Execution Vulnerability · added March 3, 2022
- CVE-2017-12235Cisco IOS Software for Cisco Industrial Ethernet Switches PROFINET Denial-of-Service Vulnerability · added March 3, 2022
- CVE-2017-12234Cisco IOS Software Common Industrial Protocol Request Denial-of-Service Vulnerability · added March 3, 2022
- CVE-2017-12233Cisco IOS Software Common Industrial Protocol Request Denial-of-Service Vulnerability · added March 3, 2022
- CVE-2016-8562Siemens SIMATIC CP 1543-1 Improper Privilege Management Vulnerability · added March 3, 2022
- CVE-2016-7262Microsoft Office Security Feature Bypass Vulnerability · added March 3, 2022
- CVE-2015-2545Microsoft Office Malformed EPS File Vulnerability · added March 3, 2022
- CVE-2014-4114Microsoft Windows Object Linking & Embedding (OLE) Remote Code Execution Vulnerability · added March 3, 2022
- CVE-2013-5065Microsoft Windows Kernel Privilege Escalation Vulnerability · added March 3, 2022
- CVE-2009-1123Microsoft Windows Improper Input Validation Vulnerability · added March 3, 2022
- CVE-2022-24086Adobe Commerce and Magento Open Source Improper Input Validation Vulnerability · added February 15, 2022
- CVE-2017-9791Apache Struts 1 Improper Input Validation Vulnerability · added February 10, 2022
- CVE-2017-0145 ransomwareMicrosoft SMBv1 Remote Code Execution Vulnerability · added February 10, 2022
- CVE-2017-0144 ransomwareMicrosoft SMBv1 Remote Code Execution Vulnerability · added February 10, 2022
- CVE-2016-3088Apache ActiveMQ Improper Input Validation Vulnerability · added February 10, 2022
- CVE-2022-22587Apple Memory Corruption Vulnerability · added January 28, 2022
- CVE-2021-35247SolarWinds Serv-U Improper Input Validation Vulnerability · added January 21, 2022
- CVE-2012-0391Apache Struts 2 Improper Input Validation Vulnerability · added January 21, 2022
- CVE-2013-3900Microsoft WinVerifyTrust function Remote Code Execution · added January 10, 2022
- CVE-2021-44228 ransomwareApache Log4j2 Remote Code Execution Vulnerability · added December 10, 2021
- CVE-2017-17562Embedthis GoAhead Remote Code Execution Vulnerability · added December 10, 2021
- CVE-2010-1871Red Hat Linux JBoss Seam 2 Remote Code Execution Vulnerability · added December 10, 2021
- CVE-2020-11261Qualcomm Multiple Chipsets Improper Input Validation Vulnerability · added December 1, 2021
- CVE-2021-38000Google Chromium Intents Improper Input Validation Vulnerability · added November 3, 2021
- CVE-2021-36742Trend Micro Multiple Products Improper Input Validation Vulnerability · added November 3, 2021
- CVE-2021-35395Realtek AP-Router SDK Buffer Overflow Vulnerability · added November 3, 2021
- CVE-2021-31207 ransomwareMicrosoft Exchange Server Security Feature Bypass Vulnerability · added November 3, 2021
- CVE-2021-30860Apple Multiple Products Integer Overflow Vulnerability · added November 3, 2021
- CVE-2021-30663Apple Multiple Products WebKit Integer Overflow Vulnerability · added November 3, 2021
- CVE-2021-27104 ransomwareAccellion FTA OS Command Injection Vulnerability · added November 3, 2021
- CVE-2021-27102 ransomwareAccellion FTA OS Command Injection Vulnerability · added November 3, 2021
- CVE-2021-22502Micro Focus Operation Bridge Report (OBR) Remote Code Execution Vulnerability · added November 3, 2021
- CVE-2021-22205 ransomwareGitLab Community and Enterprise Editions Remote Code Execution Vulnerability · added November 3, 2021
- CVE-2021-21985 ransomwareVMware vCenter Server Improper Input Validation Vulnerability · added November 3, 2021
- CVE-2021-21220Google Chromium V8 Improper Input Validation Vulnerability · added November 3, 2021
- CVE-2020-8195Citrix ADC, Gateway, and SD-WAN WANOP Appliance Information Disclosure Vulnerability · added November 3, 2021
- CVE-2020-3452Cisco ASA and FTD Read-Only Path Traversal Vulnerability · added November 3, 2021
- CVE-2020-3161Cisco IP Phones Web Server Remote Code Execution and Denial-of-Service Vulnerability · added November 3, 2021
- CVE-2020-1040Microsoft Hyper-V RemoteFX vGPU Remote Code Execution Vulnerability · added November 3, 2021
- CVE-2020-0041Android Kernel Out-of-Bounds Write Vulnerability · added November 3, 2021
- CVE-2019-0604 ransomwareMicrosoft SharePoint Remote Code Execution Vulnerability · added November 3, 2021
- CVE-2018-20062ThinkPHP "noneCms" Remote Code Execution Vulnerability · added November 3, 2021
- CVE-2018-11776Apache Struts Remote Code Execution Vulnerability · added November 3, 2021
- CVE-2018-7600 ransomwareDrupal Core Remote Code Execution Vulnerability · added November 3, 2021
- CVE-2018-0296Cisco Adaptive Security Appliance (ASA) Denial-of-Service Vulnerability · added November 3, 2021
- CVE-2018-0171Cisco IOS and IOS XE Software Smart Install Remote Code Execution Vulnerability · added November 3, 2021
- CVE-2017-9822 ransomwareDotNetNuke (DNN) Remote Code Execution Vulnerability · added November 3, 2021
- CVE-2017-8759Microsoft .NET Framework Remote Code Execution Vulnerability · added November 3, 2021
- CVE-2017-6327Symantec Messaging Gateway Remote Code Execution Vulnerability · added November 3, 2021
- CVE-2017-5638 ransomwareApache Struts Remote Code Execution Vulnerability · added November 3, 2021
- CVE-2017-0143 ransomwareMicrosoft Windows Server Message Block (SMBv1) Remote Code Execution Vulnerability · added November 3, 2021
- CVE-2016-3718ImageMagick Server-Side Request Forgery (SSRF) Vulnerability · added November 3, 2021
- CVE-2016-0185Microsoft Windows Media Center Remote Code Execution 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.