CWE-20: Improper Input Validation

ClassStableExploit Likelihood: High🏆 #9 in Top 25 (2024)

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.

View on MITRE
2,318Related CVEs
15.98Severity Score
Back to CWE Lookup

Extended Description

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.

Technical Details

Structure
Simple
Vulnerability Mapping
DISCOURAGED

Applicable To

Languages
Not Language-Specific
Platforms

🏆 CWE Top 25 Historical Ranking

2023:#6
Score: 15.50
2,188 CVEs
2024:#9↓3
Score: 15.98
2,318 CVEs
Trend:Improving (moved up 3 ranks)

Source-backed guidance

Additional facts reviewed against primary or authoritative security sources.

Combine review and analysis around the CWE-20 trust boundary

MITRE identifies automated static analysis, manual static analysis, fuzzing as applicable detection approaches. Use them to enumerate every trust boundary and verify complete syntactic and semantic validation before data influences memory sizes, control flow, interpreters, or security decisions. Require a reproducible source-to-sink or policy-to-enforcement trace, record coverage gaps, and confirm suspected findings dynamically where safe; no single scanner can establish complete coverage for this weakness.

CWE-20: detection methods and operational guidanceMITRE CWE

Validate syntax and business meaning at the trust boundary

Validate data as soon as it arrives from every untrusted source, including partner and backend feeds. Enforce both syntactic rules, such as type, length, range, and complete structured formats, and semantic rules, such as valid date order or permitted business values. Perform validation on the server with allowlists; do not treat general input validation as a substitute for context-specific XSS or injection defenses.

Input Validation Cheat SheetOWASP Foundation

Apply lessons from CVE-2024-21413 in Microsoft Outlook

NVD maps CVE-2024-21413 to CWE-20; improper input validation could allow remote code execution and bypass Protected View so content opened in editing mode. Use the case to test protocol and link parsing before trust-zone decisions, reject ambiguous representations, and verify that malformed external content cannot cross into a less restricted execution mode.

CVE-2024-21413 DetailNIST National Vulnerability Database

Prioritize CWE-20 using its 2025 CWE Top 25 evidence

CWE-20 ranked #18 in the 2025 CWE Top 25 with a score of 4.09. The ranking table recorded 2 mapped vulnerabilities in CISA KEV for this measurement window. Use the rank to prioritize systemic prevention, detection coverage, and recurring-root-cause metrics across the portfolio, while retaining asset exposure and business impact for individual finding severity decisions.

2025 CWE Top 25 Most Dangerous Software WeaknessesMITRE CWE

Build boundary, grammar, and semantic validation suites

For each input, document type, range, length, encoding, grammar, cross-field relationships, and allowed business meaning. Test empty, omitted, duplicate, boundary, overflow, malformed structured, alternate encoding, and logically impossible values on the server. Add property-based or grammar-aware fuzzing where practical and verify rejection occurs before allocation, interpretation, authorization, or persistence.

Testing for Input ValidationOWASP Foundation

Frequently Asked Questions

What is CWE-20: Improper Input Validation?+

CWE-20: Improper Input Validation is a Common Weakness Enumeration (CWE) entry maintained by MITRE. 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. 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.

Is CWE-20 in the CWE Top 25 Most Dangerous Software Weaknesses?+

Yes. CWE-20 ranked #9 in the CWE Top 25 for 2024, associated with 2,318 CVEs that year. The CWE Top 25 highlights the most common and impactful software weaknesses based on real-world vulnerability data.

What are the security consequences of Improper Input Validation?+

If exploited, CWE-20 (Improper Input Validation) it can compromise Availability, Confidentiality and Integrity, leading to outcomes such as DoS: Crash, Exit, or Restart, DoS: Resource Consumption (CPU), DoS: Resource Consumption (Memory), Read Memory, Read Files or Directories and Modify Memory.

How do you prevent or mitigate Improper Input Validation?+

Recommended mitigations for CWE-20 include: 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. [REF-1109] [REF-1110] [REF-1111] 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. 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.

How is Improper Input Validation detected?+

CWE-20 can be detected using Automated Static Analysis - Binary or Bytecode, Manual Static Analysis - Binary or Bytecode, Dynamic Analysis with Automated Results Interpretation, Dynamic Analysis with Manual Results Interpretation, Manual Static Analysis - Source Code and Automated Static Analysis - Source Code. Combining automated tooling with manual review typically yields the best coverage.

Which programming languages are affected by Improper Input Validation?+

CWE-20 commonly affects Not Language-Specific. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What are real-world examples of Improper Input Validation?+

MITRE documents real CVEs mapped to CWE-20, including CVE-2024-37032, CVE-2022-45918, CVE-2021-30860, CVE-2021-30663 and CVE-2021-22205. You can look up the full details of each CVE, including CVSS scores and remediation guidance, on our CVE Lookup tool.

What is the difference between a CWE and a CVE?+

A CWE (Common Weakness Enumeration) like CWE-20 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.

Learn More

Advertisement